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.

Freezing all movement from a common event...

I have a common event that controls popup messages throughout the game, it is set to parallel process and runs all game long. It will alert the player upon learning new skills, new journal entries etc... My problem is that if you level up during battle (using XAS) the other enemies are still free to move + attack you during the alert. I need some way for all events to pause until the alert is read, and that's where I need yoooz.
 

poccil

Sponsor

Here's a solution.  Put the following code in a new script section just before the last one:
Code:
def pbGlobalLock
 for event in $game_map.events.values
   dir=event.direction
   event.lock
   event.turn_down if dir==2
   event.turn_left if dir==4
   event.turn_right if dir==6
   event.turn_up if dir==8
 end
end

def pbGlobalUnlock
 for event in $game_map.events.values
   event.unlock
 end
end

Then, at the beginning of the common event, add a Script event command consisting of the text "pbGlobalLock".  At the end of the common event, add a Script event command consisting of the text "pbGlobalUnlock".

The solution above was tested on a blank project.  It may not work as expected if a script moves the enemies on their own.  Please tell me how it works.
 
Thanks for the scriplet :thumb: I'll give it a shot and see how it works across different scenarios.

EDIT: So far so good, it freezes all movement but still plays animations which is great.
 

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