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

Need help with this buildable script

broken avatar :(
Created 9 years ago
by tobin_g1213
0 Members and 1 Guest are viewing this topic.
4,020 views
broken avatar :(
×
broken avatar :(
Location: usbristol ri
Date Registered: 7 May 2015
Last active: 3 years ago
Posts
22
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
tobin_g1213's Groups
tobin_g1213's Contact & Social Links
I wanted to start scripting to make my maps more customized, and then I tryed out ZKs tut on a buildable power switch.
http://custom-zombies.com/Forums/index.php?topic=224.0 this is his tut. if anyone can look at it that know scripts really well can go over it to see if its even correct. I tryed it on a map i was working on for ever and messed it up then tryed it on a test map and still didnt seem to work. Any help would be appreciated.


Code Snippet
Plaintext
/******************************************************
// Buildable Power switch script
//******************************************************
#include common_scripts\utility;
#include maps\_utility;
#include maps\_zombiemode_utility;
#include maps\_anim;

//////////////////////////////////
//Credits
//////////////////////////////////
/*
ZK: This script
Don Goony: knuckle_crack()
~ Add yourself here
*/
//////////////////////////////////

main()
{
PrecacheShader( "buildable_panel_shader" );
PrecacheShader( "buildable_handle_shader" );
PrecacheShader( "buildable_wire_shader" );

level.power_build = 0;

power_switch_trig = getEnt("turn_power_on", "targetname");
power_switch_trig disable_trigger();

thread lets_build();
}

lets_build()
{
flag_wait("all_players_connected");

players = get_players();
for(i=0;i<players.size;i++)
{
players[i].part_hud = [];
}

//the panel
panel_pick = getEnt("panel_pick", "targetname"); //panel that you pick up
panel_pick_trig = getEnt("panel_pick_trig", "targetname"); //trigger to pick up panel

panel_build = getEnt("panel_build", "targetname"); //the panel that appears when built
panel_build_trig = getEnt("panel_build_trig", "targetname"); //trigger to build panel

//the handle
handle_pick = getEnt("handle_pick", "targetname"); //handle that you pick up
handle_pick_trig = getEnt("handle_pick_trig", "targetname"); //trigger to pick up handle

handle_build = getEnt("handle_build", "targetname"); //the handle that appears when built
handle_build_trig = getEnt("handle_build_trig", "targetname"); //trigger to build handle

//the wire
wire_pick = getEnt("wire_pick", "targetname"); //wire that you pick up
wire_pick_trig = getEnt("wire_pick_trig", "targetname"); //trigger to pick up wire

wire_build = getEnt("wire_build", "targetname"); //the wire that appears when built
wire_build_trig = getEnt("wire_build_trig", "targetname"); //trigger to build wire


//part 1
thread build_part(panel_pick, panel_pick_trig, panel_build, panel_build_trig, "buildable_panel_shader");

//part 2
thread build_part(handle_pick, handle_pick_trig, handle_build, handle_build_trig, "buildable_handle_shader");

//part 3
thread build_part(wire_pick, wire_pick_trig, wire_build, wire_build_trig, "buildable_wire_shader");
}

power_ready() //this is what runs when you add all the parts
{
power_switch_trig = getEnt("turn_power_on", "targetname");
power_switch = getEnt("handle_build", "targetname");

power_switch_trig enable_trigger();

power_switch_trig SetCursorHint( "HINT_NOICON" );
power_switch_trig UseTriggerRequireLookAt();
power_switch_trig setHintString("Press and hold &&1 to turn on power");

power_switch_trig waittill("trigger");
power_switch_trig delete();
power_switch MoveZ (-9, .5);
flag_set("electricity_on");
level notify("Pack_A_Punch_on");
level notify("sleight_on");
level notify("revive_on");
level notify("juggernog_on");
level notify("doubletap_on");
}

build_part(part, part_trig, place_part, place_part_trig, shader)
{
da_guy = undefined;

place_part hide();
        place_part_trig UseTriggerRequireLookAt();
        place_part_trig SetCursorHint( "HINT_NOICON" );
place_part_trig setHintString("Parts required");

part_trig UseTriggerRequireLookAt();
part_trig SetCursorHint( "HINT_NOICON" );
part_trig setHintString("Press &&1 to pick up part");

part_trig waittill("trigger", da_guy);
part_trig delete();
part delete();

hud = create_simple_hud( da_guy );
hud.foreground = true;
hud.sort = 1;
hud.hidewheninmenu = false;
hud.alignX = "middle";
hud.alignY = "bottom";
hud.horzAlign = "middle";
hud.vertAlign = "bottom";
hud.x = da_guy.part_hud.size * 45;
hud.y = hud.y - 80;
hud.alpha = 1;
hud SetShader( shader, 40, 40 );
da_guy.part_hud[ shader ] = hud;

place_part_trig enable_trigger();
place_part_trig sethintstring("Press &&1 to add part");
place_part_trig setvisibletoplayer(da_guy);

for(;;)
{
place_part_trig waittill("trigger", da_guy);

if( !isDefined(da_guy.is_adding_part) )
{
da_guy.is_adding_part = true;
place_part_trig delete();
da_guy thread crack_knuckles();

da_guy waittill("part_added");

hud destroy_hud();

place_part show();

level.power_build = level.power_build + 1;

if(level.power_build == 3)
{
thread power_ready();
}
wait 1.5;
da_guy.is_adding_part = undefined;
break;
}
wait .5;
}
}

crack_knuckles()
{
self DisableOffhandWeapons();
self DisableWeaponCycling();

self AllowLean( false );
self AllowAds( false );
self AllowSprint( false );
self AllowProne( false );
self AllowMelee( false );

if ( self GetStance() == "prone" )
{
self SetStance( "crouch" );
}

primaries = self GetWeaponsListPrimaries();

gun = self GetCurrentWeapon();
ammo = self GetWeaponAmmoStock( gun );
weapon = "zombie_knuckle_crack";
self GiveWeapon( weapon );
self SwitchToWeapon( weapon );
self waittill_any( "fake_death", "death", "player_downed", "weapon_change_complete" );
self EnableOffhandWeapons();
self EnableWeaponCycling();
self GiveWeapon( gun );
self SetWeaponAmmoStock( gun, ammo );
self SwitchToWeapon( gun );
self AllowLean( true );
self AllowAds( true );
self AllowSprint( true );
self AllowProne( true );
self AllowMelee( true );
self notify("part_added");
return gun;
}
}


maps\_buildables::main()

ps took screen shots but couldnt figure out to add then lol
Last Edit: July 31, 2015, 05:31:07 pm by thezombiekilla6
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 22 September 2014
Last active: 4 years ago
Posts
360
Respect
Forum Rank
Perk Hacker
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
Here to make epic maps
×
pcmodder's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
pcmodder's Contact & Social Linkspcmodderugxken5hir0
These work perfectly.

http://ugx-mods.com/forum/index.php/topic,7771.0.html

Harrry Bo21s craftable power and PAP.
broken avatar :(
×
broken avatar :(
Location: usbristol ri
Date Registered: 7 May 2015
Last active: 3 years ago
Posts
22
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
tobin_g1213's Groups
tobin_g1213's Contact & Social Links
Thank u
broken avatar :(
×
broken avatar :(
Location: usNUKETOWN
Date Registered: 19 February 2014
Last active: 7 years ago
Posts
177
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
Zombie Specialist
Signature
×
thezombieproject's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Oil Rig Beta Access
Oil Rig Beta Access
Well my opinion i never really liked the way this power buildable worked. Yes the script works ok but it doesnt use the real power switch if i remember correctly. You have to add a second power switch and not only that not many notice but pack a punch fx dont work after power is on. i will post a fix  for this shortly so your using real power switch / script.
broken avatar :(
×
broken avatar :(
Location: usbristol ri
Date Registered: 7 May 2015
Last active: 3 years ago
Posts
22
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
tobin_g1213's Groups
tobin_g1213's Contact & Social Links
oh ok
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
ZK's scripts aren't bad for starting out, but there are smarter, more dynamic ways to do things like this build-able. Anytime you see yourself repeating the same things, "except this", meaning like one thing is different, it can be done much better. And also, a good bit of scripting can be improved, by using radiant smarter. When to use auto#'s and prefabs and things like that will help you make better scripts. So take what you learn from this but don't take it as the only way to do it, or even the best way to do it.

You'll find that the main thing with power is the power trigger. The power trigger is handled in dlc3_code.gsc. It gets an ent and waits for it to be triggered. This means the kvp "use_power_switch" can only be in the map as a targetname on an ent once, since getent is used, not getentarray and then a function thread on each. If you had multiple triggers with that kvp, you would get an error, in this case, which would pass as true and allow the power to come on immediately.

So besides writing a script that sets shaders, and picks up parts and sets down parts, and checks when players die or are downed, this is the basic way power is handled. When it is triggered, it then calls power_electric_switch_on() which turns everything with flags and notifications.

There are plenty of scripts out there that handle the rest, and simply adding a level waittill("yournotification"); before the trig waittill("trigger", user); and then adding a level notify("yournotification"); after the item is built, will be one of the easiest ways of handling that. You could also hide or disable the trigger before and enable or show the trigger after it is built if you like.

Good luck.
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 4 years ago
Posts
6,877
Respect
1,004Add +1
Forum Rank
Immortal
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Signature
If you want scripts / features made for you, then contact me by PM or email / skype etc
it will cost you tho so if you have no intention of reciprocating don't even waste my time ;)
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social Links[email protected]HarryBo21HarryBo000
ZK's scripts aren't bad for starting out, but there are smarter, more dynamic ways to do things like this build-able. Anytime you see yourself repeating the same things, "except this", meaning like one thing is different, it can be done much better. And also, a good bit of scripting can be improved, by using radiant smarter. When to use auto#'s and prefabs and things like that will help you make better scripts. So take what you learn from this but don't take it as the only way to do it, or even the best way to do it.

You'll find that the main thing with power is the power trigger. The power trigger is handled in dlc3_code.gsc. It gets an ent and waits for it to be triggered. This means the kvp "use_power_switch" can only be in the map as a targetname on an ent once, since getent is used, not getentarray and then a function thread on each. If you had multiple triggers with that kvp, you would get an error, in this case, which would pass as true and allow the power to come on immediately.

So besides writing a script that sets shaders, and picks up parts and sets down parts, and checks when players die or are downed, this is the basic way power is handled. When it is triggered, it then calls power_electric_switch_on() which turns everything with flags and notifications.

There are plenty of scripts out there that handle the rest, and simply adding a level waittill("yournotification"); before the trig waittill("trigger", user); and then adding a level notify("yournotification"); after the item is built, will be one of the easiest ways of handling that. You could also hide or disable the trigger before and enable or show the trigger after it is built if you like.

Good luck.

theres a example of this in my craftables script

Uses the regular power switch, disables the trigger, hides the models, and waits for you to build it

once its done just re-enables the trigger, from then on its just the normal old power switch
broken avatar :(
×
broken avatar :(
Location: usbristol ri
Date Registered: 7 May 2015
Last active: 3 years ago
Posts
22
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
tobin_g1213's Groups
tobin_g1213's Contact & Social Links
i've just been pretty much trying to write my own scripts it's tough though because I have to find out what I need to put in the Scripts  it's not hard using the calls and functions in Notepad plus plus at all just learning what in call of duty I need to call I guess thank you for replying both of you
Marked as best answer by tobin_g1213 9 years ago
broken avatar :(
×
broken avatar :(
Location: usNUKETOWN
Date Registered: 19 February 2014
Last active: 7 years ago
Posts
177
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
Zombie Specialist
×
thezombieproject's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Oil Rig Beta Access
Oil Rig Beta Access

Some Quick Changes I Made....
1. using proper power switch. You dont need a hidden dummy switch on map anymore!
now power fx, pap fx, and proper sounds work.
2. moved shader placement to top left away from perk shaders.
3. added build fx (green poof) When parts added
4. Removed power_ready(); function not needed anymore!
5. made a prefab of switch and parts (download above) stamp it in radiant and move parts where ever!



make sure u have dlc3_code.gsc in mods/maps
next open dlc3_code.gsc and comment out these lines they can be found near lines 125
it should look like this when finished..

Code Snippet
Plaintext
        // if( isDefined( level.DLC3.useElectricSwitch ) && level.DLC3.useElectricSwitch )
// {
// level thread power_electric_switch();
// }
// else
// {
// level thread power_electric_switch_on();
// }
here is a pic just incase!! when done save and close dlc3_code.gsc
https://gyazo.com/afc274f90936d174a6b96fe5abc70d59

NEXT

open your buildable script and replace everything with this...

Code Snippet
Plaintext
#include common_scripts\utility; 
#include maps\_utility;
#include maps\_zombiemode_utility;
#include maps\_anim;
// ****Credits*****
/*
######################################################################################
TheZombieProject:
Now using real switch. Added power / build fx!
I Removed power_ready() function
so now once all parts are added. I  *thread maps\dlc3_code::power_electric_switch();*
######################################################################################
ZK: buildable script
Don Goony: knuckle_crack()
######################################################################################
*/

main(){
PrecacheShader( "buildable_panel_shader" ); // name of shader materials
PrecacheShader( "buildable_handle_shader" );
PrecacheShader( "buildable_wire_shader" );
PrecacheItem( "zombie_knuckle_crack" ); // - TZP -
    thread build();
}

build(){
flag_wait("all_players_connected");

level.power_build = 0; // moved here // - TZP
level.power_total_parts = 3; // total parts // - TZP

players = get_players();
for(i=0;i<players.size;i++){
players[i].part_hud = [];
}
// ########### PARTS 1 - 3
// part 1
panel_pick = getEnt("panel_pick", "targetname"); // PANEL PICK UP MODEL
panel_pick_trig = getEnt("panel_pick_trig", "targetname"); // PANEL PICK UP TRIGGER
panel_build = getEnt("panel_build", "targetname"); // PANEL BUILD MODEL
panel_build_trig = getEnt("panel_build_trig", "targetname"); // PANEL BUILD TRIGGER
// part 2
handle_pick = getEnt("handle_pick", "targetname"); // HANDLE PICK UP MODEL
handle_pick_trig = getEnt("handle_pick_trig", "targetname"); // HANDLE PICK UP TRIGGER
handle_build = getEnt("power_switch", "targetname"); // HANDLE BUILD MODEL
handle_build_trig = getEnt("handle_build_trig", "targetname"); // HANDLE BUILD TRIGGER
// part 3
pick_up_cord = getEnt("pick_up_cord", "targetname"); // WIRE PICK UP MODEL
pick_up_cord_trig = getEnt("pick_up_cord_trig", "targetname"); // WIRE PICK UP TRIGGER
place_cord = getEnt("place_cord", "targetname"); // WIRE BUILD MODEL
place_cord_trig = getEnt("place_cord_trig", "targetname"); // WIRE BUILD TRIGGER
// part 1
thread build_part(panel_pick, panel_pick_trig, panel_build, panel_build_trig, "buildable_panel_shader");
// part 2
thread build_part(handle_pick, handle_pick_trig, handle_build, handle_build_trig, "buildable_handle_shader");
// part 3
thread build_part(pick_up_cord, pick_up_cord_trig, place_cord, place_cord_trig, "buildable_wire_shader");

}

build_part(part, part_trig, place_part, place_part_trig, shader){

da_guy = undefined;
trig = getent("use_power_switch","targetname"); // - TZP
trig sethintstring("POWER PARTS NEEDED!"); // ADDED HINT FOR POWER FEEL FREE TO DISABLE! // - TZP
place_part hide();
        place_part_trig UseTriggerRequireLookAt();
        place_part_trig SetCursorHint( "HINT_NOICON" );
place_part_trig setHintString("Parts required");
part_trig UseTriggerRequireLookAt();
part_trig SetCursorHint( "HINT_NOICON" );
part_trig setHintString("Press &&1 to pick up part");
part_trig waittill("trigger", da_guy);
part_trig delete();
part delete();
hud = create_simple_hud( da_guy );
hud.foreground = true;
hud.sort = 1;
hud.hidewheninmenu = false;
hud.alignX = "SUBLEFT"; // i moved shaders to top left so it's not close to perk ones --- tzp
hud.alignY = "top";
hud.horzAlign = "SUBLEFT";
hud.vertAlign = "top";
hud.x = da_guy.part_hud.size * 45;
hud.y = 10;
hud.alpha = 1;
hud SetShader( shader, 40, 40 );
da_guy.part_hud[ shader ] = hud;
place_part_trig enable_trigger();
place_part_trig sethintstring("Press &&1 to add part");
place_part_trig setvisibletoplayer(da_guy);

for(;;){
place_part_trig waittill("trigger", da_guy);
   
if( !isDefined(da_guy.is_adding_part) ){
da_guy.is_adding_part = true;
place_part_trig delete();
da_guy thread crack_knuckles();

da_guy waittill("part_added");

hud destroy_hud();
// MAKE (ADDPART) FX PLAY ON POWER STRUCT  - TZP
playfx(level._effect["powerup_grabbed"] ,getstruct("power_switch_fx","targetname").origin);

place_part show();

level.power_build++; // - TZP
// iPrintLn( "Nice," + level.power_build + " parts added " ); // - TZP
if(level.power_build == level.power_total_parts) // - TZP
{
thread maps\dlc3_code::power_electric_switch(); // - TZP
// iPrintLn( "threading dlc3_code - power ready" ); // - TZP
}
wait 1.5;
da_guy.is_adding_part = undefined;
break;
}
wait .5;
}
}

crack_knuckles()
{
self DisableOffhandWeapons();
self DisableWeaponCycling();
self AllowLean( false );
self AllowAds( false );
self AllowSprint( false );
self AllowProne( false );
self AllowMelee( false );
if ( self GetStance() == "prone" ){
self SetStance( "crouch" );
}
gun = self GetCurrentWeapon();
weapon = "zombie_knuckle_crack";
self GiveWeapon( weapon );
self SwitchToWeapon( weapon );
self waittill_any( "fake_death", "death", "player_downed", "weapon_change_complete" );
self EnableOffhandWeapons();
self EnableWeaponCycling();
self GiveWeapon( gun );
self SwitchToWeapon( gun );
self AllowLean( true );
self AllowAds( true );
self AllowSprint( true );
self AllowProne( true );
self AllowMelee( true );
self notify("part_added");
return gun;
}

NEXT

GO TO RADIANT AND DELETE ALL POWER SWITCHES AND PARTS  THAT YOU CURRENTLY HAVE ON YOUR MAP. Then download prefab i provided and add that power switch to  your map you can stamp the prefab and move parts where ever you want.

next

go to mapname.gsc and look for
Code Snippet
Plaintext
 
        /*--------------------
FUNCTION CALLS - PRE _Load
----------------------*/
level thread DLC3_threadCalls();
under that add the name of your power script heres an example..
Code Snippet
Plaintext
maps\script_name::main();

next add the name of your shader materials to mod.csv
example
material,buildable_wire_shader
material,buildable_panel_shader
material,buildable_handle_shader

next
 check everything in your iwd file list. (Images, script ect)
now full compile and build mod.
Last Edit: August 18, 2015, 04:58:22 pm by thezombieproject
broken avatar :(
×
broken avatar :(
Location: usbristol ri
Date Registered: 7 May 2015
Last active: 3 years ago
Posts
22
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
tobin_g1213's Groups
tobin_g1213's Contact & Social Links
sick man ill try it out i just deleted my waw and mod tools to redownload and have a fresh start
broken avatar :(
×
broken avatar :(
Location: usbristol ri
Date Registered: 7 May 2015
Last active: 3 years ago
Posts
22
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
tobin_g1213's Groups
tobin_g1213's Contact & Social Links
hey man the script works but how can i fix the hit parts still needed because if you go up and press f it turns on the power with out parts
broken avatar :(
×
broken avatar :(
Location: usNUKETOWN
Date Registered: 19 February 2014
Last active: 7 years ago
Posts
177
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
Zombie Specialist
×
thezombieproject's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Oil Rig Beta Access
Oil Rig Beta Access
hey man the script works but how can i fix the hit parts still needed because if you go up and press f it turns on the power with out parts

u have to go in dlc3 code and comment out those lines. if you did that correct theres no way you can turn the power on till all parts are added.   dlc3_code power code doenst get called till all parts are added. Well if u forgot to comment out those lines then the power function gets called at the start of the game and you can flip the switch before you add parts and thats what seems to be the issue.
Anyway i will go and double check everything either way just incase. If you dont get it fixed feel free to message me on steam and ill walk you through it.


also i would like to add make sure u edit the dlc3_code.gsc thats in your mods/maps folder and not the one in raw / maps

Double Post Merge: August 22, 2015, 09:04:08 pm
ok so i  just double checked the tut and everything worked for me
Last Edit: August 22, 2015, 09:17:51 pm by thezombieproject
broken avatar :(
×
broken avatar :(
Location: usbristol ri
Date Registered: 7 May 2015
Last active: 3 years ago
Posts
22
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
tobin_g1213's Groups
tobin_g1213's Contact & Social Links
Whats you steam name
broken avatar :(
×
broken avatar :(
Location: usNUKETOWN
Date Registered: 19 February 2014
Last active: 7 years ago
Posts
177
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
Zombie Specialist
×
thezombieproject's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Oil Rig Beta Access
Oil Rig Beta Access
Whats you steam name

TheZombieProjectCOD

Double Post Merge: August 23, 2015, 04:15:00 pm
try this i just disabled the trigger instead of giving it a hint replace with this one


Code Snippet
Plaintext
#include common_scripts\utility; 
#include maps\_utility;
#include maps\_zombiemode_utility;
#include maps\_anim;
// ****Credits*****
/*
######################################################################################
TheZombieProject:
Now using real switch. Added power / build fx!
I Removed power_ready() function
so now once all parts are added. I  *thread maps\dlc3_code::power_electric_switch();*
######################################################################################
ZK: buildable script
Don Goony: knuckle_crack()
######################################################################################
*/

main(){
PrecacheShader( "buildable_panel_shader" ); // name of shader materials
PrecacheShader( "buildable_handle_shader" );
PrecacheShader( "buildable_wire_shader" );
PrecacheItem( "zombie_knuckle_crack" ); // - TZP -
    thread build();
}

build(){
flag_wait("all_players_connected");

level.power_build = 0; // moved here // - TZP
level.power_total_parts = 3; // total parts // - TZP

players = get_players();
for(i=0;i<players.size;i++){
players[i].part_hud = [];
}
// ########### PARTS 1 - 3
// part 1
panel_pick = getEnt("panel_pick", "targetname"); // PANEL PICK UP MODEL
panel_pick_trig = getEnt("panel_pick_trig", "targetname"); // PANEL PICK UP TRIGGER
panel_build = getEnt("panel_build", "targetname"); // PANEL BUILD MODEL
panel_build_trig = getEnt("panel_build_trig", "targetname"); // PANEL BUILD TRIGGER
// part 2
handle_pick = getEnt("handle_pick", "targetname"); // HANDLE PICK UP MODEL
handle_pick_trig = getEnt("handle_pick_trig", "targetname"); // HANDLE PICK UP TRIGGER
handle_build = getEnt("power_switch", "targetname"); // HANDLE BUILD MODEL
handle_build_trig = getEnt("handle_build_trig", "targetname"); // HANDLE BUILD TRIGGER
// part 3
pick_up_cord = getEnt("pick_up_cord", "targetname"); // WIRE PICK UP MODEL
pick_up_cord_trig = getEnt("pick_up_cord_trig", "targetname"); // WIRE PICK UP TRIGGER
place_cord = getEnt("place_cord", "targetname"); // WIRE BUILD MODEL
place_cord_trig = getEnt("place_cord_trig", "targetname"); // WIRE BUILD TRIGGER
// part 1
thread build_part(panel_pick, panel_pick_trig, panel_build, panel_build_trig, "buildable_panel_shader");
// part 2
thread build_part(handle_pick, handle_pick_trig, handle_build, handle_build_trig, "buildable_handle_shader");
// part 3
thread build_part(pick_up_cord, pick_up_cord_trig, place_cord, place_cord_trig, "buildable_wire_shader");

}

build_part(part, part_trig, place_part, place_part_trig, shader){

da_guy = undefined;
trig = getent("use_power_switch","targetname"); // - TZP
// trig sethintstring("POWER PARTS NEEDED!"); // ADDED HINT FOR POWER FEEL FREE TO DISABLE! // - TZP
trig disable_trigger();
place_part hide();
        place_part_trig UseTriggerRequireLookAt();
        place_part_trig SetCursorHint( "HINT_NOICON" );
place_part_trig setHintString("Parts required");
part_trig UseTriggerRequireLookAt();
part_trig SetCursorHint( "HINT_NOICON" );
part_trig setHintString("Press &&1 to pick up part");
part_trig waittill("trigger", da_guy);
part_trig delete();
part delete();
hud = create_simple_hud( da_guy );
hud.foreground = true;
hud.sort = 1;
hud.hidewheninmenu = false;
hud.alignX = "SUBLEFT"; // i moved shaders to top left so it's not close to perk ones --- tzp
hud.alignY = "top";
hud.horzAlign = "SUBLEFT";
hud.vertAlign = "top";
hud.x = da_guy.part_hud.size * 45;
hud.y = 10;
hud.alpha = 1;
hud SetShader( shader, 40, 40 );
da_guy.part_hud[ shader ] = hud;
place_part_trig enable_trigger();
place_part_trig sethintstring("Press &&1 to add part");
place_part_trig setvisibletoplayer(da_guy);

for(;;){
place_part_trig waittill("trigger", da_guy);
   
if( !isDefined(da_guy.is_adding_part) ){
da_guy.is_adding_part = true;
place_part_trig delete();
da_guy thread crack_knuckles();

da_guy waittill("part_added");

hud destroy_hud();
// MAKE (ADDPART) FX PLAY ON POWER STRUCT  - TZP
playfx(level._effect["powerup_grabbed"] ,getstruct("power_switch_fx","targetname").origin);

place_part show();

level.power_build++; // - TZP
// iPrintLn( "Nice," + level.power_build + " parts added " ); // - TZP
if(level.power_build == level.power_total_parts) // - TZP
{

trig enable_trigger();
thread maps\dlc3_code::power_electric_switch(); // - TZP

// iPrintLn( "threading dlc3_code - power ready" ); // - TZP
}
wait 1.5;
da_guy.is_adding_part = undefined;
break;
}
wait .5;
}
}

crack_knuckles()
{
self DisableOffhandWeapons();
self DisableWeaponCycling();
self AllowLean( false );
self AllowAds( false );
self AllowSprint( false );
self AllowProne( false );
self AllowMelee( false );
if ( self GetStance() == "prone" ){
self SetStance( "crouch" );
}
gun = self GetCurrentWeapon();
weapon = "zombie_knuckle_crack";
self GiveWeapon( weapon );
self SwitchToWeapon( weapon );
self waittill_any( "fake_death", "death", "player_downed", "weapon_change_complete" );
self EnableOffhandWeapons();
self EnableWeaponCycling();
self GiveWeapon( gun );
self SwitchToWeapon( gun );
self AllowLean( true );
self AllowAds( true );
self AllowSprint( true );
self AllowProne( true );
self AllowMelee( true );
self notify("part_added");
return gun;
}
Last Edit: August 23, 2015, 04:16:35 pm by thezombieproject
broken avatar :(
×
broken avatar :(
Location: usbristol ri
Date Registered: 7 May 2015
Last active: 3 years ago
Posts
22
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
tobin_g1213's Groups
tobin_g1213's Contact & Social Links
ok i will i friended u on steam its zombie_annihilator

 
Loading ...