Chaos Project

RPG Maker => RPG Maker Scripts => Script Requests => Topic started by: Sin86 on December 21, 2017, 07:30:16 pm

Title: Not exactly requesting a new script but rather a script call
Post by: Sin86 on December 21, 2017, 07:30:16 pm
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.
Title: Re: Not exactly requesting a new script but rather a script call
Post by: KK20 on December 21, 2017, 08:40:44 pm
"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.