Not exactly requesting a new script but rather a script call

Started by Sin86, December 21, 2017, 07:30:16 pm

Previous topic - Next topic

Sin86

Actually, this might require a new script to be requested but I'm not so sure as I think this can be done using vanilla assets. Anyway, I was wondering if there is a script call that can be done to change the player, or player's weapon ATK.

KK20

"Change the player" as in "I want Basil to be the party leader, not Aluxes"? That can be evented.

Changing the ATK stat is a different beast. Default RMXP just sets this value as to whatever your equipped weapon is plus any states that in/decrease the stat. It's not like STR, DEX, INT, or AGL where it increases with level. Nor does it have a method to modify the value like the aforementioned.

But we can make it function similarly:

class Game_Battler
  alias add_attack_stat initialize
  def initialize
    @atk_plus = 0
    add_attack_stat
  end
 
  def atk=(a)
    @atk_plus = a - self.atk + @atk_plus
    @atk_plus = [[@atk_plus, -999].max, 999].min
  end
 
  def atk
    n = base_atk + @atk_plus
    for i in @states
      n *= $data_states[i].atk_rate / 100.0
    end
    return Integer(n)
  end
end

So now if you do
$game_actors[1].atk += 5

it should raise Aluxes' ATK stat by 5 permanently.





   


   
   


   
   

Other Projects
RPG Maker XP AceUpgrade RMXP to RMVXA performance!
XPA TilemapTilemap rewrite with many features, including custom resolution!



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

Join the CP Discord Server!