Yanfly Base Troop Events + Yami Skill Equip + Turn Manager(custom)

Scripts:

https://yanflychannel.wordpress.com/rmvxa/utility-scripts/base-troop-events/

http://forums.rpgmakerweb.com/index.php?/topic/6727-skill-equip/

Turn Manager

Spoiler
################################################################################=begin#==============================================================================#------------------------------ Turn Manager ------------------------------------#==============================================================================#By: RinobiThis script is called once per turn in battle. --------------------------------------------------------------------------------Instructions:--------------------------------------------------------------------------------Plug & Play--------------------------------------------------------------------------------List of Effects:--------------------------------------------------------------------------------Grand Blaze: Deals fire damage to all enemies until user cancels or depletes mp.Steel Hurricane: Deals physical damage, same rules as above.Bullet Hell: Also deals physical damage, same rules apply.Dusk Flame: Deals 10x the user's INT value whenever the affected enemy attacks.Rogue Demise: Survive fatal damage once, and restore 25% of MHP.Phoenix Floret: Survive fatal damage once, and restore 50% of MHP.Winged Embrace: Receive less damage and restore HP per turn until TP runs out.Heaven's Rage: Boosts speed and damage until TP runs out.Pets are removed from battle upon death.Actor 20 isn't allowed to fight. (Testing)#==============================================================================#--------------------------------------------------------------------------------#==============================================================================#=end################################################################################module Turn_Manager  def self.turn_effects    $game_troop.members.each do |enemy|      if enemy.state?(103) # Grand Blaze        $game_party.members.each do |actor|          actor.remove_state(104) if actor.mp < 300          if !actor.state?(104)            enemy.remove_state(103)          end        end      end            if enemy.state?(142) # Steel Hurricane        $game_party.members.each do |actor|          actor.remove_state(143) if actor.mp < 850          if !actor.state?(143)            enemy.remove_state(142)          end        end      end            if enemy.state?(47) # Bullet Hell        $game_party.members.each do |actor|          actor.remove_state(48) if actor.mp < 100          if !actor.state?(48)            enemy.remove_state(47)          end        end      end      if !enemy.state?(134) # Dusk Flame        dfe = 0        dfe += 1        $game_variables[2500] = 0 if dfe < 1 && dfa < 1        dfe = 0      end    end#-------------------------------------------------------------------------------    $game_party.members.each do |a| # Rogue Demise      if a.state?(118) && a.hp < 1        a.hp += (a.mhp / 4).to_i        a.remove_state(118)      end      if a.state?(134) # Dusk Flame        dfa = 0        dfa += 1        $game_variables[2500] = 0 if dfa < 1 && dfe < 1        dfa = 0        a.force_action(22,-2)      end            if a.state?(165) && a.hp < 1 # Phoenix Floret        a.hp += (a.mhp / 2).to_i        a.remove_state(165)      end            if a.state?(20) && a.tp < 40 # Winged Embrace        a.remove_state(20) ; a.remove_state(21)      end            if a.state?(26) && a.tp < 20 # Heaven's Rage        a.remove_state(26) ; a.remove_state(27)      end    end#-------------------------------------------------------------------------------    if $game_actors[11].state?(1) then $game_party.remove_actor(11) end    if $game_actors[12].state?(1) then $game_party.remove_actor(12) end    if $game_actors[13].state?(1) then $game_party.remove_actor(13) end    if $game_actors[15].state?(1)      $game_party.remove_actor(15) ; $game_switches[100] = false      $game_party.members.each do |ao|        ao.remove_state(183)      end    end    if $game_actors[16].state?(1) then $game_party.remove_actor(16) end    if !$game_actors[16].state?(185) then $game_party.remove_actor(16) end    if $game_actors[17].state?(1) then $game_party.remove_actor(17) end    if !$game_actors[17].state?(186) then $game_party.remove_actor(17) end    if $game_actors[18].state?(1) then $game_party.remove_actor(18) end    if !$game_actors[18].state?(187) then $game_party.remove_actor(18) end#-------------------------------------------------------------------------------    $game_party.remove_actor(20)  endend
Here's the setup:

Just flips a switch, turn effects does not run here.

problem1.PNG

Turn Effects is run on turn one.

problem2.PNG

(Hime's Troop Placeholders is not installed, so those are just comments)

So, whenever I load these scripts together, I get an error:

problem3.PNG

If I remove any one of these scripts, the error does not occur. Now, all Base Troop Events does is run my bit of code for every battle, so I know that script in particular isn't the problem. Yami's Skill Equip and my Turn Manager are incompatible, but I'm not sure why.
I suggest installing one of the backtracer scripts (for example http://himeworks.com/2013/06/custom-main-full-error-backtrace/) and check which functions and scripts are involved in detail.
Are you sure those two are the problem?

Did you try to remove YF's script to see if it works?

Maybe you set it up so the troop event page from some other troop is merged with the troop page of the enemy shown?

I'll look at both for incompatibilities.
I suggest installing one of the backtracer scripts (for example http://himeworks.com/2013/06/custom-main-full-error-backtrace/) and check which functions and scripts are involved in detail.
I'll give this a try.

Are you sure those two are the problem?

Did you try to remove YF's script to see if it works?

Maybe you set it up so the troop event page from some other troop is merged with the troop page of the enemy shown?

I'll look at both for incompatibilities.
I'm positive, I removed YF's script just in case and still encountered the same problem ONLY if I loaded my Turn Manager. Without running Turn Manager, everything works as expected. I also tried this with just a single enemy without any randomly merged troops. I get this problem only if I run Turn Manager while Skill Equip is active. As long as the two don't run together, I don't get this issue.

Edit: Here's what I got from running the backtracer script. I haven't really looked it over yet, but I'll post it just in case someone catches the problem before I can.

problem4.PNGproblem5.PNG

Edit: I wanted to know what about my script was causing the problem, so I commented out section by section until the crash stopped happening. Everything within the last section of the script (where certain actors are removed based on their states) is causing the issue. I'm not sure why, but I'll rewrite that part to see if anything changes. I commented out the section I'm referring to below.

Spoiler
Code:
################################################################################=begin#==============================================================================#------------------------------ Turn Manager ------------------------------------#==============================================================================#By: RinobiThis script is called once per turn in battle. --------------------------------------------------------------------------------Instructions:--------------------------------------------------------------------------------Plug & Play--------------------------------------------------------------------------------List of Effects:--------------------------------------------------------------------------------Grand Blaze: Deals fire damage to all enemies until user cancels or depletes mp.Steel Hurricane: Deals physical damage, same rules as above.Bullet Hell: Also deals physical damage, same rules apply.Dusk Flame: Deals 10x the user's INT value whenever the affected enemy attacks.Rogue Demise: Survive fatal damage once, and restore 25% of MHP.Phoenix Floret: Survive fatal damage once, and restore 50% of MHP.Winged Embrace: Receive less damage and restore HP per turn until TP runs out.Heaven's Rage: Boosts speed and damage until TP runs out.Pets are removed from battle upon death.Actor 20 isn't allowed to fight. (Testing)#==============================================================================#--------------------------------------------------------------------------------#==============================================================================#=end################################################################################module Turn_Manager  def self.turn_effects    $game_troop.members.each do |enemy|      if enemy.state?(103) # Grand Blaze        $game_party.members.each do |actor|          actor.remove_state(104) if actor.mp < 300          if !actor.state?(104)            enemy.remove_state(103)          end        end      end            if enemy.state?(142) # Steel Hurricane        $game_party.members.each do |actor|          actor.remove_state(143) if actor.mp < 850          if !actor.state?(143)            enemy.remove_state(142)          end        end      end            if enemy.state?(47) # Bullet Hell        $game_party.members.each do |actor|          actor.remove_state(48) if actor.mp < 100          if !actor.state?(48)            enemy.remove_state(47)          end        end      end      if !enemy.state?(134) # Dusk Flame        dfe = 0        dfe += 1        $game_variables[2500] = 0 if dfe < 1 && dfa < 1        dfe = 0      end    end#-------------------------------------------------------------------------------    $game_party.members.each do |a| # Rogue Demise      if a.state?(118) && a.hp < 1        a.hp += (a.mhp / 4).to_i        a.remove_state(118)      end      if a.state?(134) # Dusk Flame        dfa = 0        dfa += 1        $game_variables[2500] = 0 if dfa < 1 && dfe < 1        dfa = 0        a.force_action(22,-2)      end            if a.state?(165) && a.hp < 1 # Phoenix Floret        a.hp += (a.mhp / 2).to_i        a.remove_state(165)      end            if a.state?(20) && a.tp < 40 # Winged Embrace        a.remove_state(20) ; a.remove_state(21)      end            if a.state?(26) && a.tp < 20 # Heaven's Rage        a.remove_state(26) ; a.remove_state(27)      end    end#-------------------------------------------------------------------------------=begin    if $game_actors[11].state?(1) then $game_party.remove_actor(11) end    if $game_actors[12].state?(1) then $game_party.remove_actor(12) end    if $game_actors[13].state?(1) then $game_party.remove_actor(13) end    if $game_actors[15].state?(1)      $game_party.remove_actor(15) ; $game_switches[100] = false      $game_party.members.each do |ao|        ao.remove_state(183)      end    end    if $game_actors[16].state?(1) then $game_party.remove_actor(16) end    if !$game_actors[16].state?(185) then $game_party.remove_actor(16) end    if $game_actors[17].state?(1) then $game_party.remove_actor(17) end    if !$game_actors[17].state?(186) then $game_party.remove_actor(17) end    if $game_actors[18].state?(1) then $game_party.remove_actor(18) end    if !$game_actors[18].state?(187) then $game_party.remove_actor(18) end=end#-------------------------------------------------------------------------------    $game_party.remove_actor(20)  endend

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-base-troop-events-yami-skill-equip-turn-manager-custom.44720/