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

[Tutorial] Shootable Triggers

HOT
broken avatar :(
Created 8 years ago
by reckfullies
0 Members and 2 Guests are viewing this topic.
43,291 views
broken avatar :(
×
broken avatar :(
Location: gbbradford
Date Registered: 26 September 2014
Last active: 7 years ago
Posts
5
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
harvez's Groups
harvez's Contact & Social Links
I get this error now, I updated my script to the new one and added the electric cherry part?

^1}
^1^
^1ERR(6E) scripts/custom/shootable.gsc (28,1)  : Compiler Internal Error :  Uninitialized local variable 'player'
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 19 August 2015
Last active: 6 years ago
Posts
2
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
×
r0bst3r's Groups
r0bst3r's Contact & Social Links
Hi anyone know the code to play a song when all triggers are shot? ;)
broken avatar :(
×
broken avatar :(
Location: au
Date Registered: 9 October 2016
Last active: 5 years ago
Posts
53
Respect
Forum Rank
Rotting Walker
Primary Group
Donator ♥
My Groups
More
×
kaizokuroof's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
kaizokuroof's Contact & Social Links
Super cool. Thanks for sharing/taking the time to fix it.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 12 September 2016
Last active: 3 years 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 get this error now, I updated my script to the new one and added the electric cherry part?

^1}
^1^
^1ERR(6E) scripts/custom/shootable.gsc (28,1)  : Compiler Internal Error :  Uninitialized local variable 'player'

This is because there is no player variable defined.
Change the entire script to this:
Code Snippet
Plaintext
function init()
{
level.shootablesNeeded = 2;
level.shootablesCollected = 0;

level thread shootable_1();
level thread shootable_2();
}

function shootable_1()
{
    trig_1 = GetEnt("shootable_trig", "targetname");
model_1 = GetEnt("shootable_model", "targetname");

trig_1 SetHintString("");
trig_1 SetCursorHint("HINT_NOICON");

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

level.shootablesCollected++;

IPrintLn("Trigger 1 Shot"); // Not Needed

thread shootables_done(player);

break;
}

trig_1 Delete();
model_1 Delete();
}

function shootable_2()
{
trig_2 = GetEnt("shootable_trig_2", "targetname");
model_2 = GetEnt("shootable_model_2", "targetname");

trig_2 SetHintString("");
trig_2 SetCursorHint("HINT_NOICON");

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

level.shootablesCollected++;

IPrintLn("Trigger 2 Shot"); // Not Needed

thread shootables_done(player);

break;
}

trig_2 Delete();
model_2 Delete();
}

function shootables_done(player)
{
while(1)
{
self waittill(level.shootablesCollected >= level.shootablesNeeded);

if(level.shootablesCollected == level.shootablesNeeded)
{
// What ever code you want to execute once all shootables are collected
IPrintLn("All Shootables Collected");
}

break;
}
}
Last Edit: October 11, 2016, 01:55:14 am by reckfullies
broken avatar :(
×
broken avatar :(
Location: de-
Date Registered: 18 August 2013
Last active: 5 years ago
Posts
70
Respect
Forum Rank
Rotting Walker
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
A lot of HD texture for WaW
×
TheKillerey's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
TheKillerey's Contact & Social LinksTheKillerey
This is the fully code if you want to get "Electric Cherry" :)

Code Snippet
Plaintext
#using scripts\zm\_zm_perks;
#insert scripts\zm\_zm_perks.gsh;

function init()
{
level.shootablesNeeded = 3;
level.shootablesCollected = 0;

level thread shootable_1();
level thread shootable_2();
level thread shootable_3();
}

function shootable_1()
{
    trig_1 = GetEnt("shootable_trig", "targetname");
model_1 = GetEnt("shootable_model", "targetname");

trig_1 SetHintString("");
trig_1 SetCursorHint("HINT_NOICON");

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

level.shootablesCollected++;

IPrintLn("Trigger 1 Shot"); // Not Needed

thread shootables_done(player);

break;
}

trig_1 Delete();
model_1 Delete();
}

function shootable_2()
{
trig_2 = GetEnt("shootable_trig_2", "targetname");
model_2 = GetEnt("shootable_model_2", "targetname");

trig_2 SetHintString("");
trig_2 SetCursorHint("HINT_NOICON");

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

level.shootablesCollected++;

IPrintLn("Trigger 2 Shot"); // Not Needed

thread shootables_done(player);

break;
}

trig_2 Delete();
model_2 Delete();
}

function shootable_3()
{
trig_3 = GetEnt("shootable_trig_3", "targetname");
model_3 = GetEnt("shootable_model_3", "targetname");

trig_3 SetHintString("");
trig_3 SetCursorHint("HINT_NOICON");

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

level.shootablesCollected++;

IPrintLn("Trigger 3 Shot"); // Not Needed

thread shootables_done(player);

break;
}

trig_3 Delete();
model_3 Delete();
}

function shootables_done(player)
{
while(1)
{
self waittill(level.shootablesCollected >= level.shootablesNeeded);

if(level.shootablesCollected == level.shootablesNeeded)
{
// What ever code you want to execute once all shootables are collected
IPrintLn("All Shootables Collected");
player zm_perks::give_perk( PERK_ELECTRIC_CHERRY, false );
}

break;
}
}

Tested and it works fine ;)

This is for 3 triggers :)
Last Edit: October 11, 2016, 12:37:16 pm by TheKillerey
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 12 September 2016
Last active: 3 years ago
Posts
306
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
×
reckfullies's Groups
reckfullies's Contact & Social LinksReckfulliesReckfullies
This is the fully code if you want to get "Electric Cherry" :)

Code Snippet
Plaintext
#using scripts\zm\_zm_perks;
#insert scripts\zm\_zm_perks.gsh;

function init()
{
level.shootablesNeeded = 3;
level.shootablesCollected = 0;

level thread shootable_1();
level thread shootable_2();
level thread shootable_3();
}

function shootable_1()
{
    trig_1 = GetEnt("shootable_trig", "targetname");
model_1 = GetEnt("shootable_model", "targetname");

trig_1 SetHintString("");
trig_1 SetCursorHint("HINT_NOICON");

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

level.shootablesCollected++;

IPrintLn("Trigger 1 Shot"); // Not Needed

thread shootables_done(player);

break;
}

trig_1 Delete();
model_1 Delete();
}

function shootable_2()
{
trig_2 = GetEnt("shootable_trig_2", "targetname");
model_2 = GetEnt("shootable_model_2", "targetname");

trig_2 SetHintString("");
trig_2 SetCursorHint("HINT_NOICON");

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

level.shootablesCollected++;

IPrintLn("Trigger 2 Shot"); // Not Needed

thread shootables_done(player);

break;
}

trig_2 Delete();
model_2 Delete();
}

function shootable_3()
{
trig_3 = GetEnt("shootable_trig_3", "targetname");
model_3 = GetEnt("shootable_model_3", "targetname");

trig_3 SetHintString("");
trig_3 SetCursorHint("HINT_NOICON");

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

level.shootablesCollected++;

IPrintLn("Trigger 3 Shot"); // Not Needed

thread shootables_done(player);

break;
}

trig_3 Delete();
model_3 Delete();
}

function shootables_done(player)
{
while(1)
{
self waittill(level.shootablesCollected >= level.shootablesNeeded);

if(level.shootablesCollected == level.shootablesNeeded)
{
// What ever code you want to execute once all shootables are collected
IPrintLn("All Shootables Collected");
player zm_perks::give_perk( PERK_ELECTRIC_CHERRY, false );
}

break;
}
}

Tested and it works fine ;)

This is for 3 triggers :)

Thanks for sharing your script with anyone who might not know how to do this, if anyone wants to change the perk all names are located in _zm_perks.gsh
broken avatar :(
×
broken avatar :(
Location: de-
Date Registered: 18 August 2013
Last active: 5 years ago
Posts
70
Respect
Forum Rank
Rotting Walker
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
A lot of HD texture for WaW
×
TheKillerey's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
TheKillerey's Contact & Social LinksTheKillerey
Thanks for sharing your script with anyone who might not know how to do this, if anyone wants to change the perk all names are located in _zm_perks.gsh
No Problem :)
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 18 February 2015
Last active: 1 month 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
This is the fully code if you want to get "Electric Cherry" :)

Code Snippet
Plaintext
#using scripts\zm\_zm_perks;
#insert scripts\zm\_zm_perks.gsh;

function init()
{
level.shootablesNeeded = 3;
level.shootablesCollected = 0;

level thread shootable_1();
level thread shootable_2();
level thread shootable_3();
}

function shootable_1()
{
    trig_1 = GetEnt("shootable_trig", "targetname");
model_1 = GetEnt("shootable_model", "targetname");

trig_1 SetHintString("");
trig_1 SetCursorHint("HINT_NOICON");

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

level.shootablesCollected++;

IPrintLn("Trigger 1 Shot"); // Not Needed

thread shootables_done(player);

break;
}

trig_1 Delete();
model_1 Delete();
}

function shootable_2()
{
trig_2 = GetEnt("shootable_trig_2", "targetname");
model_2 = GetEnt("shootable_model_2", "targetname");

trig_2 SetHintString("");
trig_2 SetCursorHint("HINT_NOICON");

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

level.shootablesCollected++;

IPrintLn("Trigger 2 Shot"); // Not Needed

thread shootables_done(player);

break;
}

trig_2 Delete();
model_2 Delete();
}

function shootable_3()
{
trig_3 = GetEnt("shootable_trig_3", "targetname");
model_3 = GetEnt("shootable_model_3", "targetname");

trig_3 SetHintString("");
trig_3 SetCursorHint("HINT_NOICON");

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

level.shootablesCollected++;

IPrintLn("Trigger 3 Shot"); // Not Needed

thread shootables_done(player);

break;
}

trig_3 Delete();
model_3 Delete();
}

function shootables_done(player)
{
while(1)
{
self waittill(level.shootablesCollected >= level.shootablesNeeded);

if(level.shootablesCollected == level.shootablesNeeded)
{
// What ever code you want to execute once all shootables are collected
IPrintLn("All Shootables Collected");
player zm_perks::give_perk( PERK_ELECTRIC_CHERRY, false );
}

break;
}
}

Tested and it works fine ;)

This is for 3 triggers :)

I get no errors compiling map and it works but the game doesn't give me electric cherry once i shoot all three bottles just the on screen messages
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 12 September 2016
Last active: 3 years 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 get no errors compiling map and it works but the game doesn't give me electric cherry once i shoot all three bottles just the on screen messages

Make sure you actually have the perks enabled on your map. By default electric cherry and widows wine are not enabled.

To add them go into root/usermaps/zm_mapname/scripts/zm/zm_mapname.gsc and add this to the top of the file:
Code Snippet
Plaintext
#using scripts\zm\_zm_perk_widows_wine;
#using scripts\zm\_zm_perk_electric_cherry;

Do the same thing inside root/usermaps/zm_mapname/scripts/zm/zm_mapname.csc
Last Edit: October 12, 2016, 03:15:11 am by reckfullies
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 19 June 2016
Last active: 7 years ago
Posts
2
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
×
jrderuki's Groups
jrderuki's Contact & Social Links
I get this error it looks like a path error anyone know what I did wrong?  :poker:
^1ERR(83) scripts/zm/zm_hard.gsc (12,32)  : Compiler Internal Error :  Compile error processing "using" file - file not found : scripts/custom/shootable.gsc

EDIT: Nevermind got it fixed and working :)
Last Edit: October 12, 2016, 09:08:16 am by Lukkie1998
broken avatar :(
×
broken avatar :(
Location: ca
Date Registered: 1 August 2016
Last active: 7 years ago
Posts
7
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
Gondor's Groups
Gondor's Contact & Social Links
I want to give the zombie shield weapon instead of a perk how do you do that?
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 12 September 2016
Last active: 3 years 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 want to give the zombie shield weapon instead of a perk how do you do that?

*Note - Make sure you are using the script that TheKillerey made above since it has access to the player variable*



Replace player zm_perks::give_perk( PERK_ELECTRIC_CHERRY, false ); with this:
Code Snippet
Plaintext
weapon = GetWeapon("zod_riotshield");
player GiveWeapon(weapon);

I'm not sure if this is the right way to do it since it acts as a equipment not a weapon but it should work since it is in the weapons table. Please let me know if anything doesn't work and Ill figure out the right way.
broken avatar :(
×
broken avatar :(
Location: ca
Date Registered: 1 August 2016
Last active: 7 years ago
Posts
7
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
Gondor's Groups
Gondor's Contact & Social Links
it works with raygun but not zombie shield probably because its a equipment
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 12 September 2016
Last active: 3 years ago
Posts
306
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
×
reckfullies's Groups
reckfullies's Contact & Social LinksReckfulliesReckfullies
it works with raygun but not zombie shield probably because its a equipment

You could try this.

Add this to your includes:
Code Snippet
Plaintext
#using scripts/zm/_zm_equipment;

then add this inside shootable_done under IPrintLn:
Code Snippet
Plaintext
equipment = GetWeapon("zod_riotshield");
player zm_equipment::give(equipment);

This should work, if it doesn't you or someone else will need to figure it out since I can't find another way inside the equipment file.
broken avatar :(
×
broken avatar :(
Location: ca
Date Registered: 1 August 2016
Last active: 7 years ago
Posts
7
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
Gondor's Groups
Gondor's Contact & Social Links
Thanks man that worked ill give you some credit in my map description once its updated!

Double Post Merge: October 15, 2016, 12:30:44 am
The script works but after testing it on multiplayer it gives the shield to only 1 player and not all players. Is theirs a way to script it to all players or all 4?

Double Post Merge: October 15, 2016, 12:31:42 am
holly fuck i was baked when I wrote that
Last Edit: October 15, 2016, 12:31:42 am by Gondor

 
Loading ...