Rating: Rookie to Competent.
Prior knowledge of creating new files in the AE and also squad icon mechanics would be useful, but links are provided to relevant tutorials.
Warning: I wonder whether this tutorial may be too much to take in in one go, or whether some bits are not clear - please inform me if you think any sections need improving (this mainly to applies to new modders, not ones who know this stuff already). Thanks.
In this tutorial we'll be adding some extra weapon choices to units and going through all that kind of stuff.
Go and find the EBPS (entity_blueprint, not the squad file) for our favourite upgrading friends the basic Space Marine (Tactical).The hardpoint info is in "combat_ext". "Woah, woah, woah, what the heck are hardpoints?" - we'll get to that. Open up the hardpoints table and open up hardpoints 01 and 02 (the others are empty on this unit). Then open the weapons table on each and expand weapons 01 - 05 on hardpoint 01 and just weapon 01 on hardpoint 02.
Hardpoint 01 - weapon 01 is the default bolter, weapons 02 - 05 are the upgrades as you may have noticed.
Hardpoint 02 - weapon 01 is the default melee knife.
So, from this we can see that the first weapon on each hardpoint is the default weapon and appears in game automatically. Also we can see that it kind of makes sense that there's only five weapon slots on each hardpoint as there's only room for 4 upgrades on the User Interface ingame, plus the default starting weapon too (and no you can't use the space where the reinforce button goes or the attached hero goes for upgrades! It's hard coded). Also, we can deduce that each hardpoint will only use one weapon at a time, although it can have many choices and a unit can have many hardpoints, as you will see. Hardpoints are points of interchangeable weaponry that are controllable to a limited extent in game.
Go take a look at the predator's hardpoints in its EBPS. It has three hardpoints being used and each one can be upgraded to lascannons (weapon 02 on hardpoints 01, 02 and 03).The baneblade uses a whopping eight hardpoints, although it has no upgrades; each hardpoint only has a default weapon and no more, so no upgrades appear.
Ork Slugga Boyz
Okay, that's enough explaining for now, there's more to come but it's time we got our hands dirty. We're going to mod the Slugga Boyz and give them extra weapons. Go find the EBPS file.
I'll assume you've already dived into the hardpoint info to find that it has a pretty similar setup to the space marines. Most humanoid troopers have two hardpoints like this: one for their ranged weapon and one for their melee. You may notice that the Slugga boy has some weapons sections that are not quite complete - good for us.
Each weapon section has four pieces of information:
muzzle - these are co-ordinates from which the weapons fire their projectiles (you don't generally need to touch these unless you play around with models)
name_for_this_weapon_choice - this a command string that tells the 3D model which weapon to switch to. This command is coded into a separate animation file and could be any string of letters so you must spell this bit right otherwise it won't work.
origin - these are co-ordinates and will make things seem to fire at an offset e.g. they are definitely firing at something that is taking damage, it's just that it's 20 ft over to the left.....(you shouldn't need to change this all this)
weapon - this links the weapon choice to a separate weapon.lua that contains all the stats: range, damage, upgrade cost etc. In original Dawn of War the Slugga boyz had three possible upgrades and these are a remnant of that; all Relic have done to remove them is set the weapon file to empty and left the rest as it was (almost - they infact nudged the burna info up over the big shoota that was originally there). As these were Relic cast-offs they also already have weapon files and icons done for them, which is handy!
In weapon 03 (hardpoint 01) change the name_for_this_weapon_choice to "ork_big_shoota" (you have to type these in). Then for the drop box for weapon pick ork_big_shoota_slugga.lua. For the rokkit launcha in weapon 04 leave the graphics command as that is fine and pick ork_rokkit_launcha_slugga.lua from the weapon file drop box.
Fig.1 - the completed weapon table
Make sure you use these weapons, as the squad icons with coloured borders are setup by Relic for these weapons (explained here).
Now, go to the squad file for the boyz in the SBPS (squad) section and look at the squad_reinforce_ext to check that upgrades are turned on (they will be) and that you are happy with the amount of upgrades they are allowed. Now, go and investigate those weapons file that we've linked. The weapon files are stacked at the bottom of the AE list and are just in one huge big list; race is irrelevant (even though they are named by race), any unit can use any weapon file. ork_burna_slugga, ork_big_shoota_slugga and ork_rokkit_launcha_slugga are the files we want. Each weapon will have a different copy for each unit that uses it so each unit can be changed individually rather than being standardised. You may decide to change that (i.e linking all rokkits on all units to the same rokkit file), but for now I want you to check you're happy with the requirements in the requirement table and check the cost and build time for all of them.
Right, now you're done. Go play with snazzy sluggas!
Imperial Guard Sentinel
Right, well, that was relatively simple, but there's more to it than that. You can't just add extra weapons on whim unless you can do 3D modelling (and even then it's hardly on a whim!) and Object Editing. Those weapons we just added to the sluggas were originally used in Dawn of War original and so had already been modelled onto the slugga and coded into the animations. They have been taken out of the upgrades for gameplay reasons (by simply removing the weapons file from the weapon info) since Winter Assault. The weapons must be specifically modelled and coded onto that model, it doesn't matter if another unit has that weapon, even if it is an ork, that unit's model must contain any weapon you want it to use. You can still upgrade the weapon stats and simply re-use one of the graphical changes eg frag missile launcher or krak missile launchers - both choices could use the same graphics.
That puts a downer on things really. But, luckily for us there are other models in a similar situation, namely the Sentinel, which has 2 unused weapon modelled onto it. Go track down the EBPS and you'l see.
Your mission: get the Sentinel working in game with 2 weapon upgrade choices.
1. Create new weapon files (not sure how? )for the unused weapon this time, as they don't have any pre-made by Relic. I would suggest creating a subtype of the SM heavy flamer and HWT autocannon as these will have all the right kind of information. Remember any unit can use any weapon file.
2. Relic have also already made two icons: "guard_icons/guard_upgrade_sentinel_flamer" and "guard_icons/guard_upgrade_sentinel_multi". Fill in the correct file path into the correct weapons files. The icon link is kept under "icon_name" in the ui_info table near the bottom of the weapon file.
3. As Relic have only made icons for the flamer and laser swap the order of the weapons round so that the starting weapon is the autocannon, and the other two are upgrades as this will cover it up. They should all remain on the same hardpoint though.
4. Check the cost, build time and requirements of these new weapons files. Also change the max_traverse left and right on the autocannon weapon file to -90 and 90 rather than -180 and 180 (remember this is inheriting from the HWT than can spin 360 degrees, we want it to only go 90 either way).
5. Untick "complex_upgrades" on the EBPS in the combat_ext. This will mean that you need to create upgraded squad icons to match which as usual which I've made for you here (Icon tutorial will eventually come as well) - there's a couple of bonuses in there too. Complex upgrades is explained below.
6. Sort the UCS values out for the weapons.
7. Test it and keep you eye out for any mistakes.
- Take a look at the crisis teams hardpoint and weapon info. You'll notice that the extra weapons are spread across two hard points but they can only choose one. This shows us that the engine will pick up extra weapons from all hardpoints (starting from 01) and list the first four that appear regardless of hardpoints (on normal upgrades.
- Each hardpoint has a set of info before the weapon table. Things like ... This is another set of string commands that are going to the animation file and that must be spelt correctly. The number of the hardpoint doesn't mean anything, it's these strings that correctly identify each hardpoint to the 3D model. If you shift a whole hardpoint to somewhere esle be sure to shift this bit too.
- Display requirements have no effect on weapon upgrades: they are all displayed from the start with grey icons regardless. When then can be purchased they will turn full colour.
Now, tick the complex_upgrade box in the combat_ext of your sentinel, save binary and see what happens in game. Weird huh?
With normal upgrades we find the first four upgrades listed; if there's more than four then tough, only four get shown. Normal upgrades only allow each unit to be upgraded once. Complex Upgrade are different. With complex upgrades imagine each hardpoint as a stack of weapons icons, weapon 02 on the top, 05 on the bottom (01 is already in use), viewed from the top so you can only see to the top one (weapon 02 at first). Each hardpoint stack takes up only one upgrade slot ingame, so there's a max of four stacks visible ingame(hardpoints with only a default weapon get ignored). As you click on an upgrade it builds the weapon, disappears and so reveals the one below it. There is no way of skipping weapons, they must be built through in order. The last weapon simply greys out rather than disappearing. Upgrading one of the stacks/weapons doesn't affect the other stacks and you may upgrade all stacks fully regardless of how many upgrades you put in the squad_reinforce_ext.
Because of the many possible weapon combinations of this method the engine disables squad icon changes (the different coloured borders) so you don't need to worry about that. You must still have can_upgrade ticked in squad_reinforce_ext for complex_upgrades to work.
Complex upgrades CANNOT be used on squads with a maximum size bigger than one (mainly it's used for vehicles).
Complex upgrades CANNOT be used on an attachable hero - where will the icons go? (hence why the Tau Commander can't attach)
Both normal and complex upgrades CANNOT be used with multiple squad leaders, but they can both have one leader, although it's a little screwy when used with complex_upgrades.
Some squad leaders have complex_upgrades turned on, some don't (eg Tac Sergs do, Assault Sergs don't - huh?) - neither can upgrade actively (only via researches) and neither option affects the colour of the squad icon.
Heroes mainly have complex_upgrades turned on but with upgrades turned off. It basically stops them changing their squad icon while not being allowed to upgrade in the normal way (researches still can, but this is regardless of upgrade settings). You need this for leaders otherwise plasma pistol upgrades will give you pink icons. However, as mentioned above it must be allowed to upgrade otherwise it can't attach to a squad.
As usual post any errors or bits you want cleared up here thanks.