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.

Enemy Respawn

Okay.  Can someone please create a script that would make an enemy disappear for about 45 frames after being beaten, and then suddenly respawn somewhere around where it started?  This would be a great help to me.  Thanks a lot!
 

poccil

Sponsor

This approach is similar to the one I gave in "cooldown" events, where an event becomes
inactive for a certain amount of time.  See this page.
For convenience, I will write something similar to make it apply to your case.

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
Graphic: --Enemy character--

Battle Processing: ???
If Win
  Script:  setEventTime; setTempSwitchOff("A")
End

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
Graphic: None

-- Can contain no event commands --

This event page is used in cases when the event is currently "inactive".

Event Page 3

Condition 'Switch "s:cooledDown?(50)" is ON'; Self Switch A is ON
Autorun trigger
Graphic: --Enemy character--

-- Respawn event here --
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