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

making trigger show text but be usable

broken avatar :(
Created 11 years ago
by buttkicker845
0 Members and 1 Guest are viewing this topic.
3,421 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 11 March 2014
Last active: 5 years ago
Posts
264
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
Signature
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
×
buttkicker845's Groups
buttkicker845's Contact & Social Links
is it possible to make a trigger_use still show text but not be usable by a specific player?

so that way if a player has already used one of the triggers all the others say you have already activated a trigger but cant activate the trigger
broken avatar :(
×
broken avatar :(
Location: nl
Date Registered: 22 September 2013
Last active: 6 months ago
Posts
326
Respect
Forum Rank
Perk Hacker
Primary Group
Mapper
My Groups
More
Personal Quote
Zombie Mapper and Gamer
Signature
My Custom Zombie Maps:

- Nazi zombie Legion
- City of Hell
- The Abandoned Mine
- The Last Undead House (Finished)

more custom zombie maps coming soon
×
gamer9294's Groups
Mapper Has released one or more maps to the UGX-Mods community.
gamer9294's Contact & Social Links
is it possible to make a trigger_use still show text but not be usable by a specific player?

so that way if a player has already used one of the triggers all the others say you have already activated a trigger but cant activate the trigger

it is possible with a counting trig that when you activate them then the other trigs is usable but when you pressed the button then it says that it already activated is.


little example (made in few minutes) :

Code Snippet
Plaintext

#include common_scripts\utility;
#include maps\_utility;
#include maps\_zombiemode_utility;

main()
{
level.trig_up_amount = 0; //don't change this...

level.trig_up_limit = 1; //change here that can use the trigger,

level thread multiple_triggers();
}

multiple_triggers()
{
player = undefined; //we don't know who pressed the trigger and we don't who is who.

trig = getEnt("trigs_all","targetname"); //all triggers;  make sure that you have at lease 2 trigger other wise it will not working
for(t=0; t<trig.size; t++)
{
trig[t] SetHintString("Press and hold &&1 to activate trigger");  //change to whatever you want to have on the trigger...
trig[t] SetCursorHint( "HINT_NOICON" );
trig[t] UseTriggerRequireLookAt();

while(1)
{
trig[t] waittill("trigger", player); //why player = we will check to define which player activate the trigger...
trig[t] trigger_off(); //to shut it down for few seconds on the end to enable it.

if(level.trig_up_amount < level.trig_up_limit)
{
level.trig_up_amount++; //count up to make the limit working.

player iprintlnbold("trigger is activated here");  //player means only the player that has activated the trigger.

//do your stuff here

wait 0.1;
}
else
{
player iprintlnbold("sorry there is already a trigger being triggered");
wait 1;
}

trig[t] trigger_on();
wait 0.01;
}
}
}



if you going to try this then you need to make less 2 triggers in your map otherwise it will not working.



I have it not tested.  but it could look like this.


I hope that you mean this what you say. ?


you know if you need some help you can also send a pm to me :)

best regards,
Gamer9294
Last Edit: February 04, 2015, 08:29:32 pm by gamer9294
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 11 March 2014
Last active: 5 years ago
Posts
264
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
×
buttkicker845's Groups
buttkicker845's Contact & Social Links
thats similar to what im wanting to do but its not exactly what im wanting, im wanting to display the message on the trigger just like normal so that way when the player looks at it says "you already have used a trigger" but cant be triggered by that player anymore. if that helps describe what im wanting to do any better
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 7 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
thats similar to what im wanting to do but its not exactly what im wanting, im wanting to display the message on the trigger just like normal so that way when the player looks at it says "you already have used a trigger" but cant be triggered by that player anymore. if that helps describe what im wanting to do any better
Code Snippet
Plaintext
players = get_players();
for(t=0; t<players.size; t++)
{
players[t].already_used_trig = false;
}

trig SetHintString("press f cauze i got nothing better to do (JJ)");
while(1)
{
trig waittill("trigger", player); // any player

if(player.already_used_trig)
{
player IPrintLnBold( "you already have used a trigger" );
}
else
{
//do stuff like yolo and why not...
player.already_used_trig = true;
}
}
Last Edit: February 05, 2015, 04:10:15 am by jjbradman
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 11 March 2014
Last active: 5 years ago
Posts
264
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
×
buttkicker845's Groups
buttkicker845's Contact & Social Links
Code Snippet
Plaintext
players = get_players();
for(t=0; t<players.size; t++)
{
players[t].already_used_trig = false;
}

trig SetHintString("press f cauze i got nothing better to do (JJ)");
while(1)
{
trig waittill("trigger", player); // any player

if(player.already_used_trig)
{
player IPrintLnBold( "you already have used a trigger" );
}
else
{
//do stuff like yolo and why not...
player.already_used_trig = true;
}
}

i have it set up similar to that except when the player goes to the other triggers on the map it says the right message but the trigger can still be activated by that player. which i dont want to happen
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 7 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
i have it set up similar to that except when the player goes to the other triggers on the map it says the right message but the trigger can still be activated by that player. which i dont want to happen
show your code here then
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 11 March 2014
Last active: 5 years ago
Posts
264
Respect
Forum Rank
Mr. Elemental
Primary Group
Member
×
buttkicker845's Groups
buttkicker845's Contact & Social Links
heres the code that checks if the player has triggered the trigger and the one that waits for each trigger to be activated and then updates if a player has activated one or not. i tried using the trigger_off function but it just totally disabled the trigger

Code Snippet
Plaintext
keys_function(key_trigs,keys){
dist = 96 * 96;
while(1){
for(i = 0; i <key_trigs.size; i++){
players = getPlayers();
for(k = 0; k < players.size; k++){
if(players[k].hasKey && DistanceSquared( players[k].origin, key_trigs[i].origin ) < dist){
printDisplay(key_trigs[i], "You already have a key!");
//key_trigs[i] trigger_off();
}//end if
else if (!players[k].hasKey && DistanceSquared( players[k].origin, key_trigs[i].origin ) < dist){
printDisplay(key_trigs[i], "Press and hold &&1 to pick up the key!");
key_trigs[i] thread key_trig_watch(keys[i]);
}//end else if
else{
}//end else
}//end players for loop
}//end keys for loop
wait(.01);
}//end while loop
}//end keys_function

key_trig_watch(key){
player = undefined;
self waittill ("trigger",player);
player.hasKey = true;
objectDelete(self);
objectDelete(key);
}//end key_trig_watch
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 6 years ago
Posts
6,875
Respect
Forum Rank
Immortal
Primary Group
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.
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 LinksHarryBo000[email protected]HarryBo21
Code Snippet
Plaintext
keys_function(key_trigs,keys){
dist = 96 * 96;
while(1){
for(i = 0; i <key_trigs.size; i++){
players = getPlayers();
for(k = 0; k < players.size; k++){
if(players[k].hasKey && DistanceSquared( players[k].origin, key_trigs[i].origin ) < dist){
printDisplay(key_trigs[i], "You already have a key!");
//key_trigs[i] trigger_off();
}//end if
else if (!players[k].hasKey && DistanceSquared( players[k].origin, key_trigs[i].origin ) < dist){
printDisplay(key_trigs[i], "Press and hold &&1 to pick up the key!");
key_trigs[i] thread key_trig_watch(keys[i]);
}//end else if
else{
}//end else
}//end players for loop
}//end keys for loop
wait(.01);
}//end while loop
}//end keys_function

key_trig_watch(key){
player = undefined;
self waittill ("trigger",player);

                // ======================================================
                // YOU NEED TO CHECK HERE IF THE PLAYER SHOULD OR SHOULD NOT BE ABLE TO USE IT
                // ======================================================
                if ( player.hasKey )
                {
                        continue;
                }
                // ======================================================
 
player.hasKey = true;
objectDelete(self);
objectDelete(key);
}//end key_trig_watch

Off the top of my head, but I didnt look too close. Try that, let me know if that helps

 
Loading ...