Make a prop rotate to face the player?

Discussion in 'Mapping Questions & Discussion' started by Hosomi, Jul 5, 2017.

  1. Hosomi

    Hosomi L3: Member

    Messages:
    127
    Positive Ratings:
    39
    First off, is it even possible?
    I considered using a point_anglesensor to acquire angles to set on the prop, but this requires a specified entity name, I don't even know if the player has an entity name.

    I want to achieve an effect similar to the npc_security_camera in Portal and Portal 2
     
  2. Hosomi

    Hosomi L3: Member

    Messages:
    127
    Positive Ratings:
    39
    I did find some stuff for L4D2 scripting, but I don't know if that works with TF2, and I have no idea how to implement scripts in Source anyway.
     
  3. henke37

    aa henke37

    Messages:
    1,834
    Positive Ratings:
    420
    Which player? There can be between zero and thirty two of them to choose from.
     
  4. Pocket

    aa Pocket func_croc

    Messages:
    4,480
    Positive Ratings:
    2,213
    I was gonna say. Even if the code they used to handle the Portal cameras (and the wall-mounted Half-Life 2 turrets—less far fetched since every Source game is essentially an HL2 mod) were in the game and functional, it probably doesn't work in multiplayer.
     
  5. Izotope

    aa Izotope Never releases maps

    Messages:
    592
    Positive Ratings:
    540
    They work in Portal 2 COOP, probably just following the nearest player.
     
  6. [Rx.] Christian Troy

    [Rx.] Christian Troy L4: Comfortable Member

    Messages:
    154
    Positive Ratings:
    42
    What does Portal call the player? Sometimes it's the same for tf2 but not always. I know for triggers it would be !activator but not sure if that applies to this.
     
  7. henke37

    aa henke37

    Messages:
    1,834
    Positive Ratings:
    420
    The source engine has the !player magic entity name. But it only works in singleplayer games.
     
  8. [Rx.] Christian Troy

    [Rx.] Christian Troy L4: Comfortable Member

    Messages:
    154
    Positive Ratings:
    42
    Not sure why I didn't think of it earlier. What is the entity that a sentry locks onto? This kinda interesting as the OP has a cool idea.
     
  9. Lampenpam

    aa Lampenpam

    Messages:
    994
    Positive Ratings:
    329
    You can give a player a "targetname". I dont know if that helps, just throwing it in here.

    To give a player a targetname give him this input: addoutput targetname <NAME>

    I hope thats the right syntax. Giving player targetnames is very experimental and might not work on heavily modded servers. I dont even know if it can be a solution to the problem but perhaps this angle entity thing can make use of the targetname though you probably need to make it in a way that only one player has that targetname at a time.
     
    Last edited: Jul 7, 2017
  10. henke37

    aa henke37

    Messages:
    1,834
    Positive Ratings:
    420
    Also, you need to know which player entity to send the input to in the first place. Which kinda loops back to the original problem.
     
Tags: