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 players be in a trigger multiple when something happens?

broken avatar :(
Created 12 years ago
by Dust
0 Members and 1 Guest are viewing this topic.
1,859 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 all day ive been fiddling with this script and I cant get it to work. Basically I want it so one of the players hits a button but all the alive players has to be in the room(inside the trigger multiple) when it happens or it wont let the script continue. I took a portion of the script from the end game teleport script, and edited it to match mine. but even when the players are standing in the trigger multiple it still says "All players must be in this Room".

Here is the script that handles it
Code Snippet
Plaintext
rocket_launch() //Thread runs once all 5 fuel cans are in the rocket
{
cost = 5000; //How much money it costs to hit the button
//who = undefined;
trig = getent("rocket_launch_button","targetname"); //trigger for the button
trig setcursorhint("HINT_NOICON");
trig sethintstring("Press &&1 to launch the Rocket [Cost: "+cost+"]");
trig enable_trigger();

trig_player_check = getEnt("lock_in","targetname"); //trigger multiple that covers the entire room

while(1)
{
trig waittill("trigger",who); //waits for the player to hit the trigger on the button

// got the money ??
if(who.score >= cost)
{



who maps\_zombiemode_score::minus_to_player_score(cost); 

alive = AlivePlayersArr();
touching = trig_player_check GetTouchingPlayers();

if(alive.size != touching)
{
Texthud = tom_make_hud(undefined, "center", "middle", "center", "bottom", 0, -148, 1.2, 1, (1,1,1));
Texthud setText("All players must be in this Room"); //text that comes up when not all of the players are in the room

while(alive.size != touching)
{
alive = AlivePlayersArr();
touching = trig_player_check GetTouchingPlayers();

wait 0.1; // this loop won't run long so lets go mental.
}
Texthud destroy();
}
trig playsound("cha_ching");
trig delete();
            door = getent("door10","targetname"); //Door that comes down once the players hit the trigger
door moveZ (1000000, .5);
}
else
{
trig playsound("no_cha_ching");
}
wait 0.15;
}
}
tom_make_hud(client, alignXArg, alignYArg, horzAlignArg, vertAlignArg, xArg, yArg, fontScale, alpha, Textcolor)
{
if(isDefined(client))
hud = newClientHudElem(client);
else
hud = newHudElem();
hud.alignX = alignXArg;
hud.alignY = alignYArg;
hud.horzAlign = horzAlignArg;
hud.vertAlign = vertAlignArg;
hud.y = yArg;
hud.x = xArg;
hud.foreground = true;
hud.font = "default";
hud.fontScale = fontScale;
hud.alpha = alpha;
if(isDefined(Textcolor))
hud.color = (Textcolor);
else
hud.color = ( 1.0, 1.0, 1.0 );
return hud;
}

GetTouchingPlayers()
{
if(isdefined(self))
{
  players = get_players();
  num = 0;
  for(i=0;i<players.size;i++)
if(players[i] istouching(self))
num ++;
  return num;
}
else
{
iPrintLnBold("GetTouchingPlayers(): Needs to be called on a object");
return -1;
}
}

AlivePlayersArr()
{
   alive = [];
   players = get_players();
   for(i=0;i<players.size;i++)
   {
      if( !players[i].is_zombie && !players[i] maps\_laststand::player_is_in_laststand() && players[i].sessionstate != "spectator" )
alive[alive.size] = players[i];
   }
   return alive;
}
Last Edit: October 03, 2014, 01:52:03 am by thezombiekilla6
broken avatar :(
×
broken avatar :(
[UGX] Documentation Writer & Programmer
Location: usLos Angeles, CA
Date Registered: 23 August 2013
Last active: 3 years ago
Posts
1,322
Respect
Forum Rank
Zombie Colossus
Primary Group
UGX Team Member
My Groups
More
My Contact & Social Links
More
Personal Quote
(ง º ω º )ง u wont sum m8y?
Signature
Do not take life too seriously. You will never get out of it alive.
×
DidUknowiPwn's Groups
UGX Team Member
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Make sure the entity you're linking to is actually a trigger (it's targetname is a trigger_XXX type).
Alternatively you can link to the model then spawn a trigger through script using the code below.
Code Snippet
Plaintext
	leTrigger = spawn("trigger_radius",entity.origin,9,RADIUS,HEIGHT);
Then you'd do:
Code Snippet
Plaintext
while( true )
{
leTrigger waittill("trigger", person);
//DO SHIT
}

lolderp fixed retarded mistake :D
Last Edit: October 03, 2014, 02:02:28 am by DidUknowiPwn
Marked as best answer by thezombiekilla6 12 years ago
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 6 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Mapper Has released one or more maps to the UGX-Mods 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
Above:

Code Snippet
Plaintext
			if(alive.size != touching)
{
put:
Code Snippet
Plaintext
			iprintlnbold("alive: " + alive.size);
iprintlnbold("touching: " + touching);
if(alive.size != touching)
{

If they are not equal then trace it backwards of why.

Is it perhaps that you are using return alive:
Code Snippet
Plaintext
AlivePlayersArr()
{
   alive = [];
   players = get_players();
   for(i=0;i<players.size;i++)
   {
      if( !players[i].is_zombie && !players[i] maps\_laststand::player_is_in_laststand() && players[i].sessionstate != "spectator" )
alive[alive.size] = players[i];
   }
   return alive;
}

maybe you should return alive's size?
Code Snippet
Plaintext
AlivePlayersArr()
{
   alive = [];
   players = get_players();
   for(i=0;i<players.size;i++)
   {
      if( !players[i].is_zombie && !players[i] maps\_laststand::player_is_in_laststand() && players[i].sessionstate != "spectator" )
alive[alive.size] = players[i];
   }
   return alive.size;
}
In GetTouchingPlayers() you use a variable num to increment and here, in AlivePlayersArr(), you use an array to collect the alive players.
Last Edit: October 07, 2014, 02:59:21 pm by MakeCents

 
Loading ...