+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+---- Forum: RPGMaker XP (RGSS) Engine (https://www.save-point.org/forum-116.html)
+---- Thread: Battler : Dead When SP 0 (/thread-5813.html)
Battler : Dead When SP 0 - Kain Nobel - 06-03-2016
Introduction
This script allows the developer to flag Actors and Enemies to die as soon as their SP reaches 0.
What this means is if an actor or enemy uses up all their magic reserves, they're dead.
I believe I got this inspiration from Final Fantasy 6, where you can use Osmosis to drain certain enemies of their MP, which was easier than chipping away at their HP, to kill them. It could've been a different numbered game in the series, but either way I know it was one of those FF games.
How do I know this? I don't know... I just do, okay! Quit asking questions!
Instructions
Place below default scripts and above Main.
Code:
# Actor 1 dies when SP is 0.
Game_Actor::DeadWhenSP0 = [1]
# All actors die when SP is 0
Game_Actor::DeadWhenSP0 = true
# This is invalid and will result in error...
Game_Actor::DeadWhenSP0 = false
# ...In that case, just leave the Array empty
Game_Actor::DeadWhenSP0 = []
# Enemies work in the same fashion^
Compatability
I wrote this for RPG Maker XP. It doesn't require SDK but it is compatible nonetheless.
If you want to use this for VX or VX Ace, you may only have to change...
sp => mp SP => MP
...but I'm not entirely sure if anything else would need to be done. Good luck!
Script
Content Hidden
Code:
#===============================================================================
# ** Battler : Dead When SP 0
#===============================================================================
class Game_Battler
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :deadwhensp0_gmbattler_dead?, :dead?
alias_method :deadwhensp0_gmbattler_attackeffect, :attack_effect
alias_method :deadwhensp0_gmbattler_skilleffect, :skill_effect
alias_method :deadwhensp0_gmbattler_itemeffect, :item_effect
#-----------------------------------------------------------------------------
# * Dead ?
#-----------------------------------------------------------------------------
def dead?
# Set HP to 0 if battler is SP 0 and assigned to die
@hp = 0 if @sp == 0 && dead_when_sp0?
# The usual
deadwhensp0_gmbattler_dead?
end
#-----------------------------------------------------------------------------
# * Attack Effect
#-----------------------------------------------------------------------------
def attack_effect(attacker)
# The usual
result = deadwhensp0_gmbattler_attackeffect(attacker)
# Call SP 0 effect for self and user
self.sp0_effect; attacker.sp0_effect
# Return result
result
end
#-----------------------------------------------------------------------------
# * Skill Effect
#-----------------------------------------------------------------------------
def skill_effect(user, skill)
# The usual
result = deadwhensp0_gmbattler_skilleffect(user,skill)
# Call SP 0 effect for self and user
self.sp0_effect; user.sp0_effect
# Return result
result
end
#-----------------------------------------------------------------------------
# * Item Effect
#-----------------------------------------------------------------------------
def item_effect(item)
# The usual
result = deadwhensp0_gmbattler_itemeffect(item)
# Call SP 0 effect for self and user
self.sp0_effect
# Return result
result
end
#-----------------------------------------------------------------------------
# * SP 0 Effect
#-----------------------------------------------------------------------------
def sp0_effect
# Return if not assinged to die on SP 0
return unless dead_when_sp0?
# Set HP to 0 if SP is 0
@hp = 0 if @sp == 0
end
end
class Game_Actor
#-----------------------------------------------------------------------------
# * Dead When SP 0 ?
#-----------------------------------------------------------------------------
def dead_when_sp0?
# Return false if immortal
return false if @immortal
# True if assigned in array
DeadWhenSP0 == true || DeadWhenSP0.include?(id)
end
end
class Game_Enemy
#-----------------------------------------------------------------------------
# * Dead When SP 0 ?
#-----------------------------------------------------------------------------
def dead_when_sp0?
# Return false if immortal
return false if @immortal
# True if assigned in array
DeadWhenSP0 == true || DeadWhenSP0.include?(id)
end
end
Author's Notes
I have a Drain / Osmosis script somewhere on this forum, you might want to look it up. The idea was to use Osmosis to completely drain an enemy of their MP and watch them die, hahaha!
Have I updated the mentioned Drain / Osmosis script since then? I'll check tomorrow and see if it's the most up-to-date version as I'm not entirely sure at this moment.
Credit
Free for commercial and non-commercial use. Just credit Kain Nobel and enjoy!