Chaos Project

RPG Maker => Event Systems => Event System Troubleshooting => Topic started by: Lucern7 on June 01, 2017, 03:44:24 pm

Title: [Resolved][XP] Force action based combo causing stacked State effects
Post by: Lucern7 on June 01, 2017, 03:44:24 pm
Hey I was working on a common event triggered combo attack system, and while the combos work as expected there's a side effect with status effects where the person doing the combo attack gets poisoned an additional time the force action executes. So they end up taking 5x damage (it's a 5 hit combo) than intended. I'm not sure if I need a script or if there's a command I missed to prevent this.

It's basically just a conditional branch that detects a keystroke and a force action command to do the attack. The rest is a default battle system. States are crucial for what I want to do for it so this has brought my project to a halt for the time being.
Title: Re: [XP] Force action based combo causing stacked State effects
Post by: KK20 on June 01, 2017, 05:58:22 pm
I can't test it right now, but can you try this?

In Scene_Battle 4, around line 130 should be this

    if @active_battler.hp > 0 and @active_battler.slip_damage?
      @active_battler.slip_damage_effect
      @active_battler.damage_pop = true
    end

Add this extra bit to the if-statement:
if @active_battler.hp > 0 and @active_battler.slip_damage? && !@active_battler.current_action.forcing

Theoretically, this should prevent slip damage from happening if the action was forced, which it is if done through an event command.
Title: Re: [XP] Force action based combo causing stacked State effects
Post by: Lucern7 on June 02, 2017, 04:49:17 am
That did the trick, thank you so much!

Update for anyone else having these issues I combined KK20's suggestion with script to fix the issue of states ending early by a user MobiusXIV on RPGMakerWeb. Here's the final code if anyone else runs into the issue. Just Put it above main and below other scripts.


class Scene_Battle
  #--------------------------------------------------------------------------
  # * Start Main Phase
  #--------------------------------------------------------------------------
  def start_phase4
    # Shift to phase 4
    @phase = 4
    # Turn count
    $game_temp.battle_turn += 1
    # Search all battle event pages
    for index in 0...$data_troops[@troop_id].pages.size
      # Get event page
      page = $data_troops[@troop_id].pages[index]
      # If this page span is [turn]
      if page.span == 1
        # Clear action completed flags
        $game_temp.battle_event_flags[index] = false
      end
    end
    # Set actor as unselectable
    @actor_index = -1
    @active_battler = nil
    # Enable party command window
    @party_command_window.active = false
    @party_command_window.visible = false
    # Disable actor command window
    @actor_command_window.active = false
    @actor_command_window.visible = false
    # Set main phase flag
    $game_temp.battle_main_phase = true
    # Make enemy action
    for enemy in $game_troop.enemies
      enemy.make_action
    end
    # Make action orders
    make_action_orders
# Reduce Status Turn Count <- Added
@action_battlers.each {|battler| battler.remove_states_auto}
    # Shift to step 1
    @phase4_step = 1
  end
  #--------------------------------------------------------------------------
  # * Frame Update (main phase step 1 : action preparation)
  #--------------------------------------------------------------------------
  def update_phase4_step1
    # Hide help window
    @help_window.visible = false
    # Determine win/loss
    if judge
      # If won, or if lost : end method
      return
    end
    # If an action forcing battler doesn't exist
    if $game_temp.forcing_battler == nil
      # Set up battle event
      setup_battle_event
      # If battle event is running
      if $game_system.battle_interpreter.running?
        return
      end
    end
    # If an action forcing battler exists
    if $game_temp.forcing_battler != nil
      # Add to head, or move
      @action_battlers.delete($game_temp.forcing_battler)
      @action_battlers.unshift($game_temp.forcing_battler)
    end
    # If no actionless battlers exist (all have performed an action)
    if @action_battlers.size == 0
      # Start party command phase
      start_phase2
      return
    end
    # Initialize animation ID and common event ID
    @animation1_id = 0
    @animation2_id = 0
    @common_event_id = 0
    # Shift from head of actionless battlers
    @active_battler = @action_battlers.shift
    # If already removed from battle
    if @active_battler.index == nil
      return
    end
    # Slip damage
    if @active_battler.hp > 0 and @active_battler.slip_damage? && !@active_battler.current_action.forcing
      @active_battler.slip_damage_effect
      @active_battler.damage_pop = true
    end
    # Natural removal of states
    # @active_battler.remove_states_auto
    # Refresh status window
    @status_window.refresh
    # Shift to step 2
    @phase4_step = 2
  end
end