trigger_teleport_relative

Discussion in 'Mapping Questions & Discussion' started by EArkham, Nov 18, 2014.

  1. EArkham

    aa EArkham Necromancer

    Messages:
    1,555
    Positive Ratings:
    2,156
    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.
     
  2. Egan

    aa Egan

    Messages:
    1,302
    Positive Ratings:
    1,478
    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.
     
  3. EArkham

    aa EArkham Necromancer

    Messages:
    1,555
    Positive Ratings:
    2,156
    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: Nov 18, 2014
  4. Geit

    aa Geit 💜 I probably broke it 💜

    Messages:
    597
    Positive Ratings:
    1,110
    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
    
     
  5. EArkham

    aa EArkham Necromancer

    Messages:
    1,555
    Positive Ratings:
    2,156
    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.
     
  6. A Boojum Snark

    aa A Boojum Snark Toraipoddodezain Mazahabado

    Messages:
    4,767
    Positive Ratings:
    5,508
    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.
     
  7. takabuschik

    aa takabuschik

    Messages:
    660
    Positive Ratings:
    308
    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.
     
  8. EArkham

    aa EArkham Necromancer

    Messages:
    1,555
    Positive Ratings:
    2,156
    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.
     
    • Thanks Thanks x 1
    Last edited: Nov 19, 2014
  9. InstantMuffin

    InstantMuffin L2: Junior Member

    Messages:
    64
    Positive Ratings:
    48
    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: Nov 19, 2014
  10. Pocket

    aa Pocket func_croc

    Messages:
    4,478
    Positive Ratings:
    2,205
    Wait, where did you find the source code? Did Valve finally start releasing it for TF2?
     
  11. henke37

    aa henke37

    Messages:
    1,832
    Positive Ratings:
    420
    That's obviously decompiled code. Those crazy function pointer casts are the result of the decompiler not knowing the vtable for the class.