Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Change hero's equipment-based stats permanently
#1
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


Normally if you use a script or the Call Script command to try to change a hero's attack power, physical defense, magic defense, or evasion like you would try to permanently change their six normal stats, you would get an error and the game would crash. However, there is a way to fix that! But it requires some typing and pasting.

First create a new project in case things go wrong. Copy the script page Game_Battler 1 and paste it right below, rename it Game_Battler 1 EDIT or something. Game_Battler 1 EDIT should be right below the original Game_Battler 1, and it definitely must be BEFORE Game_Battler 2, or the program will bitch you out.

In Game_Battler 1 EDIT under the def initialize method, add @atk_plus = 0, @pdef_plus = 0, @mdef_plus = 0, and @eva_plus = 0. It should look something like this:

Code:
#--------------------------------------------------------------------------
# � オブジェクト�期化
#--------------------------------------------------------------------------
def initialize
   @battler_name = ""
   @battler_hue = 0
   @hp = 0
   @sp = 0
   @states = []
   @states_turn = {}
   @maxhp_plus = 0
   @maxsp_plus = 0
   @str_plus = 0
   @dex_plus = 0
   @agi_plus = 0
   @int_plus = 0
   @atk_plus = 0 # Added to allow hero's atk (attack power) to change via scripts.
   @pdef_plus = 0 # Added to allow hero's pdef (physical def) to change via scripts.
   @mdef_plus = 0 # Added to allow hero's mdef (magical def) to change via scripts.
   @eva_plus = 0 # Added to allow hero's eva(sion) to change via scripts.
   @hidden = false
   @immortal = false
   @damage_pop = false
   @damage = nil
   @critical = false
   @animation_id = 0
   @animation_hit = false
   @white_flash = false
   @blink = false
   @current_action = Game_BattleAction.new
end

Now this is what I did.

You see this part right here?

Code:
#--------------------------------------------------------------------------
# â—? è…•å� ›ã?®å?–å¾—
#--------------------------------------------------------------------------
def str
   n = [[base_str + @str_plus, 1].max, 999].min
   for i in @states
     n *= $data_states[i].str_rate / 100.0
   end
   n = [[Integer(n), 1].max, 999].min
   return n
end

Copy that. Now scroll down until you get to the def atk method:

Code:
#--------------------------------------------------------------------------
# â—? 攻撃å� ›ã?®å?–å¾—
#--------------------------------------------------------------------------
def atk
   n = base_atk
   for i in @states
     n *= $data_states[i].atk_rate / 100.0
   end
   return Integer(n)
end

This is what you should do. Paste the def str method you just copied over the def atk method. Calm down, we're not getting rid of attack. In your second copy of def str, replace "str" with "atk". But do not do this with the original def str method.

Now copy this part:

Code:
#--------------------------------------------------------------------------
# â—? è…•å� ›ã?®è¨­å®š
# �  �  str : æ–°ã?—ã?„è…•å� ›
#--------------------------------------------------------------------------
def str=(str)
   @str_plus += str - self.str
   @str_plus = [[@str_plus, -999].max, 999].min
end

... and paste it right below the new def atk method. Again, replace the word "str" with "atk", but only with the second copy of def str=(str)... don't mess with the original. If done right, it should look like this:

Code:
#--------------------------------------------------------------------------
# â—? 攻撃å� ›ã?®å?–å¾— (Attack Power)
#--------------------------------------------------------------------------
def atk
   n = [[base_atk + @atk_plus, 1].max, 999].min
   for i in @states
     n *= $data_states[i].atk_rate / 100.0
   end
   n = [[Integer(n), 1].max, 999].min
   return n
end
#
#
#
def atk=(atk)
   @atk_plus += atk - self.atk
   @atk_plus = [[@atk_plus, -999].max, 999].min
end


Now create an event and use Call Script with this code:

Code:
for actor in $game_party.actors
  unless actor == nil
    actor.atk += 100
  end
end

And if everything worked right, the party's Attack Power will increase by 100 with no errors! And to do it with just a single person, it only takes one line of code: $game_actors[X].atk += 100, X being the hero's ID in the Database.

To do the same with Physical Defense and Magic Defense, repeat the above steps and replace the word atk in the codes above with the word pdef or mdef. Be sure they replace the original stat methods (i.e. paste the new def pdef over the default one). You can do the same with Evasion, but the "states" line is different there. For eva, it should be
n += $data_states[i ].eva, like in the original eva code... not n *= $data_states[i ].eva_rate / 100.0.

Now there were some issues. If you unequip everything, Attack Power, Phys. Def, and Mag. Def will be 1. However, if you increase it by 100 in that code, it becomes just 100, 200, or 300, etc... Not 101, or 201, or 301, etc. Also, if you are equipped, the value isn't equipment + 1, for example Arshes' equipment normally adds up to 138 Magic Defense and that's what his MDef becomes... instead of 139 MDef. That, I found odd. To get rid of that oddity, notice the "1" in [[base_str + @str_plus, 1] and [[Integer(n), 1]? Change them to 0. That should fix things.

You could also change the 0 value in the atk_plus, pdef_plus, etc. in the initialize method into 1. Now defense and attack should be equipment + 1, so if equipment adds up to 138 Defense, you should have 139 Defense now.

Also, the Evasion stat is normally not visible. You'd have to edit the status and equip windows in order to display it. But personally, I would rather leave Evasion to equipment only, and not change it permanently.


Hope you guys understood what I said, when I originally typed this in the rmxp.net forums, it was really late. All I did was paste this post and changed some words around.
}


Possibly Related Threads…
Thread Author Replies Views Last Post
  Change character script jaigai 0 2,740 11-19-2006, 01:00 PM
Last Post: jaigai
  RX-Stats Screen Fugly 0 2,831 10-22-2006, 01:00 PM
Last Post: Fugly
  Change menu character sprites to Pictures like in rpg maker 2003 Abyssos 0 3,630 09-28-2006, 01:00 PM
Last Post: Abyssos
  Gameover based on Level ember2inferno 0 1,900 07-20-2006, 01:00 PM
Last Post: ember2inferno
  Change Color of The diferent Status Script MASTERLOKI 0 2,270 07-18-2006, 01:00 PM
Last Post: MASTERLOKI
  Change Cursor with differend commands in Battle Divinity 0 2,211 06-22-2006, 01:00 PM
Last Post: Divinity
  Level Up Box and Equipment Skills TsengTsuzaki 0 2,045 05-24-2006, 01:00 PM
Last Post: TsengTsuzaki
  Equipment Scrolling System Legacy 0 2,095 05-12-2006, 01:00 PM
Last Post: Legacy
  Change Level/Exp/Status name ryujijitei 0 1,998 04-29-2006, 01:00 PM
Last Post: ryujijitei
  Change the hue of pictures Sheol 0 2,059 11-29-2005, 01:00 PM
Last Post: Sheol



Users browsing this thread: