RPG Maker XP Force Action Cures States Early

Brent

Warper
Member
Joined
Feb 11, 2016
Messages
3
Reaction score
0
First Language
English
Primarily Uses
Hey, everyone, this is my first time posting on the forum, so if I make a mistake I apologize.  I am using RPG Maker XP, and I use force actions with a few abilities (such as a geomancy type skill that produces effects based on the location).  Essentially, the character will activate the skill Geomancy (which has no effect other than call some script to determine the location and choose a random skill based on that location), and then force action has the same character immediately do an attack based on the location. 


For example, say in fields "Geomancy" will randomly use "Sun Glare," "Vine Attack," or "Breeze."


-Geomancer uses "Geomancy"


-Geomancer instantly force actions "Vine Attack"


The force action is working properly, but there is one problem.  I've noticed that as far as states are concerned, force action causes states on the user to end early.


For instance, if a state normally lasts 4 rounds, it will end upon either using "Attack" 4 times, using "Geomancy" 2 times, or using "Attack" twice and "Geomancy" once.


I would prefer that state duration updated at the end of each battle round instead of the end of each character turn.  At the very least, it would be acceptable if force action didn't reduce status effect duration again.


Does anyone know any solution to this problem?  Thank you for your time!
 

MobiusXVI

Game Maker
Veteran
Joined
Mar 20, 2013
Messages
383
Reaction score
91
First Language
English
Primarily Uses
This is because you're essentially giving your player two turns with Geomancy. The first turn happens when the player selects Geomancy as an action and the script is called; the second turn happens when Geomancy forces an action. I've done some manipulation of state duration before for my 'State Slip Skills' script. I'll check and see if there's not something I can port out of that to fix this.
 

Brent

Warper
Member
Joined
Feb 11, 2016
Messages
3
Reaction score
0
First Language
English
Primarily Uses
This is because you're essentially giving your player two turns with Geomancy. The first turn happens when the player selects Geomancy as an action and the script is called; the second turn happens when Geomancy forces an action. I've done some manipulation of state duration before for my 'State Slip Skills' script. I'll check and see if there's not something I can port out of that to fix this.
Thanks so much!  I've been trying to find a solution for awhile now.  Let me know if you find a way!
 

MobiusXVI

Game Maker
Veteran
Joined
Mar 20, 2013
Messages
383
Reaction score
91
First Language
English
Primarily Uses
Put this below the default battle script but above any custom battle scripts. It'll make the status turn counter count down once for each actor/enemy at the beginning of each battle round. 

Code:
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.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
 

Brent

Warper
Member
Joined
Feb 11, 2016
Messages
3
Reaction score
0
First Language
English
Primarily Uses
Put this below the default battle script but above any custom battle scripts. It'll make the status turn counter count down once for each actor/enemy at the beginning of each battle round. 

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.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
It seems to be working just fine!  Thank you so much for your help!!
 

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

Latest Threads

Latest Profile Posts

Pootscooter wrote on Pharonix's profile.
Hey @Pharonix, just wondering what you're up to lately and if you've had an opportunity to check out the LTBS thread in the past few days...(a couple of us could really use your expertise). Hope you are well and Happy Thanksgiving!
Anyone know the best size image to put in signature?
Well, the local collections agency is hiring... bleh. I'm not rude enough for them to hire me. Even the people they collect FOR don't like dealing with them. >.>
EA: "Kids are buying currency, not using money to gamble. It shouldn't be illegal!"
Me: "So... kids should be allowed into casinos to buy poker chips and not spend them at the blackjack table? Pretty sure, even buying currency used to gamble is illegal for children."
Been hard at work in photoshop working with MOG scripts for main menu & victory result screens, might do all my maps and Npc chatter this week too!

Forum statistics

Threads
105,499
Messages
1,014,209
Members
137,154
Latest member
Kurtkakes
Top