Mod Help/Resources

Everything about mods can be found here.

Moderator: Morax

Mod Help/Resources

Postby Killzone » 10 Apr 2017, 11:06

Hello all. I have recently decided to try my hand at modding SC:FA. I'm an amateur programmer, with a bit of programming experience (some lua, a good deal C#). I have a little modding experience (Mostly Wither 3) and I'm looking for any sort of resource/tutorial or whatever you want to call it that would help a noob get started. I've found a written tutorial (By Exavier Macbeth) which has described how to unzip the game files and has explained what most of the values do. Anyway, the biggest issue right now is finding the exact unit I want to modify. GPG's naming system is not at all intuitive, and I'd rather not have to randomly open each file until I find the one I want.

Any other helpful info would be greatly appreciated :) Cheers!
Killzone
 
Posts: 7
Joined: 10 Apr 2017, 10:48
Has liked: 0 time
Been liked: 0 time
FAF User Name: Killzone

Re: Mod Help/Resources

Postby speed2 » 10 Apr 2017, 11:17

User avatar
speed2
Contributor
 
Posts: 3189
Joined: 05 Jan 2013, 15:11
Has liked: 636 times
Been liked: 1119 times
FAF User Name: speed2

Re: Mod Help/Resources

Postby Killzone » 11 Apr 2017, 02:38

Thanks man. That ID page is incredibly helpful. Do you know of something similar that explains what some of the functions do? For example, what exactly do the Categories do? Things like 'EXPERIMENTAL' or 'ARTILLERY'. Some are obvious, like 'LAND' and 'MOBILE', but some seem like they should be obvious, but aren't. Like, 'BUILTBYCOMMANDER' sounds like it should allow the unit to be built, but it seems that it requires more than just that category for it to actually be built.

And there are some things under the General function I'm not sure of exactly. There's another Category function and a Classification function. I have no earthly idea what the Classification one does lol

Anyway, thanks again for the help. Learning a games modding "quirks" is always a chore, and with FA being so old, info is rather hard to come by.
Killzone
 
Posts: 7
Joined: 10 Apr 2017, 10:48
Has liked: 0 time
Been liked: 0 time
FAF User Name: Killzone

Re: Mod Help/Resources

Postby speed2 » 11 Apr 2017, 07:43

Most of the categories should be exactly what they seems to be, the unit that is suppose to build it has that specified, for example in Aeon ACU bp:
Code: Select all
BuildableCategory = {
            'BUILTBYCOMMANDER AEON',
            'BUILTBYTIER2COMMANDER AEON',
            'BUILTBYTIER3COMMANDER AEON',
        },

then it's using restrictions for upgrades...

So as long as you have these 2 categories it should be buildable.

For the Class you might want to check this file https://github.com/FAForever/fa/blob/develop/lua/system/class.lua not all files are on git since we didn't modify them all, so for some you will need to go to your game installation.
User avatar
speed2
Contributor
 
Posts: 3189
Joined: 05 Jan 2013, 15:11
Has liked: 636 times
Been liked: 1119 times
FAF User Name: speed2

Re: Mod Help/Resources

Postby nine2 » 11 Apr 2017, 09:49

Yeah that stuff isn't documented anywhere. I always had to look for precedents for what you are trying to do:
- a unit that does it already
- a mod that does it already
- search the vanilla code for it
- search the FAF override code for it

Somewhere I made a list of the available functions... that is handy. Doesnt give you any idea how to use them. So I got windows to searchindex all of the source code and I'd text-search through it. What also helped was to delete everything that wasn't LUA (speeds up search).

Not pretty
nine2
Councillor - Promotion
 
Posts: 2416
Joined: 16 Apr 2013, 10:10
Has liked: 285 times
Been liked: 515 times
FAF User Name: Anihilnine

Re: Mod Help/Resources

Postby Killzone » 11 Apr 2017, 16:26

Thanks. It just sucks having to blindly copy/paste code without really understanding what it does. So far it's been incredibly slow going. I've finally got my unit built, but I've uncovered more issues than I've solved. For whatever reason the build square is stupidly big. I've edited what I thought was the issue (footprint) but that didn't affect it at all. So there's that, then the nuke button doesn't appear on the ui at all, even though the nuke build button does. The "current nukes" count doesn't increase at all (0/3). It stays at 0, which is weird because I set it to start maxed out at 3. What's even stranger is that I've just about copied the code line-for-line with mods that do the same thing and it still won't work :\

Here's the code, if anyone is willing to look through it lol :
Spoiler: show
Code: Select all
UnitBlueprint {
    Air = {
        BankFactor = 0,
        BankForward = false,
        CanFly = true,
        HoverOverAttack = true,
        KLift = 1,
        KLiftDamping = 10,
        KMove = 1,
        KMoveDamping = 10,
        KTurn = 1,
        KTurnDamping = 10,
        LiftFactor = 10,
        MaxAirspeed = 6,
        StartTurnDistance = 50,
    },
    Audio = {
        AirUnitWaterImpact = Sound {
            Bank = 'Explosions',
            Cue = 'Expl_Water_Lrg_01',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        AmbientMove = Sound {
            Bank = 'XEA',
            Cue = 'XEA0002_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',
        },
        StartMove = Sound {
            Bank = 'XEA',
            Cue = 'XEA0002_Move_Start',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        StopMove = Sound {
            Bank = 'XEA',
            Cue = 'XEA0002_Move_Stop',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        Thruster = Sound {
            Bank = 'XEA',
            Cue = 'XEA0002_Move_Thruster',
            LodCutoff = 'UnitMove_LodCutoff',
        },
        UISelection = Sound {
            Bank = 'Interface',
            Cue = 'UEF_Select_Air',
            LodCutoff = 'UnitMove_LodCutoff',
        },
    },
    Buffs = {
        Regen = {
            Level1 = 10,
            Level2 = 20,
            Level3 = 30,
            Level4 = 40,
            Level5 = 50,
        },
    },
    BuildIconSortPriority = 110,
    Categories = {
        'PRODUCTSC1',
        'SELECTABLE',
        'UNTARGETABLE',
        'BUILTBYTIER3COMMANDER',
        'BUILTBYTIER3ENGINEER',
        'UEF',
        'MOBILE',
        'AIR',
        'HIGHALTAIR',
        'STRATEGIC',
        'NUKE',
        'SILO',
        'EXPERIMENTAL',
        'NEEDMOBILEBUILD',
        'VISIBLETORECON',
        'RECLAIMABLE',
        'DRAGBUILD',
        'SHOWATTACKRETICLE',
        'OVERLAYRADAR',
        'OVERLAYSONAR',
        'OVERLAYMISC',
        'SORTSTRATEGIC',
    },
    CollisionOffsetY = -0.65,
    Defense = {
        AirThreatLevel = 0,
        ArmorType = 'Normal',
        EconomyThreatLevel = 0,
        Health = 100,
        MaxHealth = 100,
        RegenRate = 0,
        SubThreatLevel = 0,
        SurfaceThreatLevel = 0,
    },
    Description = '<LOC mac0001_desc>Experimental Satelite',
    Display = {
        Mesh = {
            IconFadeInZoom = 130,
            LODs = {
                {
                    LODCutoff = 500,
                    ShaderName = 'AeonCZAR',
                },
                {
                    LODCutoff = 1500,
                    ShaderName = 'Aeon',
                },
            },
        },
        PlaceholderMeshName = 'UXB0000',
        SpawnRandomRotation = true,
        UniformScale = 0.05,
    },
    Economy = {
        BuildCostEnergy = 1,
        BuildCostMass = 1,
        BuildRate = 1,
        BuildTime = 1,
    },
    Footprint = {
        MaxSlope = 0.25,
        SizeX = 1,
        SizeZ = 1,
    },
    General = {
        Category = 'Strategic',
        Classification = 'RULEUC_Weapon',
        CommandCaps = {
            RULEUCC_Attack = true,
            RULEUCC_CallTransport = false,
            RULEUCC_Capture = false,
            RULEUCC_Guard = true,
            RULEUCC_Move = true,
            RULEUCC_Nuke = false,
            RULEUCC_Patrol = true,
            RULEUCC_Pause = true,
            RULEUCC_Reclaim = false,
            RULEUCC_Repair = false,
            RULEUCC_RetaliateToggle = true,
            RULEUCC_SiloBuildNuke = true,
            RULEUCC_Stop = true,
            RULEUCC_Transport = false,
        },
        FactionName = 'Uef',
        Icon = 'air',
        SelectionPriority = 5,
        TechLevel = 'RULEUTL_Secret',
        UnitName = '<LOC MAC0001_name>Orbital MAC',
        UnitWeight = 1,
    },
    Intel = {
        RadarRadius = 30,
        SonarRadius = 30,
        VisionRadius = 20,
    },
    Interface = {
        HelpText = '<LOC MAC0001_help>Experimental Satellite',
    },
    LifeBarHeight = 0.075,
    LifeBarOffset = 1.2,
    LifeBarSize = 2,
    Physics = {
        BankingSlope = 0,
        BuildOnLayerCaps = {
            LAYER_Air = false,
            LAYER_Land = true,
            LAYER_Orbit = false,
            LAYER_Seabed = false,
            LAYER_Sub = false,
            LAYER_Water = false,
        },
        Elevation = 75,
        FuelRechargeRate = 150,
        FuelUseTime = 0,
        MaxAcceleration = 1,
        MaxSpeed = 10,
        MaxSteerForce = 100,
        MeshExtentsX = 5.75,
        MeshExtentsY = 4.5,
        MeshExtentsZ = 8,
        MinSpeedPercent = 0.85,
        MotionType = 'RULEUMT_Air',
        SkirtOffsetX = -1.5,
        SkirtOffsetZ = -1.5,
        SkirtSizeX = 10,
        SkirtSizeZ = 10,
        TurnRadius = 100,
        TurnRate = 20,
    },
    SelectionSizeX = 2,
    SelectionSizeZ = 0.8,
    SelectionThickness = 0.36,
    SizeX = 2,
    SizeY = 2,
    SizeZ = 2,
    StrategicIconName = 'icon_experimental_generic',
    StrategicIconSortPriority = 55,
    Veteran = {
        Level1 = 40,
        Level2 = 80,
        Level3 = 120,
        Level4 = 160,
        Level5 = 200,
    },
    Weapon = {
        {
            AboveWaterTargetsOnly = true,
            Audio = {
                Fire = Sound {
                    Bank = 'URLWeapon',
                    Cue = 'URB2305_Missile_Cruise',
                    LodCutoff = 'Weapon_LodCutoff',
                },
            },
            BallisticArc = 'RULEUBA_None',
            CollideFriendly = false,
            CountedProjectile = true,
            Damage = 0,
            DamageFriendly = true,
            DamageType = 'Normal',
            DisplayName = 'Nuclear Warhead',
            FireTargetLayerCapsTable = {
               Air = 'Land|Water|Seabed',
                Land = 'Land|Water|Seabed',
                Seabed = 'Land|Water|Seabed',
                Sub = 'Land|Water|Seabed',
                Water = 'Land|Water|Seabed',
            },
            FiringTolerance = 1,
            ForceSingleFire = true,
            InitialProjectileStorage = 3,
            Label = 'NukeMissiles',
            ManualFire = 1,
            MaxProjectileStorage = 3,
            MaxRadius = 3,
            MuzzleChargeDelay = 5,
            MuzzleSalvoDelay = 0,
            MuzzleSalvoSize = 1,
            MuzzleVelocity = 10,
            NukeInnerRingDamage = 70000,
            NukeInnerRingRadius = 10,
            NukeInnerRingTicks = 24,
            NukeInnerRingTotalTime = 0,
            NukeOuterRingDamage = 0,
            NukeOuterRingRadius = 10,
            NukeOuterRingTicks = 20,
            NukeOuterRingTotalTime = 0,
            NukeWeapon = true,
            ProjectileId = '/projectiles/TIFMissileNuke01/TIFMissileNuke01_proj.bp',
            ProjectilesPerOnFire = 1,
            RackBones = {
                {
                    MuzzleBones = {
                        'Turret_Muzzle',
                    },
                    RackBone = 'Turret_Barrel',
                },
            },
            RackFireTogether = false,
            RackRecoilDistance = 0,
            RackReloadTimeout = 10,
            RackSalvoChargeTime = 3,
            RackSalvoReloadTime = 3,
            RackSalvoSize = 1,
            RackSlavedToTurret = false,
            RangeCategory = 'UWRC_DirectFire',
            RateOfFire = 1,
            SlavedToBody = true,
            SlavedToBodyArcRange = 5,
            TargetCheckInterval = 0.5,
            TargetRestrictDisallow = 'UNTARGETABLE',
            TurretBoneMuzzle = 'Turret_Muzzle',
            TurretBonePitch = 'Turret_Muzzle',
            TurretBoneYaw = 'Turret_Muzzle',
            TurretDualManipulators = false,
            TurretPitch = 0,
            TurretPitchRange = 180,
            TurretPitchSpeed = 360,
            TurretYaw = 0,
            TurretYawRange = 180,
            TurretYawSpeed = 360,
            Turreted = true,
            WeaponCategory = 'Indirect Fire',
            WeaponRepackTimeout = 10,
            WeaponUnpacks = false,
        },
        {
            AboveWaterTargetsOnly = true,
            Damage = 3000,
            DamageFriendly = true,
            DamageRadius = 2,
            DamageType = 'Normal',
            DisplayName = 'Air Crash',
            DummyWeapon = true,
            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,
        },
    },
}
Killzone
 
Posts: 7
Joined: 10 Apr 2017, 10:48
Has liked: 0 time
Been liked: 0 time
FAF User Name: Killzone

Re: Mod Help/Resources

Postby Resin_Smoker » 11 Apr 2017, 17:14

Look at values that state SIZE, MESH, X-Y-Z.... some are for selection via mouse, others its hit-box and yet others its the build boundaries. Most of this is easy to figure out if you do direct comparisons between similar units and look for the differences. Also be aware that there are console commands to directly alter some values on the fly. Afterwards just respawn a unit to see the changes effect.
Resin_Smoker
Evaluator
 
Posts: 858
Joined: 14 Mar 2012, 17:58
Has liked: 54 times
Been liked: 106 times

Re: Mod Help/Resources

Postby Resin_Smoker » 12 Apr 2017, 01:14

Code: Select all
    Footprint = {
        MaxSlope = 0.25,
        SizeX = 1,
        SizeZ = 1,
    },


Footprint is the "required" o-grid area a unit needs to be built, this can be different then the units actual size / hitbox. Keep in mind that there are "standard" footprint sizes already defined. Choosing one footprint over another can add effects as predefined by the games lua script. (Yes this can be modded too)

Code: Select all
    Physics = {
        BankingSlope = 0,
        BuildOnLayerCaps = {
            LAYER_Air = false,
            LAYER_Land = true,
            LAYER_Orbit = false,
            LAYER_Seabed = false,
            LAYER_Sub = false,
            LAYER_Water = false,
        },
        Elevation = 75,
        FuelRechargeRate = 150,
        FuelUseTime = 0,
        MaxAcceleration = 1,
        MaxSpeed = 10,
        MaxSteerForce = 100,
        MeshExtentsX = 5.75,
        MeshExtentsY = 4.5,
        MeshExtentsZ = 8,
        MinSpeedPercent = 0.85,
        MotionType = 'RULEUMT_Air',
        SkirtOffsetX = -1.5,
        SkirtOffsetZ = -1.5,
        SkirtSizeX = 10,
        SkirtSizeZ = 10,
        TurnRadius = 100,
        TurnRate = 20,
    },


BuildOnLayerCaps = which layer the unit can be built on (water / air / land ect.)

Elevation = how high above the ground the unit will be while in play. Your setting of 75 means that whatever is built is basically floating in the air, despite being built on the ground. (this isn't flying, just stuck in space) Normally this is used to offset a unit above the ground when it is uneven to prevent clipping issues. Typically small values are used to fine to the appearance of a unit or to give the illusion that a unit is hovering.

MeshExtentsX/Y/Z = the boundaries of the unit in question (x,y,z). Be aware this isn't the units Hitbox but rather just defining the mesh area. Beyond that, I'm not aware of this having an ingame purpose. It's possible that a script can be written to use the Mesh size and unit scaling to auto setup hitboxes / selection-size ect. However this all assumes that custom meshes all use the same "scale" when developing their models.

SkirtOffsetX/Y = The offset of the decal from the meshes center bone of the unit in question.

SkirtSizeX/Y/Z = the decal size that's placed under a unit, if any. (buildings have this)

SelectionSizeX/Y = The area above a unit that a mouse cursor must be over for the selection reticle to be shown.

SelectionThickness = Thickness of the selection reticle.

SizeX/Y/Z = Units hitbox. This can be either a Box or a Sphere. Keep in mind that the Sphere has only one value, its radius.

CollisionOffsetX/Y/Z = Offsets a units hitbox, which is normally centered over it's main mesh bone.

CollisionShape = Sphere / Box shape for hitbox. Changing a units scaling requires that its hitbox / selection box be rescaled as well.

Note: Unit hitboxes can be set and manipulated via scripts or via console commands for testing.

Killzone, can you provide pic's of the unit in game so i can advise?

Resin
Resin_Smoker
Evaluator
 
Posts: 858
Joined: 14 Mar 2012, 17:58
Has liked: 54 times
Been liked: 106 times

Re: Mod Help/Resources

Postby Resin_Smoker » 12 Apr 2017, 01:28

Code: Select all
        CommandCaps = {
            RULEUCC_Attack = true,
            RULEUCC_CallTransport = false,
            RULEUCC_Capture = false,
            RULEUCC_Guard = true,
            RULEUCC_Move = true,
            RULEUCC_Nuke = false,
            RULEUCC_Patrol = true,
            RULEUCC_Pause = true,
            RULEUCC_Reclaim = false,
            RULEUCC_Repair = false,
            RULEUCC_RetaliateToggle = true,
            RULEUCC_SiloBuildNuke = true,
            RULEUCC_Stop = true,
            RULEUCC_Transport = false,
        },



Try " RULEUCC_Nuke = true, "

This should add the nuke button to the units UI.

As it's a manual fire weapon the below could be set to false...
" RULEUCC_Attack = false, "
Resin_Smoker
Evaluator
 
Posts: 858
Joined: 14 Mar 2012, 17:58
Has liked: 54 times
Been liked: 106 times

Re: Mod Help/Resources

Postby Resin_Smoker » 12 Apr 2017, 01:31

BTW... by having this unit setup as BuildOnLayerCaps, LAYER_Land = true,

Its possible that a land unit could target and fire on your satellite. Better to use Layer Air or Orbit and then make the satellite non-targetable. Oh and dont forget that land units may have to path around a ground units that's technically held up in the air...

Edit: Second though "Land" should work so long as the unit script says it's an Air Unit, it will behave like one. Just make sure you dont mix air / land unit properties otherwise you'll see some really strange things in game. Case in point, I set a fighter elevation to 1 and made it really fast. This produced the effect where the fighter would impact the ground, bouncing off the dirt every time the elevation changed.
Resin_Smoker
Evaluator
 
Posts: 858
Joined: 14 Mar 2012, 17:58
Has liked: 54 times
Been liked: 106 times

Next

Return to Mods & Tools

Who is online

Users browsing this forum: No registered users and 1 guest