Page 1 of 1

More than one teleport... HOW?

Posted: August 11th, 2011, 3:37 pm
by whitee
Hey you may think im a noob but all of you were begginers in mapping sometimes...
Now for the question i can do one teleport (target/enter, targetname/something:D) but when i do the same with other teleport ( Not the targetname) it connects me 2 teleport enters with orange line.. When i want to test this map i dont get to teleport in 2nd teleport ( i can jump there and all but nothing happens) Do i need new script & how to do more than one teleport?



Thank you for answers! :)

Re: More than one teleport... HOW?

Posted: August 11th, 2011, 4:58 pm
by Goro92

Code: Select all

main()
{ 
  thread teleport1();
  thread teleport2();
 }
  
teleport1()
{   
    trigger = getent("teleport1","targetname");
 
    while(1)
  {
    trigger waittill("trigger", player);
    if(player isTouching(trigger)){
     player setOrigin( (x, y, z) );//cordinates
    
   }
  }
}
 
 
 
teleport2()
{   
   trigger = getent("teleport2","targetname");
 
  while(1)
 
    {
 
    trigger waittill("trigger", player);
    if(player isTouching(trigger)){
     player setOrigin( (x, y, z) );//cordinates
 
    }
  }
}
 
 
 
 

Re: More than one teleport... HOW?

Posted: August 11th, 2011, 5:24 pm
by Rezil

Code: Select all

if(player isTouching(trigger)){
Redundant. You are automatically touching a trigger_multiple(the type of trigger that should be used here) so checking if the player is touching it can be omitted. I would also suggest placing a script_origin in Radiant and then using its coordinates instead of manually adding them yourself.

Re: More than one teleport... HOW?

Posted: August 11th, 2011, 5:50 pm
by <LT>YosemiteSam[NL]
I just used this one for 1 teleport;

Code: Select all

main()
{

  entTransporter = getentarray("inside","targetname");
  if(isdefined(entTransporter))
  {
    for(lp=0;lp<entTransporter.size;lp=lp+1)
      entTransporter[lp] thread Transporter();
  }


}

transporter()
{
  while(true)
  {
   self waittill("trigger",other);
   entTarget = getent(self.target, "targetname");
   wait(0.10);
   other setorigin(entTarget.origin);
   other setplayerangles(entTarget.angles);
   other playsound("playerspawn");
   wait(0.10);
  }
}
Can't see why just changing the naming wouldn't work.

Re: More than one teleport... HOW?

Posted: August 12th, 2011, 7:56 am
by Goro92
Rezil wrote:

Code: Select all

if(player isTouching(trigger)){
Redundant. You are automatically touching a trigger_multiple(the type of trigger that should be used here) so checking if the player is touching it can be omitted. I would also suggest placing a script_origin in Radiant and then using its coordinates instead of manually adding them yourself.

is it redundant also if i use a trigger_use?

Re: More than one teleport... HOW?

Posted: August 12th, 2011, 10:23 am
by waywaaaard
Use YosemiteSam's approach, when you are connecting the trigger with the script_origin and hit the key to connect (don't remember right now). The script_origin's name will be automatically target with an incremented number.

Re: More than one teleport... HOW?

Posted: August 12th, 2011, 11:53 am
by Rezil
The same rules apply to a trigger_use as well. So, redundant.

Re: More than one teleport... HOW?

Posted: August 12th, 2011, 2:08 pm
by Drofder2004
serveaiuto wrote:is it redundant also if i use a trigger_use?
Trigger_use: Triggered by 'activation'
Trigger_multiple: Triggered by 'touch'
Trigger_damage: Triggered by 'damage'

isTouching() is a function used mainly for error checking and proximity checks.
For example, in MP it is used to make sure there are no HQ mapping errors (checks to make sure a radio is touching only one trigger) and it is also used with game objects to detect players continuous proximity to that object (such as bombzones and radios).

All triggers can be written to detect player trigger events:
trigger waittill("trigger", player);
trigger waittill("damage", amount, player); [Used for trigger_damage, to detect amount of damage caused]

Re: More than one teleport... HOW?

Posted: August 12th, 2011, 8:15 pm
by Goro92

Code: Select all

main()
{ 
  thread teleport1();
  thread teleport2();
 }
  
teleport1()
{  
    trigger = getent("teleport1","targetname");
    while(1)
 
  {
 
    trigger waittill("trigger", player);
 player setOrigin( (x, y, z) );//cordinates
  }}
 
 
teleport2()
{  
 
   trigger = getent("teleport2","targetname");
while(1)
 
    { 
 
    trigger waittill("trigger", player);
player setOrigin( (x, y, z) );//cordinates
 
  }
 
}
 
 
so

Code: Select all

if(player isTouching(trigger)){
is useless in this script?

Re: More than one teleport... HOW?

Posted: August 13th, 2011, 2:19 am
by Drofder2004
Yes.

Re: More than one teleport... HOW?

Posted: August 19th, 2011, 1:00 pm
by whitee
And how do i get coordinates of scrip_origin? : )

Re: More than one teleport... HOW?

Posted: August 19th, 2011, 10:08 pm
by Drofder2004
entity getOrigin();