Page 1 of 2

teleporters (but different)

Posted: August 23rd, 2006, 12:19 am
by Pedsdude
OK, I have a trigger_use switch that I want to activate a teleporter. The teleporter will teleport anyone inside the specific trigger_multiple to a set location. I have the following code, but it doesn't work (because it has 'user' in it).

Code: Select all

main()
{
   thread telesecret1();
}

telesecret1()
{
sectrig1 = getent("sectrig1","targetname");
trigger1 = getent("sectrigg1","targetname");
while(1)
   {
   sectrig1 waittill ("trigger1",user);
      user iprintlnbold("Teleport secret1 Activated!");
   loc[0] = (-854,125,6); 
   user setOrigin(loc[randomInt(loc.size)]); 
      wait 0.5;
   }
}
sectrig1 is the trigger_use to start it, sectrigg1 is the trigger_multiple in which people will be teleported from.

Any help? I'm aware that "user setOrigin(loc[randomInt(loc.size)]);" sets it for the person who triggered it, but at the same time I doubt it would work if I got rid of the user and just had setOrigin.

Posted: August 23rd, 2006, 1:09 am
by creator
dont think its possible with a trigger_multiple try with: script_origin with targetname sectrigg1
and

Code: Select all

sectrig1 waittill ("trigger1",user);
i think that should be

Code: Select all

sectrig1 waittill ("trigger",user);
(can be wrong)

ahh i was thinking u ment: teleport TO trigger_multiple

Posted: August 23rd, 2006, 1:28 am
by Drofder2004
Nice idea. try this...

Code: Select all

main()
{
   thread telesecret1();
}

telesecret1()
{
use = getent("sectrig1","targetname");

multiple = getent("sectrigg1","targetname");

//You actually do not need to use a trigger
//You can use a script_brushmodel using "nodraw_notsolid" texture (probably a better idea)

// Locations Here
loc[0] = (-854,125,6);
//loc[1] = (x, y, z);

while(1)
   {
   use waittill ("trigger1",user);
      user iprintlnbold("Teleport Secret 1 Activated!");
   
   players = getentarray("players","classname");   
   for(i=0;i<players.size;i++)
   {
      if(players[i] isTouching(multiple))
         players[i] setOrigin(loc[randomInt(loc.size)]);
   }
   }
}

Posted: August 23rd, 2006, 1:32 am
by creator
drofder i know its not related to this well actully.. alittle ( loc )
is it possible to let a platform more to a location like in coordinants not in how many units go up down right left and those?

Posted: August 23rd, 2006, 1:34 am
by Pedsdude
Is there anything you don't know Drofder? :D Will try it now!

Posted: August 23rd, 2006, 1:36 am
by creator
i dont think he knows the awnser to my question hehe :P (sry could not stop my self :P )

Posted: August 23rd, 2006, 2:47 am
by Drofder2004
creator wrote:drofder i know its not related to this well actully.. alittle ( loc )
is it possible to let a platform more to a location like in coordinants not in how many units go up down right left and those?
platform moveTo(<location>, <time>);

Posted: August 23rd, 2006, 12:04 pm
by creator
thats also units right....? not location

Posted: August 23rd, 2006, 3:30 pm
by Pedsdude
It doesn't seem to work...

Code: Select all

main()
{
   thread telesecret1();
   thread telesecret2();
}

telesecret1()
{
use = getent("sectrig1","targetname");
multiple = getent("sectrigg1","targetname");
//You actually do not need to use a trigger
//You can use a script_brushmodel using "nodraw_notsolid" texture (probably a better idea)
// Locations Here
loc[0] = (-2,2,2);
//loc[1] = (x, y, z);
while(1)
   {
   use waittill ("trigger",user);
      user iprintlnbold("Teleport Secret 1 Activated!");
      players = getentarray("players","classname");   
   for(i=0;i<players.size;i++)
   {
      if(players[i] isTouching(multiple))
         players[i] setOrigin(loc[randomInt(loc.size)]);
   }
   }
}

telesecret2()
{
use = getent("sectrig2","targetname");
multiple = getent("sectrigg2","targetname");
//You actually do not need to use a trigger
//You can use a script_brushmodel using "nodraw_notsolid" texture (probably a better idea)
// Locations Here
loc[0] = (-2,2,2);
//loc[1] = (x, y, z);
while(1)
   {
   use waittill ("trigger",user);
      user iprintlnbold("Teleport Secret 2 Activated!");
      players = getentarray("players","classname");   
   for(i=0;i<players.size;i++)
   {
      if(players[i] isTouching(multiple))
         players[i] setOrigin(loc[randomInt(loc.size)]);
   }
   }
}
Please modify :)

Posted: August 23rd, 2006, 3:38 pm
by Drofder2004
What doesnt work?

Any errors?

Have you tested this with only 1 of those 2 threads running.

Posted: August 23rd, 2006, 3:41 pm
by Pedsdude
KillerSam wrote:Only tested with both, the only error is...nobody teleports :S
Yep. It comes up with the message, but other than that nothing appears to happen (nobody gets teleported).

Posted: August 23rd, 2006, 4:02 pm
by Pedsdude
Tested with 1 and it didn't work.

Posted: August 23rd, 2006, 4:06 pm
by Drofder2004
The you should try using some simple debug mehtods...

Code: Select all

main()
{
   thread telesecret1();
}

telesecret1()
{
use = getent("sectrig1","targetname");
multiple = getent("sectrigg1","targetname");

loc[0] = (-2,2,2);
iprintln("Loc[0]: " + loc[0]); // DEBUG

while(1)
   {
   use waittill ("trigger",user);

      iprintln("USE TRIGGER"); // DEBUG

      user iprintlnbold("Teleport Secret 1 Activated!");
      players = getentarray("players","classname");  

      iprintln("PLAYERS: " + players.size); // DEBUG 

   for(i=0;i<players.size;i++)
   {
      if(players[i] isTouching(multiple))
      {
         players[i] setOrigin(loc[randomInt(loc.size)]);
         players[i] iprintln("You should have moved");  // DEBUG
      }
      else
         players[i] iprintln("You are not touching 'multiple'"); // DEBUG
   }
   }
}
It may be the use of set origin. Just use that above ONLY.

Posted: August 23rd, 2006, 4:38 pm
by Pedsdude
Testing now...

Posted: August 23rd, 2006, 6:02 pm
by Pedsdude
Didn't work. It said "PLAYERS: 0" and went no further, despite that fact that I was in the trigger area while KS pressed use on the other trigger. I even tried it with a script_brushmodel of the same targetname with the nodraw_nosolid texture.