set an event trigger to a specific amount of time

0 favourites
  • 4 posts
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • Hi,

    I want to setup an if statement so that if nothing is happening then a new event will start.

    At the moment i have two global variables, onscreen and counter.

    When nothing is happening both these would be at zero. What i want to do is set an if statement that says

    'if counter is equal to or less than 0 and onscreen is equal to or less than 0 for 5 seconds' = then activate next group.

    It has to be 5 seconds because there are points within a standard group event sequence when both variables might equal zero but that group isnt over with so i want to make sure a new event only occurs when a group is finished.

    If anyway can say whether that if statement is possible and which system events to use would be useful thanks.

  • Try this:

    Global number time_true = 0

    + Counter <= 0

    + Onscreen <= 0

    -> Add dt to time_true

    + Else (in the latest beta)

    -> Set time_true to 0

    + time_true >= 5

    + Trigger once

    -> Do something

    Basically this counts up time_true while the event is true, and resets to zero if the event is not true. Once the time_true reaches 5 (seconds), you can then run an event.

  • hi thanks that works, but i need to add a third condition to it... there is a text box that occasionally appears in the game, so i want to add the condition And when textbox is off screen.

    I can see a system command Textbox is on screen (test if the object is ont he visible screen)

    Is there an opposite to this. so that it tests if the object is not on the visible screen. So that the final list of commands would be:

    + Counter <= 0

    + Onscreen <= 0

    + Textbox is not on screen

    -> Add dt to time_true

    + Else (in the latest beta)

    -> Set time_true to 0

    + time_true >= 5

    + Trigger once

    -> Do something

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi, In case this helps someone else, I had forgotten that when you add a conditional event to the event sheet that you could right click on the event and click invert to make it the opposite. Obviously I was haveing a dumb moment as that is what i needed above.

    So the final event sheet would be:

    + Counter <= 0

    + Onscreen <= 0

    + Textbox is on screen (inverted)

    -> Add dt to time_true

    + Else (in the latest beta)

    -> Set time_true to 0

    + time_true >= 5

    + Trigger once

    -> Do something

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)