Manual Defeat / Gameover

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
577
Reaction score
219
First Language
English
Primarily Uses
RMVXA
Manual Defeat
by: Rinobi

This script allows automatic gameovers to be disabled via switch.
It functions within all applicable scenes and includes an additional switch to disable in-battle victories.

A simplistic yet powerful tool.

See script header for details.



Code:
module RINOBI module ManualDefeat
#==============================================================================
# # MANUAL DEFEAT
# -----------------------------------------------------------------------------
# 1.0 [09/04/2017] Completed
#-
# This script allows you to disable gameovers via switch. It functions within
# any scene and includes an addtional switch to disable battle victories. This
# is a simple but powerful tool in the right hands.
#==============================================================================
# # TERMS OF USE
#------------------------------------------------------------------------------
# 1. Preserve this header.
# 2. Do not re-upload this script.
# 3. Do not claim this script as your own work.
# 4. Do not release modified versions of this script.
#==============================================================================
# # SETTINGS
# -----------------------------------------------------------------------------
# Adjust the below settings to your liking.
  
    #======================================================================
    # >> Victory Defeat Switches
    # ---------------------------------------------------------------------
    # Adjust the below to a number representing global switches.
    #======================================================================
      VictorySwitch  = 21   # When true, In-battle victories do not occur.
      DefeatSwitch   = 22   # When true, Gameover does not occur death.
  
#==============================================================================
#                             END OF SETTINGS
#==============================================================================
end end
#==============================================================================
# ** IMPORT SCRIPT
#------------------------------------------------------------------------------
$imported = {} if $imported.nil?
$imported[:RIN_ManualDefeat] = true
#==============================================================================
# ** BattleManager
#------------------------------------------------------------------------------
#  This module manages battle progress.
#==============================================================================
module BattleManager
  #--------------------------------------------------------------------------
  # * Overwrite: Determine Win/Loss Results
  #--------------------------------------------------------------------------
  def self.judge_win_loss
    if @phase
      if !$game_switches[RINOBI::ManualDefeat::DefeatSwitch]
      return process_abort   if $game_party.members.empty?
      return process_defeat  if $game_party.all_dead? end
      if !$game_switches[RINOBI::ManualDefeat::VictorySwitch]
      return process_victory if $game_troop.all_dead? end
      return process_abort   if aborting?
    end
    return false
  end
  #--------------------------------------------------------------------------
  # * Overwrite: Determine if Game Is Over
  #   Transition to the game over screen if the entire party is dead.
  #--------------------------------------------------------------------------
  def check_gameover
    if !game_switches[RINOBI::ManualDefeat::DefeatSwitch]
    SceneManager.goto(Scene_Gameover) if $game_party.all_dead? end
  end
end
  • [09/04/2017] Public Release.
Free for Commercial Use with given credit.
See script header for additional information.
 

Attachments

Last edited:

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,402
Reaction score
499
First Language
English
Primarily Uses
RMVXA
Pretty awesome. I have an idea where I will use this in my game. Thanks
 

Cougarmint

Veteran
Veteran
Joined
Sep 19, 2017
Messages
35
Reaction score
14
First Language
English
Primarily Uses
RMVXA
This is probably going to solve a lot of problems for my custom Game Over (Retry) System. Just one question: I don't need the victory switch, so if I set that to 0, I can disable that, right?

I was testing your script and I found a bug!

Code:
def self.judge_win_loss
    if @phase
      if !$game_switches[RINOBI::ManualDefeat::DefeatSwitch]
      return process_abort   if $game_party.members.empty?
      return process_defeat  if $game_party.all_dead? end
      if !$game_switches[RINOBI::ManualDefeat::VictorySwitch]
      return process_victory if $game_troop.all_dead? end
      return process_abort   if aborting?
    end
    return false
  end
You have an ! in these two spots. That means if the switch is OFF, then your override kicks in. If you remove the !, then they will only kick in when the switch is ON. Just thought I'd give you a heads up on that.
 
Last edited:

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
577
Reaction score
219
First Language
English
Primarily Uses
RMVXA
@Cougarmint Thanks for the heads up, I'll give the script another look when I'm off.

@Cougarmint The script appears to be working as intended, and yes, setting the switch to 0 is fine. Are you any having issues? To be clear, having to turn the selected switch on to disable automatic gameovers and/or victories is the intended design.
 
Last edited:

Cougarmint

Veteran
Veteran
Joined
Sep 19, 2017
Messages
35
Reaction score
14
First Language
English
Primarily Uses
RMVXA
Yes -- as I said in the above post, I had to remove the ! from the first part (the part I mentioned above) to get it to work right; otherwise it kept triggering game overs even when the switch was on. In fact, when I ran the script with "Even if Defeat" on, it ran the event as normal then went to game over.

The second issue I'm having is that upon defeat, I have a switch that is set to turn on upon the party losing (when health is at 0), but the switch is not turning on. That switch is what triggers my custom game over common event. It also overrides it as such that if I have a scripted battle sequence that allows the player to continue after defeat, that part doesn't go off either. Any suggestions as to what I may be doing wrong?
 
Last edited:

Rinobi

Veteran
Veteran
Joined
Mar 24, 2014
Messages
577
Reaction score
219
First Language
English
Primarily Uses
RMVXA
@Cougarmint Well... that bug you found wasn't actually a bug, by modifying the script you've reversed its intended function. Turning the switch on would enable gameovers/victories. Use a fresh version of the script and check your previous event for errors. The second problem you're having will probably resolve itself by using the original script.
 
Last edited:

Cougarmint

Veteran
Veteran
Joined
Sep 19, 2017
Messages
35
Reaction score
14
First Language
English
Primarily Uses
RMVXA
I am going to. I also found a bug with my original event as well, I will look at it in more detail.

However, in my messing around I also inadvertently stumbled on the Scene_BattleManager and modded it to basically trigger an alternate to the game over anyway. I wish I had found that sooner. In anycase, let me give it a go and see if it was just the event itself being the problem. <3

I just tested it, and it allowed my original event to go through, but went to game over right after. I don't know what I'm doing wrong; I think I may have to put a revive on the player or something. As I said before though, I just edited the scene_BattleManager and overrode the game over from that end, so I will just use that. I have other custom scripts and such installed as well so it could be in conflict with one of those, now that I think about it.

This is a nice script though; I'm sorry to put you through the trouble.
 
Last edited:

Maggatron

Warper
Member
Joined
Mar 19, 2019
Messages
2
Reaction score
1
First Language
English
Primarily Uses
RMVXA
Um, this might be kind of a newbie question, but where in the Script do I put this? I know under Modules, then in BattleManager, but what line? (I'm sorry, I'm still really bad at coding and scripting for myself atm...)
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,098
Reaction score
11,442
First Language
English
Primarily Uses
RMVXA
@Maggatron You do not put this anywhere inside another script. Scripts need to go under Materials and above Main, in their own, named, slot. Please read this post by Andar which will help you to understand how to use script.
 

Maggatron

Warper
Member
Joined
Mar 19, 2019
Messages
2
Reaction score
1
First Language
English
Primarily Uses
RMVXA
@Maggatron You do not put this anywhere inside another script. Scripts need to go under Materials and above Main, in their own, named, slot. Please read this post by Andar which will help you to understand how to use script.
Oh, thank you so much! I'm still really new to using RPG Maker VX Ace, but I'm loving it so far! Thank you! :3
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Finally finished my first big game since joining the forums! Please check out Petal Knights! https://forums.rpgmakerweb.com/index.php?threads/petal-knights-playable-now.117898/
Back home now :cutesmile:

Many thanks to all my fellow game devs. for all the support during this crazy time.

Feeling a bit rough but much better then bein' hospitalized at least.

Now time to get back to the code :D
Added skill ranges, and very basic implementation of scope, with a rule called "empty tile" that simply returns true if the selected tile is empty (has a battler), and false otherwise


This means movement range and attack ranges are all automatically implemented.

More info: https://himeworks.itch.io/grid-battle-system/devlog/167442/devlog-3-basic-skill-range
Stone masons are hard at work creating beautiful sculptures for your games...
When you realize @Kupotepo is a champion among RM Web users, and it all makes sense now:

Forum statistics

Threads
100,465
Messages
976,273
Members
132,082
Latest member
nwr
Top