"Deleted code is debugged code." - Jeff Sickel "Mathematicians stand on each others' shoulders and computer scientists stand on each others' toes." - Richard Hamming
I've decided to share the buildables script I made for Rise V2, it's probably the most accurate to BO2's buildables (Tranzit style) you can get from any site atm.
I do expect you have some scripting experience to follow this tutorial, I did not give a example of what to put in the buildables_bench_item() function but it's quite self explanatory.
1. Radiant 1.1. Setting up spawn locations for the parts This is quite easy to do, all you need to do is make a script_origin with a targetname of "buildable_location". Make sure you have atleast the amount of script_origins as you have parts.
Spoiler: click to open...
1.2. Adding a buildables bench Again, not hard to do, make your workbench and make a script_origin with a targetname of your choice.
Spoiler: click to open...
Also make sure you clip that workbench, I hid the clips in the screenshot but they're there.
2. Scripting 2.1. Calling the scripts Extract the gsc file from the zip attached to this post into mods/MAPNAME/maps. Open MAPNAME.gsc and BEFORE _zombiemode::main(); add this: AFTER _zombiemode::main(); add this:
2.2. Precaching parts Open jr_buildables.gsc and find the PrecacheBuildables() function, there's 2 example lines there, change "XMODEL_NAME_HERE" into whatever the name of the xmodel is you want to use for your part, just copy the line and change the string for every xmodel required. Change "MATERIAL_NAME_OF_PART_SHADER" into whatever the name of the material is you want to use as a shader, just copy the line and change the string for every material required.
2.3. Adding a part Find the buildables_parts_init() function, there's an example line there, change "XMODEL_NAME_HERE" to whatever the name of the xmodel is you want to use for your part. Change "STRING_USED_TO_STORE_PART_NAME_VARIABLE" to a string of your choice, it's used to store the name of the part for the workbench script. Change "MATERIAL_NAME_OF_PART_SHADER" to whatever the name of the material is you want to use for this part.
Find the drop_current_part() function and do the same thing you did in buildables_parts_init(). For every new part, copy the example case and change the strings to those used by the new part.
2.4. Adding a workbench Find the buildables_benches_init() function and change "TARGETNAME_SET_IN_RADIANT_FOR_WORKBENCH" to the targetname you gave to the script_origin for the workbench in Radiant. Change the "WORKBENCH_VARIABLE" part of the two instances of "level.WORKBENCH_VARIABLE" to whatever you want to use as a variable for your workbench. Change all 3 instances of "STRING_USED_TO_STORE_PART_NAME_VARIABLE" to the strings you gave to the parts for this specific workbench in the buildables_parts_init() function.
If you have sounds to use for your workbench, uncomment all instances of PlaySound(...); in the buildables_bench() function and change the soundaliases to whatever the ones are you use.
2.5. Make your workbench actually do something This is where you're gonna require some scripting experience, find the buildables_bench_item() function and put your scripts in there. I'm not going to explain how to use it, there's 2 arguments passed to this function you will need to use but they're pretty self explanatory.
2.6. Dropping parts on death If you don't have _laststand.gsc in root/mods/mapname/maps yet, then copy it there from root/raw/maps. Open it up and look for the function laststand_bleedout( delay ), add this line: After:
If you decide to use this, don't forget to credit me, I worked hard on this script to make it as easy to use as possible and I think I did a good job with that.
Last Edit: October 26, 2014, 09:34:28 am by JR-Imagine
After all this time I finally realised I forgot to add dropping parts on death... Updated tutorial. Also added a note saying you need trem's hintstring "fix".
Must've looked over this when copying it from my old buildables script which was absolute shit. Thanks for letting me know, replaced attachment in the OP with the fix.