Question: <--Trigger noob

Discussion in 'Mapping Questions & Discussion' started by DJive, Jan 28, 2008.

  1. DJive

    aa DJive Cake or Death?

    Messages:
    1,466
    Positive Ratings:
    740
    I'm a brush work guy, triggers aren't my thing =(

    I had an idea spawning from this thread from MilkToast.

    http://tf2maps.net/showthread.php?t=498

    IE a objective being pushed, Attack/defend.

    I'm sure with triggers, about anything is possible... I want to create attack/defend CP map. The map will be 90% push, and at the end you have to capture the point to win.

    Thing is the thing im not sure on is.. I want them to push the "stairs" to a canon, once the "stairs" are at the canon, the canon door will "open" to allow players to shoot up to the capture point on the rock wall. Trigger question is can i have a door on the canon that will only open when the "stairs" are next to it?
     
  2. trackhed

    trackhed L3: Member

    Messages:
    106
    Positive Ratings:
    2
    very possible.

    i'd assume you'd not be having the team physically "push" the stairs, so youll be using move_track, which will involve using a trigger to:

    1. make the stairs "push" as your team is close
    2. maybe go faster as more mates show up
    3. stop when opposing team are near stairs

    so once youve reached your track's end, you could definitely trigger a door.
     
  3. Jive Turkey

    Jive Turkey L3: Member

    Messages:
    120
    Positive Ratings:
    32
    I started a mine cart pushing map (now on hold now until Valve releases their official mine cart game mode) that had a similar idea as this.

    First the movable object is a func_tracktrain with an appropriate set of path_tracks to determine the path of motion. Set it's flags to "unblockable by player" because its motion is going to be determined by another entity.

    I put two trigger_multiples on either side of the train, parented to it so they move along with it and shaped appropriately so that someone would have to walk up against their respective side to move the object. Furthermore, you may or may not want to limit these triggers to their respective team to prevent someone from griefing their team or just accidentally moving in the wrong direction.

    I then have one trigger_multiple's OnStartTouch add 1 to a math_counter, and it's OnEndTouch subtract 1 from the math_counter. Similarly, the other trigger_multiple would do the opposite, subtracting 1 on it's OnStartTouch and adding 1 it's OnEndTouch. I send this math_counter's value to a logic_compare entity.

    I then have a logic_timer, with a very small wait interval, which repeatedly evaluates the logic_compare. The logic_compare's outputs are the following: OnEqualTo calls the func_tracktrain's Stop input, OnGreaterThan calls the func_tracktrain's StartForward input, and OnLessThan calls the func_tracktrain's StartBackward input. Note, depending on how you oriented the train and setup your triggers, you will of course have to figure which is the appropriate way to move for a positive amount in the logic_compare and switch the inputs accordingly.

    What all this crazy talk does is that the train will move in whatever direction has the most players pushing on their respective trigger. So a deadlock will result when equal amounts of players are pushing either side. You may or may not want to set a min/max on how many players can affect a trigger, if only for clarity. I experimented with using a math_remap to convert the math_counter's value into a proper speed range for the train so it would move faster when more players were pushing on it, but there are some serious issues with the func_tracktrain's motion, ie. it's broken and unwieldy. I have found the SetSpeed inputs to be unreliable, in particular SetSpeedDir would oscillate pos/neg for no apparent reason.

    Also, see this thread for information on an issue with making the thing reverse properly. Essentially, you have to explicitly set the speed of all path_tracks, which removes the possibility of setting the train speed manually anyway. I suspect you can simply put in some inaccessible dummy path_tracks at the ends of the track and play around with which ones need their speed set and which don't, but I was tired of messing with it at that point. Easiest way is to just pick a good speed and have them all use that same speed, although it could be interesting if the train sped up or slowed down at odd points, possibly along inclines. Lot of interesting things you could do, but be careful as func_tracktrains aren't the most well behaved entities.
     
  4. Jive Turkey

    Jive Turkey L3: Member

    Messages:
    120
    Positive Ratings:
    32
    Also note that there may be issues with players getting stuck in the train. I haven't tested this thing online so I don't know how much lag will affect things but I'm pretty sure if you don't have the train rotate and just keep the track linear then you won't have problems.