Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Timer event!

I want an event that runs 30 seconds then when the 30 seconds are up an item in the inventory disapears. heres the events i used.

@> Conditional Branch: [Stick] in inventory
  @> Text: You light the stick on fire!
  @> Change items: [Stick] -1
  @> Change items: [Flaming stick] +1
  @>Text Better hurry up or the stick will burn up!
  @>Control timer Start up (0 min. 10 sec.)
  @> Conditional Branch Timer 0 min 1 sec or less
      @> Change items: [Flaming stick] -1
      @>
    :  Else
      @>
    :  Branch End
    @>
:  Else
    @> If you had a stick you could light it and burn something
  @>
:  Branch End
@>
I put all that and when the timer gets to 1 second then 0 seconds the timer just stays up and the item is not deleted...
 
I see your problem.  Let me explain:

Conditional branch:  [Stick] in inventory.  At this point, it's checking if you have a stick in your inventory.  If you don't, nothing else in the "yes" branch will happen.

Change Items:  [Stick] -1  You no longer have a stick in your inventory.

...

Conditional Branch Timer 1 sec or less  And here's the problem.  This is part of the first conditional branch.

Else...

Basically, you've got two problems here. 

1:  The check for the timer is part of the "Yes" conditional branch of the event.  In other words, it only checks the timer if you have a normal stick in your inventory.  But it also removes a stick from your inventory, which means that if you just lit your last stick, it's never going to check the timer.

2:  Also, the whole timer-checking event is a part of the lighting the stick event.  Presumably, that event isn't a continual parallel process, or it'd be telling you that if you had a stick you could light it, constantly.  Thus, it's not going to check the status of the timer unless you try to light your stick once again.

You need to make the timer part of the event a separate, parallel-process event-- perhaps a common event, perhaps not, depending on your needs.  Rather than having the conditional branch check the timer, have it turn a switch [Flaming Stick] ON, and have that be the condition that activates the parallel-process event.  (Said event will check the timer, and remove the flaming stick and turn the switch back off.)

Did that help?
 
:crazy: what im trying to do is make the stick be turned into the flaming stick by creating 2 items [stick] and [flaming stick] when i have a stick it destroys the [stuck] and gives me the [flaming stick]  so as soon as i light the stick it can only burn for 10 seconds then be destroyed i want a timer to apear so the player knows when the stick is going to be put out would  someone modify my event script so i can put it to mine just tell me the events in order because i never used a timer event :|
 
Okay, I can clarify this, I suppose:

@> Conditional Branch: [Stick] in inventory
  @> Text: You light the stick on fire!
  @> Change items: [Stick] -1
  @> Change items: [Flaming stick] +1
  @>Text Better hurry up or the stick will burn up!
  @>Control timer Start up (0 min. 10 sec.)
  @> Control Switches: [099: Flaming Stick]=ON
:  Else
    @> If you had a stick you could light it and burn something
  @>
:  Branch End
@>

And then you create the following Common Event, Parallel Process, Condition:  Switch 099:  Flaming Stick

@> Conditional Branch Timer 0 min 1 sec or less
      @> Change items: [Flaming stick] -1
      @> Control Switches:  [099: Flaming Stick]=OFF
      @> Control Timer:  OFF
      @>
    :  Else
      @>
    :  Branch End

Although I think you'd do well to read over my explanation of why it works this way.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top