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

Help with multiple triggers for 1 door

broken avatar :(
Created 12 years ago
by Dust
0 Members and 1 Guest are viewing this topic.
4,518 views
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 6 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Signature
Donate to me if you enjoy my work. https://www.paypal.me/thezombiekilla6
×
Dust's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Dust's Contact & Social Linksdust103194MrZ0mbiesFanaticMrZ0mbiesFanatic
Okay so I have been trying to get this set up to where you need to hit both of the teddy bears to open up 1 certain door, I used the shootable script but modified it because i want them to walk up and press f to pay for it, and the shootable script was working perfectly but im confused as to how to set it up for the buyable trigger. here is my script

Code Snippet
Plaintext
//Secret_Easter_Egg
Secret_trigger_1()
{
   self.secret_trigger_num = 0;
   trig1 = getEnt("secret_trigger","targetname");
   trig1 setHintString("Press and hold &&1 To Buy One of Two Teddies[Cost:1000]");
   trig1 waittill("trigger", player );
   trig1 SetCursorHint( "HINT_NOICON" );
 

self.secret_trigger_num = self.secret_trigger_num + 1;
thread secret_door();
}

secret_trigger_2()
{
   trig2 = getEnt("secret_trigger2","targetname");
    trig2 setHintString("Press and hold &&1 To Buy One of Two Teddies[Cost:1000]");
   trig2 waittill("trigger", player );
   trig2 SetCursorHint( "HINT_NOICON" );
 

self.secret_trigger_num = self.secret_trigger_num + 1;
thread secret_door();
}

secret_door()
{
door = getEnt("secret_door","targetname");
if(self.secret_trigger_num == 2)
{
door movez(-500, 25);
wait 8;
door delete();
}
}

I already got it set up for the trigger_use, i just need to know how to make it buyable, it comes up when i walk up to it Press and hold F To Buy One of Two Teddies[Cost:1000], which is good since thats what it says in the script, but it doesnt take any money off of me
This topic contains a post which is marked as the Best Answer. Click here to view it.
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
please notify me whether it worked or not :)
Last Edit: January 29, 2014, 08:33:06 pm by jjbradman
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 6 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
×
Dust's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Dust's Contact & Social Linksdust103194MrZ0mbiesFanaticMrZ0mbiesFanatic
It says server script compile error, bad syntax
self.secret_trigger_num = 0;

Not sure if this matters but i got this in my nazi_zombie_mapname.gsc, let me know if i need to put it elsewhere.


Got that fixed, turns out you forgot to add a ; after zombie_cost = 1000, but when i go to buy the teddy it still says the same thing, and this time it takes my money but it doesnt make the text disappear
Last Edit: January 29, 2014, 08:18:58 pm by thezombiekilla6
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 10 years ago
Posts
2,789
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
Signature
Let's keep this thread on topic from here on in. -DBZ

+1 to off-topic reply -DBZ

lmao. Too funny.

Goliath Script Placer: http://ugx-mods.com/forum/index.php/topic,11234.msg125257/topicseen.html#new

"...Christ, people. Learn C, instead of just stringing random characters
together until it compiles (with warnings)..."

-Linus Torvalds
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
It doesn't look like the triggers are being deleted with an delete(); function.
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
ups my bad, fixed. i didnt thought you needed to use the delete function with the trigger_once but anyways heres the changed script
Code Snippet
Plaintext
//Secret_Easter_Egg
Secret_trigger_1()
{
   zombie_cost = 1000;
   self.secret_trigger_num = 0;
   trig1 = getEnt("secret_trigger","targetname");
   trig1 SetCursorHint( "HINT_NOICON" );
   trig1 setHintString("Press and hold &&1 To Buy One of Two teddies [" + zombie_cost + "]");
   trig1 waittill("trigger", player );
    if( player.score >= zombie_cost )
          player maps\_zombiemode_score::minus_to_player_score( zombie_cost );
trig1 delete();
self.secret_trigger_num = self.secret_trigger_num + 1; 

   trig2 = getEnt("secret_trigger2","targetname");
   trig2 SetCursorHint( "HINT_NOICON" );
   trig2 setHintString("Press and hold &&1 To Buy One of Two teddies [" + zombie_cost + "]");
   trig2 waittill("trigger", player );
if( player.score >= zombie_cost )
          player maps\_zombiemode_score::minus_to_player_score( zombie_cost ); 
self.secret_trigger_num = self.secret_trigger_num + 1;
trig2 delete();
//IPrintLN("self.secret_trigger_num.size");

if(self.secret_trigger_num == 2)
{
door = getEnt("secret_door","targetname");

door movez(-500, 25);
wait 8;
door delete();

}
}
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 6 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
×
Dust's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Dust's Contact & Social Linksdust103194MrZ0mbiesFanaticMrZ0mbiesFanatic
well everything is working except, for some reason i need to buy teddy1 in order for teddy 2 to be able to be bought, how do i make it where they can choose to either buy teddy 1 or teddy 2 first?
broken avatar :(
×
broken avatar :(
Location: usYork, SC
Date Registered: 30 March 2013
Last active: 12 years ago
Posts
24
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
Personal Quote
Coder
Signature
PROxFTW
×
blackbird431's Groups
blackbird431's Contact & Social LinksPROxFTWiso4lif3PROxFTWJTAGxHACKER
Try this script, I may have to change one thing if it doesn't work first time around
Code Snippet
Plaintext
OpenDoor()
{
door = getEnt("secret_door", "targetname");
door movez(-500, 25);
wait 8;
door delete();
}

SecretDoor()
{
TriggerCount = 0;
Cost = 1000;
trig1 = getEnt("secret_trigger","targetname");
  trig1 SetCursorHint( "HINT_NOICON" );
    trig1 setHintString("Press and hold &&1 To Buy One of Two teddies [" + Cost + "]");
    trig2 = getEnt("secret_trigger2","targetname");
    trig2 SetCursorHint( "HINT_NOICON" );
    trig2 setHintString("Press and hold &&1 To Buy One of Two teddies [" + Cost + "]");
    self thread WaiterTrig(trig1);
    self thread WaiterTrig(trig2);
    while(1)
    {
    self waittill("GotTrig");
    if( self.score >= Cost )
    {
        self maps\_zombiemode_score::minus_to_player_score( Cost );
        TriggerCount += 1;
        }
    if(TriggerCount == 2)
    thread OpenDoor();
    }
}

WaiterTrig( trig )
{
trig waittill("trigger", player );
trig delete();
self notify("GotTrig");
}
broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 6 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
×
Dust's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Dust's Contact & Social Linksdust103194MrZ0mbiesFanaticMrZ0mbiesFanatic
It is working now! Thanks to Rollonmath42
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
lol post here how he solved it, for others to know
Marked as best answer by thezombiekilla6 12 years ago
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 29 August 2012
Last active: 7 years ago
Posts
220
Respect
Forum Rank
Mr. Elemental
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Signature
I do mods/maps for WaW and BO1.
×
Rollonmath42's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Rollonmath42's Contact & Social LinksRollonmath42rollonmath42Rollonmath42Rollonmath42
I setup each trigger and the door as a separate function and then used flags to make the game wait for the two triggers to be activated before the doors got activated, as shown here:
Code Snippet
Plaintext
//Secret_Easter_Egg - Modified by Rollonmath42
Secret_trigger_1()
{
trigger1_cost = 1000;
trig1 = getEnt("secret_trigger","targetname");
trig1 SetCursorHint( "HINT_NOICON" );
trig1 setHintString("Press and hold &&1 To Buy One of Two teddies [" + trigger1_cost + "]");
trig1 waittill("trigger", player );
if( player.score >= trigger1_cost )
player maps\_zombiemode_score::minus_to_player_score( trigger1_cost );
trig1 delete();
flag_set("trigger1_door_activated");
//Now the games knows teddy 1 is activated
//self.secret_trigger_num = self.secret_trigger_num + 1;
}

Secret_trigger_2()
{
trigger2_cost = 1000;
trig2 = getEnt("secret_trigger2","targetname");
trig2 SetCursorHint( "HINT_NOICON" );
trig2 setHintString("Press and hold &&1 To Buy One of Two teddies [" + trigger2_cost + "]");
trig2 waittill("trigger", player );
if( player.score >= trigger2_cost )
player maps\_zombiemode_score::minus_to_player_score( trigger2_cost );
trig2 delete();
flag_set("trigger2_door_activated");
//Now the game knows teddy 2 is activated
}

secret_door()
{
door = getEnt("secret_door","targetname");
//Game will now wait for both teddys to be activated
flag_wait("trigger1_door_activated");
flag_wait("trigger2_door_activated");
door movez(-500, 25);
wait 8;
door delete();
//done :D
}

And then before maps\_zombiemode::main(); I put
Code Snippet
Plaintext
//Rollonmath42 - Let's use flags instead of variables, I prefer using flags :P
flag_init("trigger1_door_activated");
flag_init("trigger2_door_activated");
//Make each trigger and the door it's own function
thread secret_trigger_1();
thread secret_trigger_2();
thread secret_door_1();
Last Edit: January 30, 2014, 04:35:49 am by Rollonmath42
broken avatar :(
×
broken avatar :(
Former UGX Lead Asset Creator
Location: ca
Date Registered: 17 August 2012
Last active: 7 years ago
Posts
1,932
Respect
Forum Rank
Zombie Destroyer
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
Personal Quote
Eh?
Signature

(Click to enter portfolio)
×
SajeOne'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.
Please specify best answer.

 
Loading ...