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

How to make a trigger temporarily unavailable after pressing it?

broken avatar :(
Created 5 years ago
by Chadric273
0 Members and 1 Guest are viewing this topic.
1,884 views
broken avatar :(
×
broken avatar :(
Location: Minnesota
Date Registered: 7 July 2012
Last active: 5 months ago
Posts
40
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
Chadric273's Groups
Chadric273's Contact & Social Linkschadric.hjellming
Hey guys! I'm sure this is a simple thing to script, but I am lost as how to do it. How would one script it so that when I press "F" on a trigger, it will temporarily be unavailable to use until the script for that trigger has run? Example:

I press "F" on a trigger and it turns on a trap. While the trap is running I want the trigger to be unavailable and to have it give no indications of being able to press "F" (it will no longer say press F for blah blah, instead it will saying nothing) until the trap has finished running. Once the trap has finished running I then want the trigger to be able to be used again and to say "Press F to use".

I know how to change the hint icon for the trigger, but what I am mostly wondering is how to make the trigger temporarily unavailable. Any help would be much appreciated!
broken avatar :(
×
broken avatar :(
Location: nl
Date Registered: 20 September 2013
Last active: 3 days ago
Posts
645
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
No code is bug free
Signature
My published cod maps:

Subzero
Djinncaves
Enclosed (a.k.a baconcube)
Bayern
Snowblind
Furtrelock

Black Ops Perks: https://www.ugx-mods.com/forum/scripts/55/call-of-duty-world-at-war-black-ops-perks/22180/
×
gympie6's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
gympie6's Contact & Social LinksTheRevenantSkullTeffrieTeffrieGympie5#5971
Hey guys! I'm sure this is a simple thing to script, but I am lost as how to do it. How would one script it so that when I press "F" on a trigger, it will temporarily be unavailable to use until the script for that trigger has run? Example:

I press "F" on a trigger and it turns on a trap. While the trap is running I want the trigger to be unavailable and to have it give no indications of being able to press "F" (it will no longer say press F for blah blah, instead it will saying nothing) until the trap has finished running. Once the trap has finished running I then want the trigger to be able to be used again and to say "Press F to use".

I know how to change the hint icon for the trigger, but what I am mostly wondering is how to make the trigger temporarily unavailable. Any help would be much appreciated!
Use this:
Code Snippet
Plaintext
self disable_trigger();

wait 15; // counter

self enable_trigger();
Last Edit: August 20, 2019, 09:10:59 pm by gympie6
broken avatar :(
×
broken avatar :(
Location: Minnesota
Date Registered: 7 July 2012
Last active: 5 months ago
Posts
40
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
Chadric273's Groups
Chadric273's Contact & Social Linkschadric.hjellming
Use this:
Code Snippet
Plaintext
self disable_trigger();

wait 15; // counter

self enable_trigger();
 Thanks! I really appreciate you helping me out! Just curious, what does"self" exactly do in terms of scripting? I've seen it used before, but I don't fully understand how it works.
broken avatar :(
×
broken avatar :(
Location: nl
Date Registered: 20 September 2013
Last active: 3 days ago
Posts
645
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
No code is bug free
×
gympie6's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
gympie6's Contact & Social LinksTheRevenantSkullTeffrieTeffrieGympie5#5971
Thanks! I really appreciate you helping me out! Just curious, what does"self" exactly do in terms of scripting? I've seen it used before, but I don't fully understand how it works.
The person executing that task.
It could be a player, ai, trigger, model ect..

Cod likes to work with who does what?
Person1 wants to push a button. (player)
Person2 (the trigger) wants to be turned off for 15 seconds.
Person3 likes to walk a path.(ai)

You can also see "self" as "this" but "this" is the owner of the class and "self" is the owner of the method.
 "self" is the person running the method like for example a boss in a restaurant.

I see this is a bo3 question instead of waw, maybe it's just the same or it has another function name. I think you will find something similar in the perk script.
Last Edit: August 21, 2019, 05:08:01 am by gympie6
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 1 year ago
Posts
1,187
Respect
1,404Add +1
Forum Rank
Zombie Colossus
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
Signature
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntstuffy@BluntZombieBluntStuffyStuffyZombie
It's the same as WaW, self is the variable that call's or thread's that funtion:
For example

Code Snippet
Plaintext
init()
{
level start_mission();
}

start_mission()
{
self thread episode_1(); // in this case 'self' is the level variable, that called it in the previous function
}
or
Code Snippet
Plaintext
trigger_start()
{
trig = getent( "door_trigger", "targetname" );

trig waittill( "trigger", player );

player thread open_door();
}

open_door()
{
self iprintln( "you have opened a secret door!" ); // now 'self' is the player from the previous funtion, again 'the one' that called this function
}
broken avatar :(
×
broken avatar :(
Location: nl
Date Registered: 20 September 2013
Last active: 3 days ago
Posts
645
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
No code is bug free
×
gympie6's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
gympie6's Contact & Social LinksTheRevenantSkullTeffrieTeffrieGympie5#5971
The person "Level" in this case is a static person. You can call him in every script and use his properties to do things.
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 1 year ago
Posts
1,187
Respect
1,404Add +1
Forum Rank
Zombie Colossus
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntstuffy@BluntZombieBluntStuffyStuffyZombie
That's true, but the point is that 'self' can be anything, it's simply the variable/entity that called that function
broken avatar :(
×
broken avatar :(
Location: Minnesota
Date Registered: 7 July 2012
Last active: 5 months ago
Posts
40
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
Chadric273's Groups
Chadric273's Contact & Social Linkschadric.hjellming
That's true, but the point is that 'self' can be anything, it's simply the variable/entity that called that function
 Hey guys! Really appreciate you guys clarifying that for me. It makes a lot more sense now. If you don’t mine me bothering you with one more question, when is it best to use “level”, “player”, or just threading the next function without anything in front of “thread blah blah blah”?
broken avatar :(
×
broken avatar :(
Location: nl
Date Registered: 20 September 2013
Last active: 3 days ago
Posts
645
Respect
Forum Rank
Zombie Enslaver
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
No code is bug free
×
gympie6's Groups
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
gympie6's Contact & Social LinksTheRevenantSkullTeffrieTeffrieGympie5#5971
Hey guys! Really appreciate you guys clarifying that for me. It makes a lot more sense now. If you don’t mine me bothering you with one more question, when is it best to use “level”, “player”, or just threading the next function without anything in front of “thread blah blah blah”?
It's best to start first with "self" in all the methods but sometimes you need extra hands to make the job done.

If it goes about the player you need to get the player.
In cod waw you can do this:
Code Snippet
Plaintext
players = getplayers();
Maybe you want to check if the player has a certain perk:
Code Snippet
Plaintext
if (players[0] hasperk("specialty_armorvest"))
For all the players:
Code Snippet
Plaintext
for (i = 0; i < players.size; i++)
{
     if (players[i] hasperk("specialty_armorvest"))
     {
        // do stuff
     }
}
Or you want to write functions for the player activating the trigger:
Code Snippet
Plaintext
waittill("trigger", player);
Because of the "waittill" function the game will wait at that point until it's triggered.
But sometimes you want to do other things while waiting and that's where the "thread" comes in.
You should see it as a road way that splits into two directions.
Normally you can only take one of the paths so you have to ask a friend to walk the other path.
That's what a thread does. (I am not sure you are known to this so that's the reason I explain this)

The "level" is a great static global database (don't have a better name for this currently) that can be used in every script.
The problem is that if you change a property somewhere it will be changed in every script where you call "level".
I think you already see the point.

I use "level" to update the scoreboard for example all the points, deaths, kills revives ect.
I used it last time to let all the zombies know that the solo player is in last stand mode.
It show results that the zombies go to a point I marked with a struct on the map.

See "level" as a webpage you want to share with anyone.
If you change the styling and save it then everyone can see the changes.
Last Edit: August 24, 2019, 11:24:57 pm by gympie6

 
Loading ...