Death State Removed After Battle

Status
Not open for further replies.

Bartman901

Veteran
Veteran
Joined
Jun 6, 2016
Messages
46
Reaction score
0
First Language
Polish
Primarily Uses
N/A
Hello, I'm looking for script that will let character automatically remove death state after battle. I tried to set death state removed at battle end in database, but that caused the enemy to reappear because the death state was also removed.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
Setting it to remove at the end of battle should have done the trick. If the enemy also auto revived that means you have a script which is interfering with how end of battle states work. Can you list all the scripts you have please? Any script writer will need to know that, as their solution will also cause the same problem otherwise.
 

Bartman901

Veteran
Veteran
Joined
Jun 6, 2016
Messages
46
Reaction score
0
First Language
Polish
Primarily Uses
N/A
Setting it to remove at the end of battle should have done the trick. If the enemy also auto revived that means you have a script which is interfering with how end of battle states work. Can you list all the scripts you have please? Any script writer will need to know that, as their solution will also cause the same problem otherwise.
I use Yanfly Victory Aftermatch script.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA
That is not the cause. I use that script and the remove after death on my KO state, and it works just fine (no enemy resurrections). You got a conflict somewhere else, and you'll need to investigate it.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,674
First Language
German
Primarily Uses
RMMV
You could handle it indirectly.
Make a parallel process common event conditioned on a switch that removed any death state on all actors, then disable the switch that activates the parallel process common event.
And either have every troop contain an event that activates the switch at first turn, or use a script for base troop events.

Because parallel prozesses don't execute in regular battles, it will only activates after battle is concluded.
 

Bartman901

Veteran
Veteran
Joined
Jun 6, 2016
Messages
46
Reaction score
0
First Language
Polish
Primarily Uses
N/A
I also use these scripts as addons:
Code:
module BattleManager
 
  def self.gain_exp
    $game_party.all_members.each do |actor|
      temp_actor = Marshal.load(Marshal.dump(actor))
      actor.gain_exp($game_troop.exp_total)
      next if actor.level == temp_actor.level
      lvup_actor = Marshal.load(Marshal.dump(actor))
      temp_actor.clear_states
      temp_actor.clear_buffs
      lvup_actor.clear_states
      lvup_actor.clear_buffs
      SceneManager.scene.show_victory_level_up(lvup_actor, temp_actor)
      set_victory_text(actor, :level)
      wait_for_message
    end
  end
 
end
Code:
module TLZ
 
  # 0 - MHP
  # 1 - MMP
  # 2 - ATK
  # 3 - DEF
  # 4 - MAT
  # 5 - MDF
  # 6 - AGI
  # 7 - LUK
 
  Disabled_Stats = [1,6,7]
 
end
# ----------------------------------------------------------------------------
# Overwrite how draw stats is handled
# ----------------------------------------------------------------------------
class Window_VictoryLevelUp
 
  def draw_param_names(actor, dx)
    dx += 108
    change_color(system_color)
    text = Vocab.level
    draw_text(dx, 0, contents.width - dx, line_height, text)
    dy = 0
    for i in 0...8
      next if TLZ::Disabled_Stats.include?(i)
      dy += line_height
      text = Vocab.param(i)
      draw_text(dx, dy, contents.width - dx, line_height, text)
    end
  end

  def draw_former_stats(actor)
    dw = contents.width / 2 - 12
    dy = 0
    change_color(normal_color)
    draw_text(0, dy, dw, line_height, actor.level.group, 2)
    for i in 0...8
      next if TLZ::Disabled_Stats.include?(i)
      dy += line_height
      draw_text(0, dy, dw, line_height, actor.param(i).group, 2)
    end
  end

  def draw_arrows
    dx = contents.width / 2 - 12
    dy = 0
    change_color(system_color)
    for i in 0..8
      next if TLZ::Disabled_Stats.include?(i)
      draw_text(dx, dy, 24, line_height, "→", 1)
      dy += line_height
    end
  end
 
  def draw_newer_stats(actor, temp_actor)
    dx = contents.width / 2 + 12
    dw = contents.width - dx
    dy = 0
    change_color(param_change_color(actor.level - temp_actor.level))
    draw_text(dx, dy, dw, line_height, actor.level.group, 0)
    for i in 0...8
      next if TLZ::Disabled_Stats.include?(i)
      dy += line_height
      change_color(param_change_color(actor.param(i) - temp_actor.param(i)))
      draw_text(dx, dy, dw, line_height, actor.param(i).group, 0)
    end
  end

end
Code:
class Window_VictorySpoils
  IconGold = 365
 
  def draw_gold(rect)
    text = Vocab.currency_unit
    draw_icon(IconGold, 4, 0)
    draw_currency_value(@gold, text, rect.x, rect.y, rect.width)
  end
 
end
Code:
#==============================================================================
#
# ▼ Yanfly Engine Ace - Dynamic Victory Aftermath (Addon)
# -- Level: Normal, Hard
# -- Requires: YEA - Victory Aftermath
#
#------------------------------------------------------------------------------
#
# Edited by : TheoAllen
# Version : 1.0
# Contact : www.rpgmakerid.com (or) http://theolized.blogspot.com
# (English Documentation)
#
#==============================================================================
$imported = {} if $imported.nil?
if $imported["YEA-VictoryAftermath"]
$imported[:Theo_DynamicYEA_VA] = true
#==============================================================================
=begin

  Introduction :
  It is an addon to Yanfly Victory Aftermath. So you could change the actor's
  quote dynamically. Such as changing faceset or some quotes that only appears
  on a certain condition.
 
  How to use :
  Put this script below Yanfly Victory Aftermath
  These are notetag you could use
 
  <win: Constant>
  <level: Constant>
  <drops: Constant>
 
  Constant is a constanta name you define below this editable area. The
  explanation is written down below

=end
#=============================================================================
# Editable region
#=============================================================================
module TLZ # <-- Do not touch at all cost!
 
  # --------------------------------------------------------------------------
  # Time wait in frame before victory aftermath is displayed. I'm doing this
  # is for displaying victory pose sequence for my battle system
  # --------------------------------------------------------------------------
  Wait = 160
 
  # ==========================================================================
  # Here the explanations of making new quotes
  # Format :
  # --------------------------------------------------------------------------
  # Quote = [
  # ["face_name", face_index, "text","condition"],
  # ]
  #
  # Explanation :
  # Quote >> Constanta name you call it in notetag. The first letter have to
  #          be capitalized. For example, you add the Ralph_Win, then the
  #          notetag parameter would be <win: Ralph_Win>
  # face_name >> Faceset name that will be used. Just leave it empty if you
  #              want to use the currently used actor faceset
  # face_index >> Faceset index. From the top-left corner till bottom right
  #               corner is around 0 - 7
  # text >> Texts which will be displayed in victory aftermath. Add \n if
  #         you want to separate the line
  # condition >> Script eval condition. If you want to display the quote
  #              despite in any conditions, just write "true"
  # ==========================================================================
 
  # --------------------------------------------------------------------------
  # Please note that these sample quotes are based from my game. So make your
  # own then
  # --------------------------------------------------------------------------
 
  Ren_Quotes = [
  ["Ren_ex",7,"Cóż, to było do przewidzenia","true"],
  ["Ren_ex",7,"Nie było z wami najmniejszego problemu.","true"],
  ["Ren_ex",0,"Pomyślicie wpierw następnym razem...\nNo, może jednak nie!","true"],
  ["",5,"Uh...Może chroń mnie następnym razem.","hp_rate <= 0.25"],
  ["",0,"Niczym się nie różnicie od nieruchomego celu.","true"],
  ["",0,"Wystarczy jeden strzał i po kłopocie.","true"],
  ]
 
  # --------------------------------------------------------------------------
 
  Ren_Level = [
  ["Ren_ex",7,"Teraz nie będziecie dla mnie problemem.","true"],
  ]
 
  # --------------------------------------------------------------------------
 
  Ren_Drops = [
  ["Ren_ex",7,"Nic nadzwyczajnego.","true"],
  ["",6,"Czasem trzeba się cieszyć z tego co się ma.",
    "$game_temp.drops.size == 0"],
  ["Ren_ex",2,"Ugh...szlam!",
    "$game_temp.drops.include?($data_items[44])"],
  ["Ren_ex",7,"Podziękujecie mi za łupy potem.",
    "$game_temp.drops.size > 2"],
  ]
 
  # --------------------------------------------------------------------------
 
  Leya_Quotes = [
  ["Leya_ex",1,"Proszę was, już jako (były) adept \nwas przewyższam.","hp_rate > 0.5"],
  ["Leya_ex",3,"Widzieliście moją cudowną magię?","true"],
  ["",5,"Warto byłoby się czasem skupić bardziej \nna obronie niż ataku",
    "hp_rate <= 0.25"],
  ["",3,"Widzicie, dobrze że z wami byłam.","true"],
  ]
 
  Leya_Level = [
  ["",7,"Doświadczenie to najlepszy nauczyciel.","true"],
  ]
 
  Leya_Drops = [
  ["Leya_ex",3,"Z pewnością można to dobrze sprzedać.",
  "$game_temp.drops.size >= 1"],
  ["Leya_ex",4,"Mikstura zawsze się przyda.",
    "$game_temp.drops.include?($data_items[1])"],
  ["",7,"Najwyraźniej nic ciekawego nie ma... \nco za strata.",
    "$game_temp.drops.empty?"],
  ]
 
  # --------------------------------------------------------------------------
 
  Hitori_Quotes = [
  ["Hitori_ex",3,"Cóż, nie było tak ciężko, czyż nie?","true"],
  ["Hitori_ex",3,"Główny aktor schodzi ze sceny.","true"],
  ["",3,"Ruszajmy dalej lepiej.","$game_troop.turn_count <= 2"],
  ["",3,"Bywałam w takiej walce",
    "true"],
  ["",0,"Już zgłodniałem po tej walce!","hp_rate <= 0.5"],
  ["",0,"Tylko na tyle was stać?!","hp_rate > 0.5"],
  ["",3,"Całkiem, całkiem.","true"],
  ]
  Hitori_Level = [
  ["",0,"Pokaże wam teraz co potrafię!.","true"],
  ]
 
  Hitori_Drops = [
  ["",0,"Poprzedniemu właścicielowi nie bedzie to \njuż potrzebne.",
    "$game_temp.drops.size != 0"],
  ["Hitori_ex",3,"Możecie mi podziękować później.",
    "$game_temp.drops.size != 0"],
  ["Hitori_ex",6,"Cóż, obejdzie się bez tego.",
    "$game_temp.drops.empty?"],
  ["Hitori_ex",4,"Każda zdobycz ma zawsze jakąś wartość.",
    "$game_temp.drops.size == 1"],
  ]
 
  # --------------------------------------------------------------------------
  # Regular expression to read notetags. Do not touch if you don't have any
  # idea about it.
  # --------------------------------------------------------------------------
  WinQuoteREGX    = /<win\s*:\s*(.+)>/i
  LevelQuoteREGX  = /<level\s*:\s*(.+)>/i
  DropsQuoteREGX  = /<drops\s*:\s*(.+)>/i
  # --------------------------------------------------------------------------
 
end
# ============================================================================
# End of editable region. Editing below this point is your own risk.
# ============================================================================
class RPG::Actor
  attr_accessor :tlz_win
  attr_accessor :tlz_level
  attr_accessor :tlz_drops
 
  def load_actor_quotes
    note.split(/[\r\n]+/).each do |line|
      case line
      when TLZ::WinQuoteREGX
        @tlz_win = $1.to_s
      when TLZ::LevelQuoteREGX
        @tlz_level = $1.to_s
      when TLZ::DropsQuoteREGX
        @tlz_drops = $1.to_s
      end
    end
  end
 
end

class << DataManager
 
  alias yea_va_tlz_load_db load_database
  def load_database
    yea_va_tlz_load_db
    load_tlz_va_quotes
  end
 
  def load_tlz_va_quotes
    $data_actors.compact.each do |actor|
      actor.load_actor_quotes
    end
  end
 
end

class Game_Temp
  attr_accessor :drops
 
  alias yea_va_tlz_init initialize
  def initialize
    yea_va_tlz_init
    @drops = []
  end
 
end

class Game_Actor < Game_Battler
 
  def tlz_win_quotes
    ary = eval("TLZ::#{actor.tlz_win}").select do |quote|
      eval(quote[3])
    end
    return ary[rand(ary.size)]
  end
 
  def tlz_level_quotes
    ary = eval("TLZ::#{actor.tlz_level}").select do |quote|
      eval(quote[3])
    end
    return ary[rand(ary.size)]
  end
 
  def tlz_drops_quotes
    ary = eval("TLZ::#{actor.tlz_drops}").select do |quote|
      eval(quote[3])
    end
    return ary[rand(ary.size)]
  end
 
  def win_type_defined?(type)
    case type
    when :win
      return !actor.tlz_win.nil?
    when :level
      return !actor.tlz_level.nil?
    when :drops
      return !actor.tlz_drops.nil?
    end
  end
 
  def tlz_victory_quotes(type)
    case type
    when :win
      return tlz_win_quotes
    when :level
      return tlz_level_quotes
    when :drops
      return tlz_drops_quotes
    end
  end
 
end

class << BattleManager
 
  alias yea_va_tlz_set_victory_text set_victory_text
  def set_victory_text(actor, type)
    return yea_va_tlz_set_victory_text(actor, type) unless
      actor.win_type_defined?(type)
    return tlz_va_text(actor, type)
  end
 
  def tlz_va_text(actor, type)
    array = actor.tlz_victory_quotes(type)
    text = "" + sprintf(YEA::VICTORY_AFTERMATH::HEADER_TEXT, actor.name)
    text += array[2]
    text += YEA::VICTORY_AFTERMATH::FOOTER_TEXT
    $game_message.face_name = (array[0].empty? ? actor.face_name : array[0])
    $game_message.face_index = array[1]
    $game_message.add(text)
    wait_for_message
  end
 
  alias tlz_display_exp display_exp
  def display_exp
    SceneManager.scene.va_wait(TLZ::Wait)
    tlz_display_exp
  end
 
  #--------------------------------------------------------------------------
  # overwrite method: self.gain_drop_items
  #--------------------------------------------------------------------------
  def gain_drop_items
    drops = []
    $game_troop.make_drop_items.each do |item|
      $game_party.gain_item(item, 1)
      drops.push(item)
    end
    $game_temp.drops = drops
    SceneManager.scene.show_victory_spoils($game_troop.gold_total, drops)
    set_victory_text(@victory_actor, :drops)
    wait_for_message
  end
 
end

class Scene_Battle
 
  def va_wait(dur)
    dur.times do
      if Input.trigger?(:C)
        Input.update
        break
      end
      update_basic
    end
  end
 
end

end
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
Or just revive the actor on battle end "manually"
Code:
class Game_Actor
  alias battlend_recover on_battle_end
  def on_battle_end
    battlend_recover
    remove_state(death_state_id) if dead?
  end
end
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,660
Reaction score
563
First Language
English
Primarily Uses
RMVXA
So these 4 addons and the victory aftermath are the only scripts you have?
bgillisp said "Can you list all the scripts you have please?"
And that is LIST, not put them in the thread. Thanks.
 

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,592
Reaction score
6,522
First Language
Indonesian
Primarily Uses
RMVXA
It was Yanfly Battle Engine + Free Turn Battle causing it. If you press F8 (instant kill), it will show back the enemy if you set death state removed at battle end. If you kill regularly through legit kill, it will not.

Battle divided into two phases. Phase one for inputting command. Phase two (in turn) when the battler is going action. If you press instant kill, chance that the battler were defeated during input phase, which somehow (and I have no idea how) the battler will be once re-appear when the death state removed. It didn't happen if you defeat all enemies during turn phase

And if you're using FTB, all character input will be instantly executed, which mean an action is executed during input phase, causing a judge win / lose checked in input phase as well. It has nothing to do with victory aftermath.

I know the fact that he sent me a project suspecting it was my battle system causing it, but after tracing the source, I found it was because he checked remove on battle end. I said that there should be a plenty of scripts out there handing recover at battle end instead of using remove on battle end, or ask one in official forum if he can't find one because I didn't have time to write at that moment. But if he decide to ask (and he did it), it's good, so that I could write the patch and put it here for everyone to read.
 

Bartman901

Veteran
Veteran
Joined
Jun 6, 2016
Messages
46
Reaction score
0
First Language
Polish
Primarily Uses
N/A
Or just revive the actor on battle end "manually"
Code:
class Game_Actor
  alias battlend_recover on_battle_end
  def on_battle_end
    battlend_recover
    remove_state(death_state_id) if dead?
  end
end
All right, now everything works perfect. I'm really glad for help :* As for now, I think that thread should be closed.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,522
Reaction score
14,255
First Language
English
Primarily Uses
RMVXA

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

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

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,049
Members
137,570
Latest member
fgfhdfg
Top