trigger_teleport_relative

EArkham

Necromancer
aa
Aug 14, 2009
1,625
2,773
This was added in the Scream Fortress 2014 update.

Anyone played around with how this works differently than a regular trigger_teleport?

It doesn't have the "remote destination" field so I'm not really clear on how I should be using this. Inputs are standard (Enable, Disable, Toggle, Kill, etc), as are flags.

I'd expect with relative position preserved, it'd have to link up with another brush entity of the same dimensions...? I dunno.
 

Egan

aa
Feb 14, 2010
1,375
1,721
Yeah Im not really sure why they added this, you could link a trigger_teleport with an info_landmark to have people 'relatively' teleport to the destination, in accordance to how far away they are from the landmark when they touch the trigger. I imagine they just wanted a simpler version or the name is ambiguous and its how they teleport players randomly to the point on lakeside / doomsday.
 

EArkham

Necromancer
aa
Aug 14, 2009
1,625
2,773
As reference (ha, pun), pl_barnblitz "teleports" red players still in spawn to the 2nd spawn if they're in there when the first point is capped by using a game_forcerespawn ("ForceTeamRespawn" 2). No teleport, it just respawns the players in the next enabled set of spawns.

[Edit] Actually that's slightly incorrect -- it actually kills the players in the spawn (trigger_hurt) THEN instantly respawns them at the next enabled set of spawns.
 
Last edited:

Geit

💜 I probably broke it 💜
aa
May 28, 2009
598
1,161
Dunno if this helps...
Code:
CBaseEntity - trigger_teleport_relative
- m_TeleportOffset (Save|Key)(12 Bytes) - teleportoffset
- m_iFilterName (Save|Key)(4 Bytes) - filtername
- m_hFilter (Save)(4 Bytes)
- m_bDisabled (Save|Key)(1 Bytes) - StartDisabled
- m_hTouchingEntities (Save)(0 Bytes)
- InputEnable (Input)(0 Bytes) - Enable
- InputDisable (Input)(0 Bytes) - Disable
- InputToggle (Input)(0 Bytes) - Toggle
- InputTouchTest (Input)(0 Bytes) - TouchTest
- InputStartTouch (Input)(0 Bytes) - StartTouch
- InputEndTouch (Input)(0 Bytes) - EndTouch
- m_OnStartTouch (Save|Key|Output)(0 Bytes) - OnStartTouch
- m_OnStartTouchAll (Save|Key|Output)(0 Bytes) - OnStartTouchAll
- m_OnEndTouch (Save|Key|Output)(0 Bytes) - OnEndTouch
- m_OnEndTouchAll (Save|Key|Output)(0 Bytes) - OnEndTouchAll
- m_OnTouching (Save|Key|Output)(0 Bytes) - OnTouching
- m_OnNotTouching (Save|Key|Output)(0 Bytes) - OnNotTouching
 

EArkham

Necromancer
aa
Aug 14, 2009
1,625
2,773
The teleport offset key is interesting, but otherwise it looks like all the standard logic stuff. I guess we'll have to wait until someone decompiles doomsday_event to see how they use it there... I'm assuming that's how they move players to bumper carts, etc.
 

A Boojum Snark

Toraipoddodezain Mazahabado
aa
Nov 2, 2007
4,775
7,669
The offset is the entire point of the entity. It moves people by a specific X Y Z value relative to their location when they hit the trigger. So you can do things with it that would be difficult with a normal teleport, or just more work.

Doomsday just uses them inside the falling platforms to teleport people 120 units upward if they are inside the platform when it reenables.
 
Apr 14, 2013
663
343
[Edit] Actually that's slightly incorrect -- it actually kills the players in the spawn (trigger_hurt) THEN instantly respawns them at the next enabled set of spawns.
I was just trying to achieve something like this in my own map. How exactly is it achieved? I'd have guessed it's by making the respawn wave time 0 secs for a really short time but I don't really know.
 

EArkham

Necromancer
aa
Aug 14, 2009
1,625
2,773
I was just trying to achieve something like this in my own map. How exactly is it achieved? I'd have guessed it's by making the respawn wave time 0 secs for a really short time but I don't really know.

It's not too hard to set up. Entity names I used below are just example names of course:

  • Put a game_forcerespawn in your map, give it a name ("force_red_respawn")
  • Put in two sets of info_player_teamspawn, name them differently ("spawn01", "spawn02"), put them in the appropriate respawn rooms
  • Put a trigger_hurt with force OFF and damage GENERIC over your first spawn, have it disabled by default, name it ("red_spawn01_killer")
  • When your spawn needs to change, disable spawn01, then enable spawn02, do that with a delay of 0.00 or 0.10 or something to make it happen first
  • Enable the trigger_hurt with a delay of 0.20 to make sure it happens after the spawns are changed
  • Send an output to the game_forcerespawn "ForceTeamRespawn - 2" - delay of 0.30 so it happens last

Make sure you use ForceTeamRespawn, not ForceRespawn, since you just want one team to respawn.

And make sure you use 2 as the parameter override. I think you use 3 for BLU to respawn, but I'm not sure (uses the same numbers as the spawnrooms?).

The one downside to doing this is that it does add 1 to your death counter, and would probably reset killstreaks, heads, etc, if they happen to be running back to resupply right at the changeover, but I've never seen anyone complain about that on pl_barnblitz.

Btw, if you go into pl_snowycoast_B1 expecting it to work this way, it doesn't (I made a mistake rushing for the deadline). B2 works, but I won't be releasing yet since judging is ongoing for the contest.
 
Last edited:

InstantMuffin

L2: Junior Member
May 26, 2014
64
48
The offset is the entire point of the entity. It moves people by a specific X Y Z value relative to their location when they hit the trigger. So you can do things with it that would be difficult with a normal teleport, or just more work.[...]

thisthisthisthisthisthisthisthis

Code:
int __cdecl CTriggerTeleportRelative__Touch(int a1, int a2)
{
  int result; // eax@1
  int v5; // eax@2
  int v6; // [sp+14h] [bp-14h]@2

  _EBX = a1;
  result = (*(int (__cdecl **)(int, int))(*(_DWORD *)a1 + 788))(a1, a2);
  if ( (_BYTE)result )
  {
    _EAX = (*(int (__cdecl **)(int))(*(_DWORD *)a1 + 600))(a1);
    __asm
    {
      movss   xmm0, dword ptr [eax]
      addss   xmm0, dword ptr [ebx+484h]
      movss   [ebp+var_14], xmm0
      movss   xmm0, dword ptr [eax+4]
      addss   xmm0, dword ptr [ebx+488h]
      movss   [ebp+var_10], xmm0
      movss   xmm0, dword ptr [eax+8]
    }
    v5 = *(_DWORD *)a2;
    __asm
    {
      addss   xmm0, dword ptr [ebx+48Ch]
      movss   [ebp+var_C], xmm0
    }
    result = (*(int (__cdecl **)(int, int *, _DWORD, _DWORD))(v5 + 436))(a2, &v6, 0, vec3_origin);
  }
  return result;
}
 
Last edited:

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,694
2,579
Wait, where did you find the source code? Did Valve finally start releasing it for TF2?
 

henke37

aa
Sep 23, 2011
2,075
515
That's obviously decompiled code. Those crazy function pointer casts are the result of the decompiler not knowing the vtable for the class.