[Resolved][XP] Force action based combo causing stacked State effects

Started by Lucern7, June 01, 2017, 03:44:24 pm

Previous topic - Next topic

Lucern7

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.

KK20

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.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Lucern7

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