Octopus Rex
22nd Oct 07, 5:24 PM
Rating: Rookie to Competent
Warning - I won't be going as slow as the AE basics in this.
A common question asked is "how do I add new buildings? I've created a new EBPS for them but I can't get it to show in the build list". Well, here's where I will answer that.
Powers of Observation
The build list is populated by all the buildings in a race's structures folder (yes, all, even the single player ones, you'll see). You don't have to do anything, the build list will populate itself automatically from the structures folder. "But my building still doesn't appear!" - where most people fail with this is simple observation and maths (use your brains please guys! :)). Take space marines for example, they have 11 buildable structures. When you click on the build button those 11 building icons appear, and the 12th slot is filled with the 'back' arrow.
http://mods.octopusrex.co.uk/content/buildings/buildings1.jpg
Fig 1. - a full menu
When you make your new, 12th building there is, of course, no room for it to appear. Where exactly were you expecting it to magic itself to? Somewhere else on the user interface? The reinforcement box? Squeezed inbetween some other build icons? :) Try it with Orks and it'll work out for you as they have a couple of spaces left.
A Problem of Space
So the problem now is one of space. The solution to this is that there is already a second build menu coded, the advanced build menu. Take a look in the structure_buildable_ext on the entity files for the buildings and you will see that there is an 'advanced_build_option' tick box. If that is ticked then the building will not appear in the basic build menu, but it will appear in the advanced build menu. This is where all the single player buildings that you see in the AE have gone, check them, they'll all have the advanced_build_option ticked. Buildings will appear on either the advanced menu or the basic one, but they will not appear on both.
Right, well now we know that there is extra space, we just have to get access to it. To do this we need a file from the archives (go here (http://forums.relicnews.com/showthread.php?t=155067) for how to extract them). Extract DXP2data.sga (you may have done this already for another mod as it's a very useful archive). Inside the extraction open up 'game' folder. There's a file in there called taskbar.lua, copy and paste that file into yourmod/data/game i.e. a replica position within your own mod folder, you'll need to create the game folder yourself. Now open it up with a text editor and we can get working. (More on folder trees here)
The advanced build menu appears as another button next to the normal build one that you click on to bring up a different menu. There's two things you need to change to get this working:
First - there's a command that tells the UI where this button should go. Currently it's commented out and is having no effect, all we need to do is remove the comments for it to kick in. You need to find this line:
-- build_adv = list_commands[6], Best to search for it with CTRL + F as the text document is quite big. Then change that line to:
build_adv = list_commands[9], (Please note that tabs don't work on these forums - the code will appear differently in the lua) All we've done is remove those two dashes at the beginning and changed the number from 6 to 9. The reasons we've changed the number is because that number dictates which slot out of the 12 icon slots it goes in. 6 is actually already taken up with the repair button, so if we want it to be seen we should move it to an empty slot. Slot 9 is empty on all the builders and is next to the normal build button, so that will do nicely.
Second - we need to UNcomment one more line.
--{ bind = "build_structures_menu", hk = "buildadv", ui = commandsmall_buttons.build_adv, texture = "command_icons/build_structure_advanced", submenu = submenu_structures_advanced, tt = tooltip_simple_template, tt_title = "$40910", tt_desc = "$40911" },Simply remove the comments only this time.
{ bind = "build_structures_menu", hk = "buildadv", ui = commandsmall_buttons.build_adv, texture = "command_icons/build_structure_advanced", submenu = submenu_structures_advanced, tt = tooltip_simple_template, tt_title = "$40910", tt_desc = "$40911" },.
Okay, now save it and fire up the game. All your builders will now have that extra build menu with a dull grey icon.
http://mods.octopusrex.co.uk/content/buildings/buildings4.gif
Fig 2. - Yuk!
Open it up and you may see one or two building in there that look familiar, these will be the single player buildings, this is where they have gone (aaaahhh! I see!). So, now you can tick some other building's advanced_build_option in the AE and see how they move across to the new menu (remember you'll need to save binary for this to take effect). We'll sort those random buildings out in a moment.
http://mods.octopusrex.co.uk/content//buildings/buildings2.jpg
Fig 3. - the mythical Tau Turrets ready to be built
Race Specific
AH YES, BUT: - you only need/want the advanced build menu on ONE race right? Not a problem. If we look at some other parts of the taskbar.lua then we see that some bits of code are race specific. This is acheived by using this line
{ bind = "selector_player_race",
}and then listing a race like this:
tau = {
},Any races not listed are dealt with using this coverall stuck at the end
other = {
},The code that you want to apply to a race, i.e. that bit about advanced build menu, goes in between those curly brackets and all of that goes in between the race selector code brackets.
So to make it work for say only Eldar the full code would be:
{ bind = "selector_player_race",
eldar = {
{ bind = "build_structures_menu", hk = "buildadv", ui = commandsmall_buttons.build_adv, texture = "command_icons/build_structure_advanced", submenu = submenu_structures_advanced, tt = tooltip_simple_template, tt_title = "$40910", tt_desc = "$40911" },
},
other = {
},
},If you want it to work for more than one then just list them as well like the eldar (i.e. copy and paste and just change the race name). The race names are the same as those on the EBPS or SBPS folders (attrib/SBSP/races). Save it.
So we still have one problem - unwanted single player buildings that are weird duplicates. Easy to fix, pick one you want to get rid of and simply set all the requirements in the building's requirement_ext to none, then change one requirement to required_structure and choose a structure from another race, then do the same again in a second requirement field, but this time tick the display_requirement box also. EG - set the Tau turret to require the Chaos HQ. This way you will never be able to build it as you will never have a building from another race, and it will never display either for the same reason. Repeat this for any other offending buildings you still have.
If you want to change the tooltips for it then you can just edit them in that long line of code we messed with, there's one for the name and one for the description.
And there you have it really. Here's a little build icon (http://mods.octopusrex.co.uk/content/buildings/snazzy_build_icon.tga) that I whipped up for no real reason. Use it if you like. The location and name for it is contained in the long line of code we UNcommented, I'll leave you to sort that out (icons tutorial here (http://forums.relicnews.com/showthread.php?t=161043) - the icon will go in yourmod/data/art/ui/ingame/command_icons).
http://mods.octopusrex.co.uk/content/buildings/buildings3.jpg
Fig 4. - my little icon, use and abuse people
Thanks to - Compiler for figuring this out long before I even began modding, I only know how to do this through dissecting his work.
Warning - I won't be going as slow as the AE basics in this.
A common question asked is "how do I add new buildings? I've created a new EBPS for them but I can't get it to show in the build list". Well, here's where I will answer that.
Powers of Observation
The build list is populated by all the buildings in a race's structures folder (yes, all, even the single player ones, you'll see). You don't have to do anything, the build list will populate itself automatically from the structures folder. "But my building still doesn't appear!" - where most people fail with this is simple observation and maths (use your brains please guys! :)). Take space marines for example, they have 11 buildable structures. When you click on the build button those 11 building icons appear, and the 12th slot is filled with the 'back' arrow.
http://mods.octopusrex.co.uk/content/buildings/buildings1.jpg
Fig 1. - a full menu
When you make your new, 12th building there is, of course, no room for it to appear. Where exactly were you expecting it to magic itself to? Somewhere else on the user interface? The reinforcement box? Squeezed inbetween some other build icons? :) Try it with Orks and it'll work out for you as they have a couple of spaces left.
A Problem of Space
So the problem now is one of space. The solution to this is that there is already a second build menu coded, the advanced build menu. Take a look in the structure_buildable_ext on the entity files for the buildings and you will see that there is an 'advanced_build_option' tick box. If that is ticked then the building will not appear in the basic build menu, but it will appear in the advanced build menu. This is where all the single player buildings that you see in the AE have gone, check them, they'll all have the advanced_build_option ticked. Buildings will appear on either the advanced menu or the basic one, but they will not appear on both.
Right, well now we know that there is extra space, we just have to get access to it. To do this we need a file from the archives (go here (http://forums.relicnews.com/showthread.php?t=155067) for how to extract them). Extract DXP2data.sga (you may have done this already for another mod as it's a very useful archive). Inside the extraction open up 'game' folder. There's a file in there called taskbar.lua, copy and paste that file into yourmod/data/game i.e. a replica position within your own mod folder, you'll need to create the game folder yourself. Now open it up with a text editor and we can get working. (More on folder trees here)
The advanced build menu appears as another button next to the normal build one that you click on to bring up a different menu. There's two things you need to change to get this working:
First - there's a command that tells the UI where this button should go. Currently it's commented out and is having no effect, all we need to do is remove the comments for it to kick in. You need to find this line:
-- build_adv = list_commands[6], Best to search for it with CTRL + F as the text document is quite big. Then change that line to:
build_adv = list_commands[9], (Please note that tabs don't work on these forums - the code will appear differently in the lua) All we've done is remove those two dashes at the beginning and changed the number from 6 to 9. The reasons we've changed the number is because that number dictates which slot out of the 12 icon slots it goes in. 6 is actually already taken up with the repair button, so if we want it to be seen we should move it to an empty slot. Slot 9 is empty on all the builders and is next to the normal build button, so that will do nicely.
Second - we need to UNcomment one more line.
--{ bind = "build_structures_menu", hk = "buildadv", ui = commandsmall_buttons.build_adv, texture = "command_icons/build_structure_advanced", submenu = submenu_structures_advanced, tt = tooltip_simple_template, tt_title = "$40910", tt_desc = "$40911" },Simply remove the comments only this time.
{ bind = "build_structures_menu", hk = "buildadv", ui = commandsmall_buttons.build_adv, texture = "command_icons/build_structure_advanced", submenu = submenu_structures_advanced, tt = tooltip_simple_template, tt_title = "$40910", tt_desc = "$40911" },.
Okay, now save it and fire up the game. All your builders will now have that extra build menu with a dull grey icon.
http://mods.octopusrex.co.uk/content/buildings/buildings4.gif
Fig 2. - Yuk!
Open it up and you may see one or two building in there that look familiar, these will be the single player buildings, this is where they have gone (aaaahhh! I see!). So, now you can tick some other building's advanced_build_option in the AE and see how they move across to the new menu (remember you'll need to save binary for this to take effect). We'll sort those random buildings out in a moment.
http://mods.octopusrex.co.uk/content//buildings/buildings2.jpg
Fig 3. - the mythical Tau Turrets ready to be built
Race Specific
AH YES, BUT: - you only need/want the advanced build menu on ONE race right? Not a problem. If we look at some other parts of the taskbar.lua then we see that some bits of code are race specific. This is acheived by using this line
{ bind = "selector_player_race",
}and then listing a race like this:
tau = {
},Any races not listed are dealt with using this coverall stuck at the end
other = {
},The code that you want to apply to a race, i.e. that bit about advanced build menu, goes in between those curly brackets and all of that goes in between the race selector code brackets.
So to make it work for say only Eldar the full code would be:
{ bind = "selector_player_race",
eldar = {
{ bind = "build_structures_menu", hk = "buildadv", ui = commandsmall_buttons.build_adv, texture = "command_icons/build_structure_advanced", submenu = submenu_structures_advanced, tt = tooltip_simple_template, tt_title = "$40910", tt_desc = "$40911" },
},
other = {
},
},If you want it to work for more than one then just list them as well like the eldar (i.e. copy and paste and just change the race name). The race names are the same as those on the EBPS or SBPS folders (attrib/SBSP/races). Save it.
So we still have one problem - unwanted single player buildings that are weird duplicates. Easy to fix, pick one you want to get rid of and simply set all the requirements in the building's requirement_ext to none, then change one requirement to required_structure and choose a structure from another race, then do the same again in a second requirement field, but this time tick the display_requirement box also. EG - set the Tau turret to require the Chaos HQ. This way you will never be able to build it as you will never have a building from another race, and it will never display either for the same reason. Repeat this for any other offending buildings you still have.
If you want to change the tooltips for it then you can just edit them in that long line of code we messed with, there's one for the name and one for the description.
And there you have it really. Here's a little build icon (http://mods.octopusrex.co.uk/content/buildings/snazzy_build_icon.tga) that I whipped up for no real reason. Use it if you like. The location and name for it is contained in the long line of code we UNcommented, I'll leave you to sort that out (icons tutorial here (http://forums.relicnews.com/showthread.php?t=161043) - the icon will go in yourmod/data/art/ui/ingame/command_icons).
http://mods.octopusrex.co.uk/content/buildings/buildings3.jpg
Fig 4. - my little icon, use and abuse people
Thanks to - Compiler for figuring this out long before I even began modding, I only know how to do this through dissecting his work.