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.

Cooldown Events?

Is there a way I can make event's have cooldowns? for example If I used a crystal that would heal, the crystal wouldn't be able to heal me again for 50 seconds.
 

poccil

Sponsor

Use my script for script-based switches for this.  Also
add this to a new script section.

Code:
class Game_Event
def cooledDown?(seconds)
  if !(expired?(seconds) && tsOff?("A"))
     self.need_refresh=true
     return false
  else
     return true
  end
end
end

Here's the basic structure you should follow.

Event Page 1

No conditions, any trigger

-- Do something here
Script:  setEventTime     

The script setEventTime sets the event's variable to the current time, so that later the game
can check whether the event "expires" and returns to normal. setEventTime can also be used to
set other events' variables to the current time. For example, setEventTime(2) sets this event
and the event numbered 2 on this map.

Event Page 2

Condition "Self Switch A is ON", any trigger

-- Do something here

This event page is used in cases when the event is currently "inactive"; for example, in the
case of a tree that grows berries every day, there could be a message here that the tree is empty.

Event Page 3

Condition 'Switch "s:cooledDown?(50)" is ON', Autorun trigger

Control Self Switch: A =OFF
Script:  setTempSwitchOn("A")

This event page checks whether the event has expired and becomes active again.  In this case,
after 50 seconds.
 

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