Save-Point
Death Switch - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Archives (https://www.save-point.org/forum-105.html)
+--- Forum: Creation Asylum Archives (https://www.save-point.org/forum-90.html)
+---- Forum: Scripts & Code Snippets (https://www.save-point.org/forum-92.html)
+----- Forum: RPG Maker XP Code (https://www.save-point.org/forum-93.html)
+----- Thread: Death Switch (/thread-6964.html)



Death Switch - Vash - 08-27-2006

Death Switch
Version 1.3
By Vash
Aug 27 2006

This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


Description:
You know how when the "lead" (front) character dies? I thought it was silly for the sprite on the map to still be displaying the "lead character that was dead so...
- When lead player dies the sprite on the map switchs to the next person in line thats alive.
- When you switch a character around the map sprite is updated. Best with: RPG Advocate's Changing Party Order.
- (By DerVV: It's Yargovich's script, not RPG Advocate. RPG Advocate just had it on his own website.)

Screenshots/Demo:
Not Needed

Note: Hoped I used alias correctly...

Instructions:
- Paste it over main.

Code:
#==============================================================================
# ** Game_Player (Death Switch)
#------------------------------------------------------------------------------
# By Vash (or rmxp.org)
# Posted on: 27.8.06
# Updated on: 4.9.06
# Version 1.3
# Description:
# - When the lead player dies the sprite on the map switchs to the next person
#   in line thats alive.
# - When you switch a character around the map sprite is updated.
#==============================================================================

class Game_Player < Game_Character
alias vash_tos_switch_refresh refresh
  def refresh
   vash_tos_switch_refresh
#------------------------------------------------------------------------------
# If lead character is dead
#------------------------------------------------------------------------------
  for actor in $game_party.actors
   lead = actor unless actor.hp == 0    
   break unless lead.nil?
end
#------------------------------------------------------------------------------
    @character_name = lead.character_name
    @character_hue = lead.character_hue
    @opacity = 255
    @blend_type = 0
  end
end

class Game_Player < Game_Character
alias vash_tos_switch_update update
  def update
   vash_tos_switch_update
#------------------------------------------------------------------------------
# If lead character is dead
#------------------------------------------------------------------------------
for actor in $game_party.actors
   lead = actor unless actor.hp == 0
   break unless lead.nil?
end
#------------------------------------------------------------------------------
# If all characters are dead
#------------------------------------------------------------------------------
  if $game_party.all_dead? or $game_party.actors.size == 0
    $scene = Scene_Gameover.new
      return
    end
   $game_temp.gameover unless !lead.nil?
   @character_name = lead.character_name
   @character_hue = lead.character_hue
end
end