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.

Broken ice event, how do I do this? >.<

I try to create a event that when you step on it then it looks broken and if you step on it twice you go back to the beginning and the event returns to page 1 again, the problem is: how do I make all events on the map return to page 1 at the same time? >.<
 

poccil

Sponsor

I will assume you are trying to make the player move to a different map (since it would cause the player to fall down).  I have developed temporary self-switches (with the script that gratheo gave)  that are reset as soon as the player leaves the map.  It would consist of two event pages:

Event Page 1
Condition: (none)
Trigger: Player Touch
Options: Through
Graphic: (normal floor)
Code:
setTempSwitchOn("A")

Event Page 2
Condition: Switch tsOn?("A") is ON
Trigger: Player Touch
Options: Through
Graphic: (cracked floor)
Code:
<<Change graphic to broken floor>>
Wait: 10 frame(s)
Transfer Player:[000: ???], (???,???)

(Note that one of the conditions checks the temporary self switch.)

If, however, you want the player to stay on the same map, then a different approach, like the one below, is needed.  In addition to my temporary self switch script above, you can add the following script section:

Code:
class Interpreter
 def resetSwitches(eventname)
  for event in $game_map.events.values
   if event.name==eventname
    event.setTempSwitchOff("A")
    event.setTempSwitchOff("B")
   end
  end
 end
end

The script resetSwitches will reset temporary self-switches A and B of all events with a specified name; for example, all events named "BreakableIce" on the map.  To use it, add a Script event command consisting of, for example:

Code:
resetSwitches("BreakableIce")

(My script defines a _name_ method on Game_Event, which is not present by default.)

The second event page's command list could then be changed to:

Code:
<<Change graphic to broken floor>>
Wait: 10 frame(s)
Script:  resetSwitches("BreakableIce")
Transfer Player:[000: ???], (???,???)

I hope this helps.
 

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