Forum rules - please read before posting.

Timer based missions

Hi,
I've been doing a bit of research and there is even one thread that's very similar to mine but I can't seem to solve this. So sorry if making a new thread but need help.
So I want an object to re-appear a few seconds after you hit the button.
i think i've set it correctly based on reading a few threads.

So I created a global integer that is called timer then I set an ActionList that runs in background. I set the global timer variable to be increased by 1 and do an engine wait of 1 and loop it.

Now in the action, when the player use the button, I set the timer ActionList to run from start and I can see the integer being added by 1 every second. Then I do a variable check, and when the global timer is equal to 10, it set the object to be invisible and kill the ActionList timer and set the global timer integer back to 0.

But it doesn't do anything. I keep reading other posts and seems like I'm doing it right. Am I missing something?
Sorry I tried my best not to post but I can't figure out what's wrong.

Thanks in advance

Comments

  • Ahh, I got it.
    It's because the use event does not run in background, so whatever I have to set as invisible has to be set at the ActionList timer.
    So if I have multiple doors that uses the same action, I can't just duplicate but have to create each one?
    thanks

  • Though it may be for reasons unexplained, just going by what you've described, a timer variable may not be strictly necessary.

    An Engine: Wait Action in an ActionList that runs in the background will simply act like a timer - so you can end such a list with a call to e.g. reset the button, or whatever you want to occur once the timer ends.

    If the player does something while this timer is running, and you want to cancel the timer, you can use the ActionList: Kill Action to stop it from running before it runs those "reset" Actions.

    For multiple doors, and recycling game logic in general, you'll want to look into using ActionList parameters - which allow you to alter ActionList fields at runtime so that a single list can affect different things. I'd recommend first getting a single door behaving the way you want, but check out the Manual's "ActionList parameters" chapter as well as this tutorial.

    When dealing with parmemeter and recyeling game logic, also know that it's best to rely on Component variables, rather than Global variables, where possible. You can create Component variables by attaching a Variables component to a GameObject, so that its variables are unique to that object, which is easier when prefabbing since you don't then need to make a new Global Variable for each instance of the object.

  • Chris, thanks so much.
    I followed your instructions and duh, why didn't I think of that? There is no need to do a timer and just set engine wait and run in background for the number of seconds I need. There are different doors, I just create 2 types of length and assign to the doors that auto close the right time and it's that easy.
    I follow your ActionList parameters and it's such a life saver. I keep doing the same action again and again and this helps a lot. Yes I should have follow your 2D/3D tutorials first before tackling this.
    Thanks so much for patiently replying to all our questions, even no matter how many times it's been asked.
    Thank you so much and sorry beforehand if I'll probably ask another questions sometime down the road again. But thanks a lot, AC is awesome.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.