UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

[User Tutorial] JR's Easy Buildables

broken avatar :(
Created 10 years ago
by JR-Imagine
0 Members and 1 Guest are viewing this topic.
4,713 views
broken avatar :(
×
broken avatar :(
Location: be
Date Registered: 17 August 2013
Last active: 2 years ago
Posts
369
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
Web & Software Developer and Designer
Signature
"Deleted code is debugged code." - Jeff Sickel
"Mathematicians stand on each others' shoulders and computer scientists stand on each others' toes." - Richard Hamming
×
JR-Imagine's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
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.

This tutorial also assumes you're using treminaor's hintstring "fix", if you're not then I'd recommend using this: http://ugx-mods.com/wiki/index.php?title=Hintstrings_not_updating

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:
Code Snippet
Plaintext
maps\jr_buildables::PrecacheBuildables();
AFTER _zombiemode::main(); add this:
Code Snippet
Plaintext
maps\jr_buildables::main();

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:
Code Snippet
Plaintext
self thread maps\jr_buildables::drop_current_part();
After:
Code Snippet
Plaintext
setClientSysState("lsm", "0", self);



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
broken avatar :(
×
broken avatar :(
Location: gbManchester
Date Registered: 15 March 2014
Last active: 4 years ago
Posts
120
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
ด้้้้้็็็็็้้้้้็็็็็้้้้้้้้็็็็็้้้้้็็็็็้้้้้้
Signature
▒█▀▀▀█ █▀▀ █▀▀ ░▀░ █▀▀ ░▀░ █▀▀█ █░░ ▀▀█▀▀ ▒█▀▀▀█ ▒█▀▀█
▒█░░▒█ █▀▀ █▀▀ ▀█▀ █░░ ▀█▀ █▄▄█ █░░ ░▒█░░ ░▀▀▀▄▄ ▒█░▄▄
▒█▄▄▄█ ▀░░ ▀░░ ▀▀▀ ▀▀▀ ▀▀▀ ▀░░▀ ▀▀▀ ░▒█░░ ▒█▄▄▄█ ▒█▄▄█
×
Official_TSG_'s Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Gunna do this now!! Thanks so much!
broken avatar :(
×
broken avatar :(
Location: be
Date Registered: 17 August 2013
Last active: 2 years ago
Posts
369
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
Web & Software Developer and Designer
×
JR-Imagine's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
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".
broken avatar :(
  • rdv
  • Deleted Member
×
broken avatar :(
rdv
This user is deleted :(
There is a "bug" in your script.

In your do_knuckle_crack():

Replace
Code Snippet
Plaintext
gun = self GetCurrentWeapon();
self GiveWeapon( "zombie_knuckle_crack" );
self SwitchToWeapon( "zombie_knuckle_crack" );
self waittill_any( "fake_death", "death", "player_downed", "weapon_change_complete", "buildable_complete" );

self EnableOffhandWeapons();
self EnableWeaponCycling();
self GiveWeapon( gun );
self SwitchToWeapon( gun );

With this

Code Snippet
Plaintext
gun = self GetCurrentWeapon();
self GiveWeapon( "zombie_knuckle_crack" );
self SwitchToWeapon( "zombie_knuckle_crack" );
self waittill_any( "fake_death", "death", "player_downed", "weapon_change_complete", "buildable_complete" );

self EnableOffhandWeapons();
self EnableWeaponCycling();
self TakeWeapon( "zombie_knuckle_crack" );
self SwitchToWeapon( gun );

Because else you would get full ammo everytime u try to add a part.
broken avatar :(
×
broken avatar :(
Location: be
Date Registered: 17 August 2013
Last active: 2 years ago
Posts
369
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
Web & Software Developer and Designer
×
JR-Imagine's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
There is a "bug" in your script.
Must've looked over this when copying it from my old buildables script which was absolute shit. :poker: Thanks for letting me know, replaced attachment in the OP with the fix.

 
Loading ...