Player "counting", and teleporting to selected places

Discussion in 'Mapping Questions & Discussion' started by takabuschik, Dec 23, 2014.

  1. takabuschik

    aa takabuschik

    Messages:
    660
    Positive Ratings:
    308
    I'm working on a map concept I just thought about, but in order to do some of the required things, I need to know how to "count" players- basically- I need to trigger a list of things, according to whether there is a player standing in an area or whether there is no player in there. I assume it's possible using a trigger_multiple, but I can only think of
    Code:
    OnStartTouch
    , and that's not enough, since that way I'll not be able to know if there's no players.

    The 2nd thing I need to know is how to make a logic thing that will have 4 options:
    [yes yes], [yes no], [no yes] and [no no], and according to those options will trigger the other (hopefully simpler to create) 4 parts of the logic system. I have no expirience in creating advanced logic things, so it might be something really easy to do, IDK.

    The last thing I need to know is how to set destinations for teleporters. I know how to set one destination to a teleporter but I need to be able to change it's destination according to certain conditions. Is it possible? if so, how?
    thanks in advance
     
  2. Muddy

    Server Staff Muddy Muddy

    Messages:
    2,372
    Positive Ratings:
    4,167
    Maybe use OnEndTouch to detect when there are no players?
     
  3. takabuschik

    aa takabuschik

    Messages:
    660
    Positive Ratings:
    308
    I'm pretty sure that OnEndTouch only works if there were players touching it in the first place.
     
  4. Beetle

    Beetle L9: Fashionable Member

    Messages:
    627
    Positive Ratings:
    141
    • Thanks Thanks x 1
  5. Egan

    aa Egan

    Messages:
    1,302
    Positive Ratings:
    1,478
    For the counting players:

    Yeah, as Ms Mudpie has said, you can use OnEndTouch to trigger something (like a math_counter subtract 1) when any player inside of the trigger leaves. However if you set the output to OnEndTouchAll then that output will only fire when all players inside the volume have left (OnStartTouchAll will only fire when the first person has entered the value). The same method is used for our regular spawn doors.

    [​IMG]

    For the compare values:

    You can use three logic_compare to get Yes-Yes Yes-No No-Yes & No-No:



    Here's a download to the .vmf file of the test map.

    For the teleporter destinations:

    If you turn off 'Smart Edit' on an entity property window you can see the actual names and values of the keyvalues on the entity. On a trigger_teleport the destination is set to the keyvalue of 'target', which you can modify mid-round using an addoutput command towards the entity.

    [​IMG]

    [​IMG]
     
    • Thanks Thanks x 1
    Last edited by a moderator: Aug 29, 2015
  6. UKCS-Alias

    aa UKCS-Alias Mann vs Machine... or... Mapper vs Meta?

    Messages:
    1,264
    Positive Ratings:
    748
    Instead of 3 logic_compares you can use a logic case instead.
    Trigger 1 only adds 1, trigger 2 adds 2 and optionaly trigger 3 adds 4 and trigger 4 adds 8.
    This would mean it can have a value of for example 10 which means trigger 2 and 4 are active (8+2). 7 would mean trigger 1,2 and 3 are active (4+2+1). This gives 16 possible scenarios (0-15) which can all fit into the logic case. And that case can be used to either activate the events itself or just trigger the relay (or relays).
    (and you would only need trigger 1 and 2 giving a cap of 3 and 4 possible events)

    This method is also more flexible since with the compares, for each new trigger you would have to add the number of triggers minus 1 (with 3 triggers you would end up with another 2 compares, with a 4th you get another 3). Where in the logic case method you would just add the later events to the list.

    Obviously, my example allows 4 triggers instead of just 2. For 2 triggers, it matters less but its still more efficient. However, once you reach over 4 triggers then this system becomes more complex as then you reached the limit of a single logic case. And this would require you to use a system that would be able to decide which logic_case needs to be fired. But its still more entity efficient.
     
    • Thanks Thanks x 1
    Last edited: Dec 23, 2014