How do I make delays between firing outputs?

Discussion in 'Mapping Questions & Discussion' started by Niodyne, Nov 28, 2009.

  1. Niodyne

    Niodyne L1: Registered

    Positive Ratings:
    Hey I'm kinda new to this and almost got a path_track and multiple tracktrain setup finished, but need a little help.

    Just a note here, I'm not referring to the "after a delay in seconds of" box under outputs.

    I have a path_track that teleports (using TeleportToPathTrack) the !activator (a tracktrain) of whatever hits it back to the beginning. I want it to only teleport one thing at a time and have a delay of five seconds between teleporting each tracktain.

    The reason for this is my multiple tracktrains may, intentionally, get stacked up at this path_track, and I want them spread out when they restart at the beginning. Simply adding "after a delay in seconds" can still cause multiple to be teleported through at once and whatnot.

    Also, whatever the solution, it needs to preserve the !activator (or similar command) for being teleported I think. Not sure if I should be using a trigger_multiple or something instead...?

    Thanks for any help. Let me know if I need to add more info.


    I think I should say a little more. There are various ways I could do it.

    My tracktrains follow random paths and can overlap, which is intended, and when they get to the end they need to restart. At some point between teleporting to the beginning and leaving the first path_track they restart on, they need to get spread back out. If I could make a "gate" that lets one tracktrain leave the first path_track every six seconds, that could work.

    I have no clue how to have an output select/allow one tracktrain out of a group that is stacked together though.
    Last edited: Nov 29, 2009
  2. DaBeatzProject

    aa DaBeatzProject

    Positive Ratings:
    On your last path track (the teleport "entrance", THIS one), fill in these outputs:
    OnTeleportToPathTrack - *the last path track, so THIS one* - disable - 0
    OnTeleportToPathTrack - *the last path trach, so THIS one* - enable - 5

    Ta-dah!. I bet it's not gonna work, but you can give it a try.
  3. Niodyne

    Niodyne L1: Registered

    Positive Ratings:
    Thanks for the suggestion, but looks likes it doesn't like the commands. Disable and Enable don't seem to work on path tracks.

    If there is a way to make the tracktrains alternate between taking the main path and an alternate one, I could have it send one down the main path, switch to a fake alternative for 5 seconds, and the switch back, rinse repeat. Not sure if I can only send one off before switching to the alt track if there are 3 waiting on path1. Order doesn't matter. Not sure how to select them in outputs tab as "targets" once they have landed and stopped.

    /edit I may have a partial solution. If I bounce them between path 1 and an alternate path a few units away, then have them trigger (OnPass) the main path to open for 0.01 seconds, it might just let one through at a time and bounce the rest back to the alt path. I would however, need to limit the OnPass FireUser1 to only fire once every 5 seconds no matter how many OnPass events occur and not increase or reset the timer with each OnPass.

    Not 100% sure if only one would get though or if they would stack up. Can I limit FireUser1 correctly with a logic timer? Not sure.
    Last edited: Nov 29, 2009
  4. Niodyne

    Niodyne L1: Registered

    Positive Ratings:
    New day, new tries.

    So I thought if I made a logic branch (LB) that had:
    Starts on 0 (false)
    OnFalse LB FireUser1
    OnUser1 path FireUser1
    OnUser1 LB toggle
    OnUser1 LB toggle 5 second delay.

    And a path:
    OnPass LB Test

    and either
    OnUser1 !activator teleportcommand
    OnUser1 path togglealtpath
    OnUser1 path togglealtpath 0.01 second delay
    (and tried variations with enable/disable alt path)

    None of it worked. The path always sent stuff down the main path. The teleport never teleported (not sure if the !activator was the tracktrain or something else).

    Anyone know about logic branches and if I set it up properly? Maybe my LBs were broken?

    /edit I tried some neater stuff with Logic_Branch and the path or tracktrain, trying to either send them out one at a time or teleport the tracktrain out of a holding area one at a time, with the same LB logic as I used before. Nothing worked. Maybe Logic_Branch doesn't refresh/compute/whatever fast enough for objects pinging it a lot?
    Last edited: Nov 30, 2009
  5. Niodyne

    Niodyne L1: Registered

    Positive Ratings:
    Hope no one minds me bumping this with another update...

    I made some progress. Realized !caller didn't signal my tracktrain when a tracktrain tests a LB. !activator works, not sure if it refers to the "test" command or the original OnPass it set off.

    Ok so, on a path_track no one sees before everything restarts I have:
    OnPass !activator FireUser1

    On the tracktrain activators I have:
    OnUser1 !self Stop
    OnUser1 LB (logic branch) Test
    OnUser2 !self StartForward 1 second delay (in case stop interferes)

    On the Logic Branch we have:
    OnFalse !self FireUser1
    OnTrue !activator FireUser1 1 second delay (to force recheck of LB after 1 second)
    OnUser1 !self Toggle
    OnUser1 !activator FireUser2 (could probably just be startforward)
    OnUser1 LT (logic timer) ResetTimer

    On the Logic Timer we have:
    6 second count down
    OnTimer LB setvalue 0

    So right now with initial testing on two tracktrains, my second tracktrain to hit this path_track will keep increasing its distance from the first, which is bad. I need a constant distance. It could also maybe be simpler. Still needs more testing too.

    /final edit

    In case anyone finds this looking to do something similar, here's the final answer:
    Create one of each thing you want to move and name them all; ie tracktrain and the stuff connected to the tracktrain. Set it all up so it moves as you want it to (initial path, etc).
    Create 1 point_template, env_entity_maker, logic_timer, and possibly logic_case.
    Put each moving object (and tracktrain) as a separate entry in the point_template using the object's name. I think preserve entity names in the flags tab of the point_template needs to be off(?).
    Hook it to the env_entity_maker and use the logic_timer to forcespawn on the env_entity_maker
    Setup any initial conditions (might need startforward and !activator, OnSpawn).

    And... it will work perfectly. Each time something is spawned it'll follow the path tracks. Be sure to kill everything at the end of the path_tracks. Here's a guide for it.
    Last edited: Dec 14, 2009