Can you give keys to players?

Discussion in 'Mapping Questions & Discussion' started by bob+M|M+, Jun 1, 2008.

  1. bob+M|M+

    bob+M|M+ L6: Sharp Member

    Messages:
    348
    Positive Ratings:
    185
  2. Axii

    Axii L1: Registered

    Messages:
    47
    Positive Ratings:
    7
  3. bob+M|M+

    bob+M|M+ L6: Sharp Member

    Messages:
    348
    Positive Ratings:
    185
    In TFC mapping there was an entity that allowed you to give players "keys" so that they could activate triggers only if they carried the key. I don't think the entity exists anymore in TF2, however, so I wonder if there is an alternative method, or if I overlooked something.
     
  4. MrAlBobo

    MrAlBobo L13: Stunning Member

    Messages:
    1,059
    Positive Ratings:
    219
    i recall someone saying that you could give players "names" and then use those names to activate things...but no way in hell could I tell you how to do it

    Id suggest you ask pseudo, he knows an unusual amount about entities (haven't seen him on lately though)
     
  5. Bonafide

    Bonafide L6: Sharp Member

    Messages:
    314
    Positive Ratings:
    25
    in rock2 you need to pick up a key and carry it to activate the gas chamber. Ask Juice how he did it.
     
  6. Pseudo

    Pseudo L6: Sharp Member

    Messages:
    319
    Positive Ratings:
    149
    To "name" a player that activated a trigger you would target !activator and send the output AddOutput with the parameter targetname whatevername. Then you could use filter_activator_name to make it so only a player with a certain "name" could activate something.

    You could give this a graphical representation by using SetParent !activator with something such as a sprite, and SetParentAttachment with a parameter of head to position an image of a key over the player's head.

    It would also be possible to use item_teamflag as keys. The way that I would do this would be to put a point_proximity_sensor by the door. Its target would be the name of an item_teamflag. A logic_compare could then Enable or Disable a door-opening trigger_multiple based on the distance from the door to the flag. This is similar to the method described here.
     
    • Thanks Thanks x 2
  7. bob+M|M+

    bob+M|M+ L6: Sharp Member

    Messages:
    348
    Positive Ratings:
    185
    YESSSSS!! A Pseudo post! gonna give it a shot later tonight. much thanks!
     
  8. bob+M|M+

    bob+M|M+ L6: Sharp Member

    Messages:
    348
    Positive Ratings:
    185
    I like the first idea it works great for my situation.

    I may or may not do the sprite thing. I'll have to play around it, but right now it looks pretty fugly, not to mention very distracting from the player's point of view.

    [​IMG]

    the briefcase and logic_compare example was pretty cool too. probably won't use it this time, but I can think of a ton of useful scenarios where it would come in handy, for instance entrance doors to a 1on1 deathmatch arena
     
  9. Pseudo

    Pseudo L6: Sharp Member

    Messages:
    319
    Positive Ratings:
    149
    What I had in mind with the sprite was to make a custom material that was a picture of a key. You could also control the height of the sprite above the player's head so that the player's view wouldn't be obstructed. But if it's not important that other players know who has a key then a visual isn't needed.
     
  10. bob+M|M+

    bob+M|M+ L6: Sharp Member

    Messages:
    348
    Positive Ratings:
    185
    hmm, well I'm keeping my options open. The player would be given this sprite/key upon beating my jump map, so they can enter into a locked room near the beginning of the map. but a visual would be more of an indication of "hey look I beat the map" instead of "I got the key to open door"

    I was worried about performance loss from the sprite, but you mentioned that you could place it above the head so now that's a non-issue. and having a solid object instead of a world glow sprite seems like it would be better. I've never made any custom materials before, but maybe I can find something amongst the stock sprites.

    btw how would you go about positioning the sprite above the head?