Any entity pros out there?

Discussion in 'Mapping Questions & Discussion' started by bob+M|M+, Sep 25, 2008.

  1. bob+M|M+

    bob+M|M+ L6: Sharp Member

    Messages:
    348
    Positive Ratings:
    185
    I have a trigger, a red light, and a green light.

    The red light is on by default, but when the trigger is activated, the green light will turn on for 5 seconds, and then switch back to red.

    What I want to do is.. if the trigger is continuously activated, then the green light will remain on and never switch to red, but upon the last trigger, it will go back to red after 5 seconds.

    I'm stumped. If anyone can shed some light on me.. =D
     
  2. A Boojum Snark

    aa A Boojum Snark Toraipoddodezain Mazahabado

    Messages:
    4,767
    Positive Ratings:
    5,508
    Depends on what kind of trigger it is. If it's an actual brush trigger you can do it just like door triggers, using the OnStartTouch and OnEndTouchAll outputs. If it's some arbitrary 'trigger' that is making stuff happen, I think the easiest way would be to use a team_round_timer, have it turn the light green when it reaches 0, and whenever your 'trigger' occurs force the timer to five seconds.
     
    • Thanks Thanks x 1
  3. bob+M|M+

    bob+M|M+ L6: Sharp Member

    Messages:
    348
    Positive Ratings:
    185
    I'm using a func_breakable that is activated by OnBreak. I have to use this entity cause it's the only one that physic objects can trigger (I believe?) without needing to cause damage.

    So I can't use OnStartTouch or OnEndTouchAll.

    team_round_timer won't work because I'll have several of these setups all over my map doing their own thing.

    Guess I should have mentioned those things huh?
     
    Last edited: Sep 25, 2008
  4. A Boojum Snark

    aa A Boojum Snark Toraipoddodezain Mazahabado

    Messages:
    4,767
    Positive Ratings:
    5,508
    Trigger_multiple (or _once, since breakables are one time things) have flags to determine what can trigger them, including physobjs. Though I'm not sure how you are using those in TF2 and/or if it's only those or some other method of triggering too.

    As far as I know there isn't a limit to team_round_timers, however logic_relay is an alternative for that method. Have the triggering event issue a CancelPending to the relay, and 0.1 seconds later activate the relay, which will turn the light red in 4.9 seconds. This should allow the trigger event to happen in succession while not letting the light turn red until everything is finished.
    (unless you meant you can't use t_r_t because you want to keep entity counts down due to lots of these setups?)
     
    • Thanks Thanks x 2
  5. bob+M|M+

    bob+M|M+ L6: Sharp Member

    Messages:
    348
    Positive Ratings:
    185
    oh if multiple team_round_timers are possible then that would work I suppose. I had the impression that this entity was only for the time limit of the map.

    If that doesn't work I'll try your other suggestion. Thanks!

    btw, triggeR_multiple and trigger_once cannot be activated by physics objects despite having a "physics object" flag.
     
  6. bob+M|M+

    bob+M|M+ L6: Sharp Member

    Messages:
    348
    Positive Ratings:
    185
    It's a little buggy during setup time, I gotta figure it out, but otherwise team_round_timer works great. Tried with multiple setups and its perfect. Thanks again Boojum.
     
  7. Apom

    Apom L6: Sharp Member

    Messages:
    366
    Positive Ratings:
    62
    Use logic_timer for this, it's much more appropriate and it's very easy to do what you want with it (set 5 second as duration, make it enable + reset when your trigger event happens, and make it disable itself on its own OnTimer event).

    PS: you originally wanted the event to be triggered multiple times, but then you say it's triggered by OnBreak. I'm curious, how is that possible? I mean, once it's broken it's broken :D
     
  8. bob+M|M+

    bob+M|M+ L6: Sharp Member

    Messages:
    348
    Positive Ratings:
    185
    The problem with logic_timer is it has no SetMaxTime sort of function like team_round_timer has, so I would have to disable and enable it, which means there would be a short fraction of a second where it would turn red.

    As for multiple func_breakables, I simply make the brush respawn itself after its broken by using OnBreak to target an env_entity_maker which spawns a point_template that respawns the func_breakable.

    (I could use a shorter way, by avoiding the env_entity_maker and only using the point_template but it was buggy and crashing my game)
     
  9. Apom

    Apom L6: Sharp Member

    Messages:
    366
    Positive Ratings:
    62
    Even if this was the case, there wouldn't be red time, because what turns the light red is the OnTimer event, which is not fired when you disable the entity. Not to mention that this fraction of second would anyways be considerably shorter than a screen frame so players wouldn't notice it.

    Anyways, you don't need to disable anything, you only need to reset the timer (with ResetTimer, an adequately named input).
     
  10. FaTony

    FaTony Banned

    Messages:
    902
    Positive Ratings:
    160
    Func_button instead of func_breakable.