Jump to content
Sign in to follow this  
Nataxinus

Change Graphic to Coffin on Death

Recommended Posts

Change Graphic to Coffin on Death

When a character dies he turns into a coffin now. The player is only a coffin in battle but not on the map. This script is compatible with the Yanfly Battle Engine. After the battle all characters who is dead will appear as a coffin except for the player.

 

I know there are some battle scripts that has a feature to change graphic upon death, but as far as I'm aware there is no stand alone script that also makes the characters appear as a coffin on the map for RPGMVXAce.

 

I was inspired by Dragon Quest.

 

This script is just plug and play, except if you want to change the graphic.

 

Screenshots

2qn5suh.png

 

aboxme.png

 

Script

#===============================================================================
# Coffin Death Script
# By Nataxinus
#===============================================================================
#===============================================================================
# Description
# When a character dies he turns into a coffin now. The player is only a coffin 
# in battle but not on the map. This script is compatible with the Yanfly Battle 
# Engine. After the battle all characters who is dead will appear as a coffin 
# except for the player.
#===============================================================================
#===============================================================================
# Terms of use
# Free for non-commercial and commercial projects, but credit me
#===============================================================================
module Nataxinus
  module Coffin
    # If you want to use another graphic then change GRAPHIC. Remember to put the
    # graphic in the Graphics/Character folder.
    GRAPHIC = "$Coffin"
    
    # Set SHOW_IN_BATTLE to false if you don't want the coffin in battle.
    SHOW_IN_BATTLE = true
    # Set SHOW_ON_MAP to false if you don't want the coffin on the map
    SHOW_ON_MAP = true
  end
end
class Game_Actor < Game_Battler 
  attr_accessor :character_name_temp
  attr_accessor :character_index_temp
  attr_accessor :character_name
  attr_accessor :character_index
end

class Game_BattleCharacter < Game_Character
  attr_accessor :actor
end

class Sprite_Character < Sprite_Base
  include Nataxinus::Coffin
  alias coffin_update update
  def update
    if @character.class == Game_Follower && SHOW_ON_MAP
      @actor = @character.actor
    elsif @character.class == Game_BattleCharacter && SHOW_IN_BATTLE
      @actor = @character.actor
    elsif @character.class == Game_Player && SHOW_ON_MAP
      if $game_actors[1].character_name == GRAPHIC
        $game_actors[1].character_name = $game_actors[1].character_name_temp
        $game_actors[1].character_index = $game_actors[1].character_index_temp
      end
    else
      @actor = nil
    end
    
    if @actor
      if @actor.hp <= 0 
        @coffin = true
        if @actor.character_name != GRAPHIC
          @actor.character_name_temp = @actor.character_name
          @actor.character_index_temp = @actor.character_index
          @actor.character_name = GRAPHIC
          @actor.character_index = 0
        end
        @actor.set_graphic(GRAPHIC, 0, @actor.face_name, @actor.face_index)
        if @character.class == Game_BattleCharacter
          @character.set_graphic(GRAPHIC, 0)
        end
        @character.refresh if @character.class == Game_Follower
      elsif @actor.character_name_temp != nil
        if @actor.character_name == GRAPHIC
          @coffin = false
          @actor.character_name = @actor.character_name_temp
          @actor.character_index = @actor.character_index_temp
          puts @actor.character_name
          if @character.class == Game_BattleCharacter
            @character.set_graphic(@actor.character_name_temp, @actor.character_index_temp)
          end
          @character.refresh if @character.class == Game_Follower
        end
      end
    end
    coffin_update
  end
end 

Edited by Nataxinus
  • Like 2

Share this post


Link to post
Share on other sites

Cool script, but here's a suggestion. Offer your script users an option to easily edit which sprite they want to be shown during death, though you said its a coffin, someone might be using a custom sprite of a coffin, so easily editable area without much searching for the user is a good start. You can also put two switches or options that allows the user to have the option if he or she wants to show the coffins only in battle or only in map.

 

Of course, these are just my suggestions, because it is still a cool script no matter what.

Share this post


Link to post
Share on other sites

I have set show_on_map to false but the coffin still show anyway? this script is like the perfect one for my game i just need to find how to disable the coffin in overworld someone please help.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted