Quantcast
Channel: RGSS3 Scripts (RMVX Ace) Latest Topics
Viewing all articles
Browse latest Browse all 416

State Duration Rates

$
0
0

State Duration Rates

by lilyWhite

 

While VX Ace allows you to modify individual characters' chance of being afflicted by states, there is no way by default to allow modifiers on how long a state lasts. This script allows you to use element rates as modifiers on the duration of states. This is completely independent of the rate of inflicting the state, so this can be used, for example, to have enemies that are easily afflicted by a state but shake it off quickly or enemies that are difficult to land a state on but have it last a very long time.

 

To use, add this notetag to the state notes, where "x" is the number of the element rate you wish to use for the state:

<stateelem: x>

Then simply assign the element rate as normal. (i.e. >100% = longer duration, <100% = shorter duration)

 

Free for use in any commercial or non-commercial project! Credit to "lilyWhite"; I reserve the right to be slightly miffed if you get the capitalization wrong. :3

 

The script is within the spoiler below. Just copy into the Script Editor—no configuration required!

Spoiler

=begin

  = State Duration Rates, by lilyWhite =
  This simple little script allows you to use element rates as a modifier to
  the duration of states.
  
  To use, add this notetag to the state:
  
    <stateelem: x>
    
  where x is the number of the element rate you wish to assign to the state.
  Then simply assign the relevant element rate to whatever as usual. The
  resulting duration rounds to the nearest number, up or down.
  
  Usage: Free to use in any commercial or non-commercial project! Credit to
  "lilyWhite"; I reserve the right to be slightly miffed if you get the
  capitalization wrong. :3
    
=end

class Game_Battler < Game_BattlerBase
  #--------------------------------------------------------------------------
  # * Alias reset_state_counts
  #--------------------------------------------------------------------------
  alias elem_rate_state_counts reset_state_counts
  def reset_state_counts(state_id)
    elem_rate_state_counts(state_id)
    state = $data_states[state_id]
    if stateelem(state)
      @state_turns[state_id] = (@state_turns[state_id] * element_rate(stateelem(state))).round
      @state_steps[state_id] = (@state_steps[state_id] * element_rate(stateelem(state))).round
    end
  end
  
  #--------------------------------------------------------------------------
  # * Get State Element Rate
  #--------------------------------------------------------------------------
  def stateelem(state)
    if state.note =~ /<stateelem: (\d+)>/i
       return $1.to_i
    end
  end
end

 

 


Viewing all articles
Browse latest Browse all 416

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>