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.

[RMXP] Call common event on death

Introduction

Call a common event instead of a gameover on death.

Use this if you want to show a conversation, or do something else, on dying, controlled using a common event. You can use the gameover event command if you want to gameover as usual at the end of it.

Script

Code:
#===============================================================================

# Call common event on battle. By Amy @ [url=http://www.hbgames.org]http://www.hbgames.org[/url]

#===============================================================================

class Scene_Battle

  

  # Set this to the common event you wish to call.  

  EVENT_ID = 2

  

  alias :amy_judge :judge

  

  # Judge, aliased to amy_judge

  def judge

    old_judge = amy_judge    

    

    # If we're in a gameover and not a "can lose" battle

    if $game_temp.gameover and !$game_temp.battle_can_lose

      # Get the common event

      battle_event = $data_common_events[EVENT_ID]

      # Call the interpreter for this event

      $game_system.battle_interpreter.setup(battle_event.list, 0)

      # No longer a game over!

      $game_temp.gameover = false

      return

    end

    

    # Otherwise, call the former method

    return old_judge

  end

end

Instructions

Paste above main. Change EVENT_ID to the number of the common event you want to use.

Credits

None necessary.
 

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