Custom Aerial unit Not Firing

Everything about mods can be found here.

Moderator: Morax

Custom Aerial unit Not Firing

Postby LJ_Pynn » 26 Apr 2020, 08:39

You know, I never thought modeling and importing would be the easy part.

So, I have a T1 Aerial unit that is Direct Fire & Groundfire, like a gunship. Building, targeting, and movement are all fine, but it does not actually attack the targets.

I created a custom weapon file in /hook/lua:

Code: Select all
TIEBolt = Class(DefaultProjectileWeapon) {
    FxMuzzleFlash = EffectTemplate.ADisruptorCannonMuzzle01,}


Linked it to script:

Code: Select all
local TAirUnit = import('/lua/terranunits.lua').TAirUnit
local TIEBolt = import('/lua/aeonweapons.lua').TIEBolt

GEA0102 = Class(TAirUnit)

    Weapons = {
        MainGun = Class(TIEBolt) {
      },
    },

TypeClass = GEA0102


And this is the weapon in .bp (Note: In Blender, I have two weapon muzzle bones [Muzzle_01 & Muzzle_02] parented to 'Turret' bone, and that to the unit's main GEA0102 bone):

Code: Select all
    Weapon = {
        {
            AboveWaterTargetsOnly = true,
            Audio = {
                MuzzleChargeStart = Sound {
                    Bank = 'UALWeapon',
                    Cue = 'UAL0201_Cannon_Disruptor',
                    LodCutoff = 'Weapon_LodCutoff',
                },
            },
            BallisticArc = 'RULEUBA_none',
            CollideFriendly = false,
            Damage = 10,
            DamageRadius = 3,
            DamageType = 'Normal',
            DisplayName = 'Disruptor Cannon',
            FireTargetLayerCapsTable = {
                Air = 'Land|Water|Seabed',
                Land = 'Land|Water|Seabed',
            },
            FiringTolerance = 2,
            Label = 'MainGun',
            MaxRadius = 25,
            MuzzleSalvoSize = 1,
            MuzzleVelocity = 30,
            ProjectileId = '/projectiles/ADFDisruptor01/ADFDisruptor01_proj.bp',
            ProjectileLifetimeUsesMultiplier = 1.15,
            ProjectilesPerOnFire = 2,
            RackBones = {
                {
                    MuzzleBones = {
                        'Muzzle_01',
                  'Muzzle_02',
                    },
                    RackBone = 'Turret',
                },
            },
            RackFireTogether = true,
            RackRecoilDistance = 0,
            RackReloadTimeout = 10,
            RackSalvoChargeTime = 0,
            RackSalvoReloadTime = 0,
            RackSalvoSize = 1,
            RackSlavedToTurret = false,
            RangeCategory = 'UWRC_DirectFire',
            RateOfFire = 5,
            SlavedToBody = true,
            SlavedToBodyArcRange = 5,
            TargetCheckInterval = 1,
            TargetPriorities = {
                'SPECIALHIGHPRI',
                'STRUCTURE',
                'SPECIALLOWPRI',
                'ALLUNITS',
            },
            TargetRestrictDisallow = 'UNTARGETABLE',
            TrackingRadius = 1.15,
            TurretBoneMuzzle = 'Muzzle_01',
            TurretBonePitch = 'Turret',
            TurretBoneYaw = 'Turret',
            TurretDualManipulators = false,
            TurretPitch = 0,
            TurretPitchRange = 20,
            TurretPitchSpeed = 60,
            TurretYaw = 0,
            TurretYawRange = 10,
            TurretYawSpeed = 60,
            Turreted = true,
            WeaponCategory = 'Direct Fire',
        },



The unit will be built, can target enemies, will fly toward them, but will not fire down on them at all. The .bp (less the weapon above) is just a Gunship with the circling removed, so it just goes by like a bomber. Any ideas?
Attachments
TIE Striker Bone issues.png
TIE Striker Bone issues.png (404.65 KiB) Viewed 1111 times
LJ_Pynn
 
Posts: 5
Joined: 22 Apr 2020, 08:43
Has liked: 0 time
Been liked: 0 time
FAF User Name: LJ_Pynn

Re: Custom Aerial unit Not Firing

Postby Uveso » 26 Apr 2020, 23:13

Hello LJ_Pynn,

It's not possible to give you any advice without viewing the full code and/or test the unit and view the game error log.

So if you like, upload your unit here and we can test/debug it.

You could also join our FAF map/mod discord server to meet other unitcreators and ask there for more help:

- Maps and Mods Team Server:
https://discord.gg/gN4SdPb
User avatar
Uveso
Supreme Commander
 
Posts: 1788
Joined: 11 Dec 2015, 20:56
Location: Germany
Has liked: 70 times
Been liked: 291 times
FAF User Name: Uveso

Re: Custom Aerial unit Not Firing

Postby LJ_Pynn » 26 Apr 2020, 23:40

Right-o. Here's a mod folder with the unit and weapon file:

https://drive.google.com/file/d/1WBNvyJ ... sp=sharing

And here's the entirety of the unit .bp itself, if that's more simple:

Code: Select all
UnitBlueprint {
    AI = {
        BeaconName = 'GEB5102',
    },
    Air = {
        AutoLandTime = 1,
        BankFactor = 3,
        BankForward = false,
        BreakOffDistance = 18,
        BreakOffIfNearNewTarget = true,
        BreakOffTrigger = 20,
        CanFly = true,
        CombatTurnSpeed = 0.7,
        EngageDistance = 50,
        KLift = 3,
        KLiftDamping = 2.5,
        KMove = 1,
        KMoveDamping = 2,
        KRoll = 2,
        KRollDamping = 2,
        KTurn = 0.7,
        KTurnDamping = 1,
        LiftFactor = 7,
        MaxAirspeed = 10,
        MinAirspeed = 10, 
        StartTurnDistance = 5,
        TightTurnMultiplier = 0,
        TurnSpeed = 0.9,
        Winged = true,
    },
    Audio = {
        AirUnitWaterImpact = Sound {
            Bank = 'Explosions',
            Cue = 'Expl_Water_Lrg_01',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        AmbientMove = Sound {
            Bank = 'UEA',
            Cue = 'UEA0203_Move_Loop',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        Destroyed = Sound {
            Bank = 'UEADestroy',
            Cue = 'UEA_Destroy_Med',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        Killed = Sound {
            Bank = 'UEADestroy',
            Cue = 'UEA_Destroy_Air_Killed',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        Landing = Sound {
            Bank = 'UEA',
            Cue = 'UEA0203_Move_Land',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        Refueling = Sound {
            Bank = 'UEA',
            Cue = 'UEA_Repair_Refuel',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        StartMove = Sound {
            Bank = 'UEA',
            Cue = 'UEA0203_Move_Start',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        StopMove = Sound {
            Bank = 'UEA',
            Cue = 'UEA0203_Move_Stop',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        Thruster = Sound {
            Bank = 'UEA',
            Cue = 'UEA0203_Thruster',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        UISelection = Sound {
            Bank = 'Interface',
            Cue = 'UEF_Select_Air',
            LodCutoff = 'UnitMove_LodCutoff',
        },
    },
    AverageDensity = 1,
    Buffs = {
        Regen = {
            Level1 = 2,
            Level2 = 4,
            Level3 = 6,
            Level4 = 8,
            Level5 = 10,
        },
    },
    BuildIconSortPriority = 30,
    Categories = {
        'PRODUCTSC1',
        'SELECTABLE',
        'BUILTBYTIER1FACTORY',
      'BUILTBYTIER2FACTORY',
        'BUILTBYTIER3FACTORY',
        'UEF',
      'EMPIRE',
        'MOBILE',
        'AIR',
        'TECH1',
        'GROUNDATTACK',
      'DIRECTFIRE',
        'VISIBLETORECON',
        'RECLAIMABLE',
        'OVERLAYDIRECTFIRE',
    },
    CollisionOffsetZ = 0.3,
    Defense = {
        AirThreatLevel = 0,
        ArmorType = 'Light',
        EconomyThreatLevel = 0,
        Health = 125,
        MaxHealth = 125,
        RegenRate = 0,
        SubThreatLevel = 0,
        SurfaceThreatLevel = 6,
    },
    Description = '<LOC gea0102_desc>Attack Striker',
    Display = {
        ForcedBuildSpin = 0,
        LayerChangeEffects = {
            AirLand = {
                Effects = {
                    {
                        Bones = {
                            'Exhaust',
                        },
                        Type = 'Landing01',
                    },
                },
            },
            LandAir = {
                Effects = {
                    {
                        Bones = {
                            'Exhaust',
                        },
                        Type = 'TakeOff01',
                    },
                },
            },
        },
        Mesh = {
            IconFadeInZoom = 130,
            LODs = {
                {
                    LODCutoff = 140,
                    ShaderName = 'Unit',
                },
                {
                    AlbedoName = 'gea0102_lod1_albedo.dds',
                    LODCutoff = 215,
                    ShaderName = 'Unit',
                    SpecularName = 'gea0102_lod1_specteam.dds',
                },
            },
        },
        MovementEffects = {
            BeamExhaust = {
                Bones = {
                    'Exhaust',
                },
                Cruise = true,
                Idle = true,
            },
        },
        PlaceholderMeshName = 'UXA0009',
        SpawnRandomRotation = false,
        UniformScale = 0.08,
    },
    Economy = {
        BuildCostEnergy = 40,
        BuildCostMass = 20,
        BuildTime = 10,
    },
    Footprint = {
        MaxSlope = 0.25,
        SizeX = 1,
        SizeZ = 1,
    },
    General = {
        Category = 'Gunship',
        Classification = 'RULEUC_MilitaryAircraft',
        CommandCaps = {
            RULEUCC_Attack = true,
            RULEUCC_CallTransport = true,
            RULEUCC_Capture = false,
            RULEUCC_Dock = false,
            RULEUCC_Ferry = false,
            RULEUCC_Guard = true,
            RULEUCC_Move = true,
            RULEUCC_Nuke = false,
            RULEUCC_Patrol = true,
            RULEUCC_Reclaim = false,
            RULEUCC_Repair = false,
            RULEUCC_RetaliateToggle = true,
            RULEUCC_Stop = true,
            RULEUCC_Transport = false,
        },
        FactionName = 'UEF',
        Icon = 'air',
        TechLevel = 'RULEUTL_Advanced',
        UnitName = '<LOC gea0102_name>TIE Striker',
        UnitWeight = 1,
    },
    Intel = {
        VisionRadius = 32,
    },
    Interface = {
        HelpText = '<LOC gea0102_help>Attack Striker',
    },
    LifeBarHeight = 0.075,
    LifeBarOffset = 0.5,
    LifeBarSize = 1,
    Physics = {
        BuildOnLayerCaps = {
            LAYER_Air = true,
            LAYER_Land = false,
            LAYER_Orbit = false,
            LAYER_Seabed = false,
            LAYER_Sub = false,
            LAYER_Water = false,
        },
        Elevation = 10,
        FuelRechargeRate = 5,
        FuelUseTime = 500,
        GroundCollisionOffset = 1.6,
        MaxSpeed = 0.5,
        MeshExtentsX = 1.25,
        MeshExtentsY = 1,
        MeshExtentsZ = 3,
        MotionType = 'RULEUMT_Air',
    },
    SelectionSizeX = 0.6,
    SelectionSizeZ = 0.9,
    SelectionThickness = 0.49,
    SizeSphere = 1.6,
    SizeX = 1,
    SizeY = 0.5,
    SizeZ = 1,
    StrategicIconName = 'icon_gunship2_directfire',
    StrategicIconSortPriority = 65,
    Veteran = {
        Level1 = 6,
        Level2 = 12,
        Level3 = 18,
        Level4 = 24,
        Level5 = 30,
    },
    Weapon = {
        {
            AboveWaterTargetsOnly = true,
            Audio = {
                MuzzleChargeStart = Sound {
                    Bank = 'UALWeapon',
                    Cue = 'UAL0201_Cannon_Disruptor',
                    LodCutoff = 'Weapon_LodCutoff',
                },
            },
            BallisticArc = 'RULEUBA_none',
            CollideFriendly = false,
            Damage = 10,
            DamageRadius = 3,
            DamageType = 'Normal',
            DisplayName = 'Disruptor Cannon',
            FireTargetLayerCapsTable = {
                Air = 'Land|Water|Seabed',
                Land = 'Land|Water|Seabed',
            },
            FiringTolerance = 2,
            Label = 'MainGun',
            MaxRadius = 25,
            MuzzleSalvoSize = 1,
            MuzzleVelocity = 30,
            ProjectileId = '/projectiles/ADFDisruptor01/ADFDisruptor01_proj.bp',
            ProjectileLifetimeUsesMultiplier = 1.15,
            ProjectilesPerOnFire = 2,
            RackBones = {
                {
                    MuzzleBones = {
                        'Muzzle_01',
                  'Muzzle_02',
                    },
                    RackBone = 'Turret',
                },
            },
            RackFireTogether = false,
            RackRecoilDistance = 0,
            RackReloadTimeout = 10,
            RackSalvoChargeTime = 0,
            RackSalvoReloadTime = 0,
            RackSalvoSize = 1,
            RackSlavedToTurret = false,
            RangeCategory = 'UWRC_DirectFire',
            RateOfFire = 3,
            SlavedToBody = true,
            SlavedToBodyArcRange = 5,
            TargetCheckInterval = 1,
            TargetPriorities = {
                'SPECIALHIGHPRI',
                'STRUCTURE',
                'SPECIALLOWPRI',
                'ALLUNITS',
            },
            TargetRestrictDisallow = 'UNTARGETABLE',
            TrackingRadius = 1.15,
            TurretBoneMuzzle = 'Muzzle_01',
            TurretBonePitch = 'Turret',
            TurretBoneYaw = 'Turret',
            TurretDualManipulators = false,
            TurretPitch = 0,
            TurretPitchRange = 20,
            TurretPitchSpeed = 60,
            TurretYaw = 0,
            TurretYawRange = 10,
            TurretYawSpeed = 60,
            Turreted = true,
            WeaponCategory = 'Direct Fire',
        },
        {
            AboveWaterTargetsOnly = true,
            Damage = 50,
            DamageFriendly = true,
            DamageRadius = 1,
            DamageType = 'Normal',
            DisplayName = 'Air Crash',
            DummyWeapon = true,
            FiringTolerance = 2,
            Label = 'DeathImpact',
            WeaponCategory = 'Death',
        },
    },
    Wreckage = {
        Blueprint = '/props/DefaultWreckage/DefaultWreckage_prop.bp',
        EnergyMult = 0,
        HealthMult = 0.9,
        MassMult = 0.9,
        ReclaimTimeMultiplier = 1,
        WreckageLayers = {
            Air = false,
            Land = true,
            Seabed = false,
            Sub = false,
            Water = false,
        },
    },
}
LJ_Pynn
 
Posts: 5
Joined: 22 Apr 2020, 08:43
Has liked: 0 time
Been liked: 0 time
FAF User Name: LJ_Pynn

Re: Custom Aerial unit Not Firing

Postby DDDX » 27 Apr 2020, 14:59

your pitch and yaw are very small. I assume turret is positioned in a straight line. Plus the unit is flying. Plus the range is only 25.

That means you have to come very near the land target, then fire at an angle that is much larger than your 20. Increase pitch to 60, see what happens ;)
Check out my 2 maps: "Survival_Mayhem&BO_3d_v1" "Survival_Mayhem&BO_3d_RPG"
as well as my mod: "Survival Mayhem&BO balance"
-- let me know of any bugs or issues regarding those 3.
DDDX
Avatar-of-War
 
Posts: 170
Joined: 21 Mar 2016, 16:13
Has liked: 18 times
Been liked: 16 times
FAF User Name: DDDX

Re: Custom Aerial unit Not Firing

Postby Uveso » 28 Apr 2020, 00:20

@DDDX:

download the files and try it yourself :D

I already changed some stuff, replaced the weapon compleatly (its was former a tank weapon) and changed every value.
I don't get it why this weapon is not firing.
If you rename the sound inside the weapo to "fire" then you can hear the weapon but you dont see any projectiles.

Really Strage. i bet i am just dump, but you could take a look and fix it ? :D
User avatar
Uveso
Supreme Commander
 
Posts: 1788
Joined: 11 Dec 2015, 20:56
Location: Germany
Has liked: 70 times
Been liked: 291 times
FAF User Name: Uveso

Re: Custom Aerial unit Not Firing

Postby DDDX » 28 Apr 2020, 12:38

found it.
Well the unit has 2 muzzles, right? And no delay specified between them.


MuzzleSalvoDelay = 0, --this needs to be in.

Also, the script file lacked some brackets and I increased the slavedToBody and the pitch/yaw values because without them the unit would not shoot unless facing straight forward.
Check out my 2 maps: "Survival_Mayhem&BO_3d_v1" "Survival_Mayhem&BO_3d_RPG"
as well as my mod: "Survival Mayhem&BO balance"
-- let me know of any bugs or issues regarding those 3.
DDDX
Avatar-of-War
 
Posts: 170
Joined: 21 Mar 2016, 16:13
Has liked: 18 times
Been liked: 16 times
FAF User Name: DDDX

Re: Custom Aerial unit Not Firing

Postby LJ_Pynn » 28 Apr 2020, 15:47

I cherish this forum so much! That worked perfectly. Thanks a lot!
LJ_Pynn
 
Posts: 5
Joined: 22 Apr 2020, 08:43
Has liked: 0 time
Been liked: 0 time
FAF User Name: LJ_Pynn

Re: Custom Aerial unit Not Firing

Postby DDDX » 28 Apr 2020, 22:57

sure thing buddy. I was only able to help because people here like Uveso have been there for me, over 2 years ago, to help me with my, then extremely noob and basic, problems ;)
Check out my 2 maps: "Survival_Mayhem&BO_3d_v1" "Survival_Mayhem&BO_3d_RPG"
as well as my mod: "Survival Mayhem&BO balance"
-- let me know of any bugs or issues regarding those 3.
DDDX
Avatar-of-War
 
Posts: 170
Joined: 21 Mar 2016, 16:13
Has liked: 18 times
Been liked: 16 times
FAF User Name: DDDX


Return to Mods & Tools

Who is online

Users browsing this forum: No registered users and 1 guest