If this has been posted a billion times, I'm sorry. I just figured it out, so I'm posting it.
When you walk on a trigger, a hud text pops up. a few seconds later a different text pops up. then a different text, and so on until you're satisfied.
OR, you step on a trigger and text pops. you stop on it again, and different text pops.. and so on. e.g. "Hi Bob!" ... "Back again?" etc.
I'm using this for my intro text.. "You wake up..." "where are you?" "You're naked." "Where'd this tattoo come from?" and so on..
place a timer named text_timer, set the interval to 1, UNCHECK the timer box (so it won't start on it's own), leave self disable UNCHECKED (so it won't stop between hudPrints).
place a counter named text_counter, set to 6. (don't need to do anything else with it)
in the script_entity:
Code: Select all
function counterText() text_counter.counter:getValue() --see what number the counter is on if text_counter.counter:getValue()==5 then --if it's 5 say something hudPrint("FIVE!") else --if not, see if it's 4, and so on. if text_counter.counter:getValue()==4 then hudPrint("FOUR!") else if text_counter.counter:getValue()==3 then hudPrint("THREE!") else if text_counter.counter:getValue()==2 then hudPrint("TWO!") else if text_counter.counter:getValue()==1 then hudPrint("ONE!") else text_counter.counter:setValue(6) --if it's at zero, reset the counter to 5 text_timer.timer:stop() --stop the timer playSound("secret") --TA DA! end end end end end end
Link the floor tigger to the TIMER (on activate ---> text_timer ---> start)
Link the timer to the COUNTER (on activate ---> text_counter ---> decrement)
Link the timer to the SCRIPT (on activate ---> script_entity ---> counterText()
alternatively, you can use the counter to reset itself and stop the timer using the connectors, but seeing the code helps me to undertand what else can be done.
I suppose you could just make a variable too, instead of using the counter at all, but hey, whatever right?
If you want to have it say somthing every time you step on the floor_trigger, you just need to set "self deactivate" on the timer, but NOT on the floor_trigger (otherwise it only shoots once).
hudPrint could just as easily be moving a teleporter around a room, or opening and closing doors in a maze, or whatever.
hope someone finds that useful.