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

My buildable script

broken avatar :(
Created 5 years ago
by shinged
0 Members and 1 Guest are viewing this topic.
11,445 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 17 February 2014
Last active: 6 months ago
Posts
69
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
What is broken can be reforged
Signature
Completed maps:
Kingdom Hearts - World at War Link
Minecraft - Black ops 3 Link

WIP:
~

×
shinged's Groups
Hey guys, i decided to try to script my first script in black ops 3 and started with a buildable script. I'm sure this script could be improved greatly and  would love for someone to critique my code. Heres the script itself ( i copied the knuckle crack from the pack-a-punch script ).

[spoiler]

#define PAP_WEAPON_KNUCKLE_CRACK "zombie_knuckle_crack"


function buildableinit()
{
// raygun_model = GetEnt("c_raygun", "targetname");
// raygun_model hide();

buildTable = getEnt("c_table", "targetname");
buildTable SetHintString("Missing parts");
buildTable SetCursorHint("HINT_NOICON");

level.allParts = 0;
level.finishedCraft = 3;

level thread pick1();
level thread pick2();
level thread pick3();

//level thread build();
}

function pick1()
{
pick_trig1 = getent("c_pick1", "targetname");
pick_trig1 SetHintString("Press and hold &&1 to pickup part");
pick_trig1 SetCursorHint("HINT_NOICON");
pick_model1 = getent("c_pickmodel1", "targetname");

while(1)
{
pick_trig1 waittill("trigger", player);

playfx(level._effect["powerup_grabbed"] ,GetEnt("c_pick1","targetname").origin);

level.allParts++;

//IPrintLnBold(level.allParts);

thread build();

break;
}

pick_trig1 delete();
pick_model1 delete();
}

function pick2()
{
pick_trig2 = getent("c_pick2", "targetname");
pick_trig2 SetHintString("Press and hold &&1 to pickup part");
pick_trig2 SetCursorHint("HINT_NOICON");
pick_model2 = getent("c_pickmodel2", "targetname");

while(1)
{
pick_trig2 waittill("trigger", player);

playfx(level._effect["powerup_grabbed"] ,GetEnt("c_pick2","targetname").origin);

level.allParts++;

//IPrintLnBold(level.allParts);

thread build();

break;
}

pick_trig2 delete();
pick_model2 delete();
}


function pick3()
{
pick_trig3 = getent("c_pick3", "targetname");
pick_trig3 SetHintString("Press and hold &&1 to pickup part");
pick_trig3 SetCursorHint("HINT_NOICON");
pick_model3 = getent("c_pickmodel3", "targetname");

while(1)
{
pick_trig3 waittill("trigger", player);

playfx(level._effect["powerup_grabbed"] ,GetEnt("c_pick3","targetname").origin);

level.allParts++;

//IPrintLnBold(level.allParts);

thread build();

break;
}

pick_trig3 delete();
pick_model3 delete();
}


function build()
{

while(1)
{
self waittill( level.allParts >= level.finishedCraft );

if ( level.allParts >= level.finishedCraft )
{
buildTable = GetEnt("c_table", "targetname");
buildTable SetHintString("Press and hold &&1 to craft");
buildTable SetCursorHint("HINT_NOICON");
buildTable waittill("trigger", player);

buildTable SetHintString("");

playfx(level._effect["powerup_grabbed"] ,GetEnt("c_table","targetname").origin);

player thread do_knuckle_crack();

wait(2.7);

buildTable SetHintString("^0Press and hold &&1 for ^2Raygun");
buildTable SetCursorHint("HINT_NOICON");

// raygun_model = GetEnt("c_raygun", "targetname");
// raygun_model show();

buildTable waittill("trigger", player);

weapon = getweapon("ray_gun");
    player giveweapon(weapon);
    player switchtoweapon(weapon); 

    // raygun_model = GetEnt("c_raygun", "targetname");
// raygun_model hide();

buildTable delete();
}
break;
}
}

function private do_knuckle_crack()
{
self endon("disconnect");
self upgrade_knuckle_crack_begin();

self util::waittill_any( "fake_death", "death", "player_downed", "weapon_change_complete" );

self upgrade_knuckle_crack_end();

}


// Switch to the knuckles
//
function private upgrade_knuckle_crack_begin()
{
self zm_utility::increment_is_drinking();

self zm_utility::disable_player_move_states(true);

primaries = self GetWeaponsListPrimaries();

original_weapon = self GetCurrentWeapon();
weapon = GetWeapon( PAP_WEAPON_KNUCKLE_CRACK );



self GiveWeapon( weapon );
self SwitchToWeapon( weapon );
}

// Anim has ended, now switch back to something
//
function private upgrade_knuckle_crack_end()
{
self zm_utility::enable_player_move_states();

weapon = GetWeapon( PAP_WEAPON_KNUCKLE_CRACK );

// TODO: race condition?
if ( self laststand::player_is_in_laststand() || IS_TRUE( self.intermission ) )
{
self TakeWeapon(weapon);
return;
}

self zm_utility::decrement_is_drinking();

self TakeWeapon(weapon);
primaries = self GetWeaponsListPrimaries();
if( IS_DRINKING(self.is_drinking) )
{
return;
}
else
{
self zm_weapons::switch_back_primary_weapon();
}
}
[/spoiler]

Here is a video of the script

Not sure if the script is worth copying if you wanna use the script go ahead and just credit me, thanks


Double Post Merge: October 02, 2016, 02:57:13 pm
i cant edit my post, but can a mod or someone delete everything with "raygun_model" from my code. Or comment it out because it was something i tried that didn't work but forgot to take it out, thanks
Last Edit: October 02, 2016, 06:47:30 pm by HitmanVere
broken avatar :(
×
broken avatar :(
Location: fi
Date Registered: 25 June 2013
Last active: 3 days ago
Posts
3,998
Respect
1,009Add +1
Forum Rank
Eviscerator
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
×
HitmanVere's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
i cant edit my post, but can a mod or someone delete everything with "raygun_model" from my code. Or comment it out because it was something i tried that didn't work but forgot to take it out, thanks

Done
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 17 February 2014
Last active: 6 months ago
Posts
69
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
What is broken can be reforged
×
shinged's Groups
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 12 September 2016
Last active: 10 months ago
Posts
306
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
×
reckfullies's Groups
reckfullies's Contact & Social LinksReckfulliesReckfullies
If you don't mind me asking, how did you get playfx to work? I was trying to use it for one of my custom traps and for some reason I couldn't get it to play any fx.

Double Post Merge: October 02, 2016, 11:29:13 pm
Also you get this error when trying to compile:  Compiler Internal Error :  Unresolved external 'util::waittill_any'

Double Post Merge: October 02, 2016, 11:32:42 pm
Just make sure you tell people what scripts to include into this script so it works.
Last Edit: October 02, 2016, 11:32:42 pm by reckfullies
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 17 February 2014
Last active: 6 months ago
Posts
69
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
What is broken can be reforged
×
shinged's Groups
If you don't mind me asking, how did you get playfx to work? I was trying to use it for one of my custom traps and for some reason I couldn't get it to play any fx.

Double Post Merge: October 02, 2016, 11:29:13 pm
Also you get this error when trying to compile:  Compiler Internal Error :  Unresolved external 'util::waittill_any'

Double Post Merge: October 02, 2016, 11:32:42 pm
Just make sure you tell people what scripts to include into this script so it works.


i scripted this in my mapname gsc so it would be easier to thread, im not sure which ones are required :(.

#using scripts\zm\_zm_utility;
#using scripts\shared\util_shared;
#insert scripts\zm\_zm_utility.gsh;

// these might be required for pap knuckle crack
#using scripts\zm\_zm_pack_a_punch;
#using scripts\zm\_zm_pack_a_punch_util;

please let me know if you get more errors, i cant believe i forgot to include which scripts i used
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 17 February 2014
Last active: 6 months ago
Posts
69
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
What is broken can be reforged
×
shinged's Groups
If you don't mind me asking, how did you get playfx to work? I was trying to use it for one of my custom traps and for some reason I couldn't get it to play any fx.

Double Post Merge: October 02, 2016, 11:29:13 pm
Also you get this error when trying to compile:  Compiler Internal Error :  Unresolved external 'util::waittill_any'

Double Post Merge: October 02, 2016, 11:32:42 pm
Just make sure you tell people what scripts to include into this script so it works.

oh and i assume i got playfx to work because i scripted it inside my mapname gsc and i had all the scripts pretty much available to me
broken avatar :(
  • M0ul3_G4m3r
  • Deleted Member
×
broken avatar :(
M0ul3_G4m3r
User
Date Registered: N/A
Last active: N/A
Posts
N/A
Respect
Primary Group
Deleted Member
×
M0ul3_G4m3r's Groups
M0ul3_G4m3r's Contact & Social Links
Hello !
How I can add this in my custom map please ?  :D
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 17 February 2014
Last active: 6 months ago
Posts
69
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
What is broken can be reforged
×
shinged's Groups
Hello !
How I can add this in my custom map please ?  :D

add the script to the bottom of your mapname gsc, and thread it in the main function.
Put this
#define PAP_WEAPON_KNUCKLE_CRACK		"zombie_knuckle_crack"
at the top of your gsc.

then make 4 triggers and 3 models and give them the kvp's i have in the script.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 12 September 2016
Last active: 10 months ago
Posts
306
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
×
reckfullies's Groups
reckfullies's Contact & Social LinksReckfulliesReckfullies

i scripted this in my mapname gsc so it would be easier to thread, im not sure which ones are required :(.

#using scripts\zm\_zm_utility;
#using scripts\shared\util_shared;
#insert scripts\zm\_zm_utility.gsh;

// these might be required for pap knuckle crack
#using scripts\zm\_zm_pack_a_punch;
#using scripts\zm\_zm_pack_a_punch_util;

please let me know if you get more errors, i cant believe i forgot to include which scripts i used

I did end up fixing it since I just went into the pack a punch script and found what includes I needed.

Also, in my buildables script I have the knuckle crack sounds included as well, ill give you stuff to add them to yours if you want.
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 19 February 2016
Last active: 5 years ago
Posts
3
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
My Contact & Social Links
More
×
MEGALELZ's Groups
MEGALELZ's Contact & Social LinksMEGALELZMEGALELZMEGALELZMEGALELZlaimmckenzie.com
How do we change what item it builds?

This is dope tho, thanks!
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 18 February 2015
Last active: 3 weeks ago
Posts
63
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
×
Blink-420's Groups
Blink-420's Contact & Social LinksBlink-420
Sorry might be dumb to ask...but I've read the replies and your post and through the script you've posted. I'm not very comfortable with scripting much yet..I'm a little confused on what I'm supposed to do exactly to add this to my map. If you don't mind could you explain with even more detail on how to add it. Thanks in advance! Script looks great! :)
broken avatar :(
×
broken avatar :(
Location: gbUK
Date Registered: 20 September 2016
Last active: 5 years ago
Posts
17
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
ulraz_viper's Groups
ulraz_viper's Contact & Social Links
Could you go more in depth on the models/triggers types and KVPs please?
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 12 September 2016
Last active: 10 months ago
Posts
306
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
×
reckfullies's Groups
reckfullies's Contact & Social LinksReckfulliesReckfullies
How do we change what item it builds?

This is dope tho, thanks!

If you want it to be a different weapon, go into his script and find:
weapon = getweapon("ray_gun"); 

and replace "ray_gun" with one of the weapons from this list(If it is a custom weapon just use whatever name you set that as): Link

However if you want to make it a non-weapon item you would need to script that your self obviously then use what ever way you want to give it to the player.
Last Edit: October 05, 2016, 09:58:12 am by reckfullies
broken avatar :(
  • M0ul3_G4m3r
  • Deleted Member
×
broken avatar :(
M0ul3_G4m3r
User
Date Registered: N/A
Last active: N/A
Posts
N/A
Respect
Primary Group
Deleted Member
×
M0ul3_G4m3r's Groups
M0ul3_G4m3r's Contact & Social Links
I have this error when i want to compile :
Quote
Compiler Internal Error :  Uninitialized local variable 'pap_weapon_knuckle_crack'
broken avatar :(
×
broken avatar :(
Location: gbUK
Date Registered: 20 September 2016
Last active: 5 years ago
Posts
17
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
ulraz_viper's Groups
ulraz_viper's Contact & Social Links
Ive got it working now.. thank you for this.. ive now been able to expand on it and do the things ive wanted.

 
Loading ...