Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Game_Battler stat modifier questions

I was looking through Game_Battler in XP, and I noticed something. There are a group of stat modifiers to the character stats defined at the top:

Code:
    @maxhp_plus = 0
    @maxsp_plus = 0
    @str_plus = 0
    @dex_plus = 0
    @agi_plus = 0
    @int_plus = 0

I was wondering, are these used for anything in the game? Are they leftovers of an unincluded script? Finally, if I modified these in reference to a specific character or enemy (in battle), would it modify the stats of everything, or only the stats of the character or enemy that it was modified using?
 
All of the @stat_plus objects refer to the data of the weapon/armors equipped to an actor, they're initialized at 0 so that it doesn't return nil if nothing is equipped, it just returns 0 instead.

Theres a couple other things in which these variables are used or modified for, here's a couple things I can think of off the top of my head.

States use something similiar to this, but instead of @str_plus its @str_rate, which further modifies an actor/enemy's stats, I'll let you look into the script yourself and see how these variables all work together.

Also, another slight difference between how an actor and enemy use these variables, with an Actor if you use a stat-modifying item, the effect is permanent, so their base stat is modified directly (for instance if you use a Seed of Intelligence, an actor's @int is modified directly), but with an enemy, its only temporary, so it will modify @int_plus instead of the enemy's base @int stat. (So when you encounter the same enemy later, their stat will return to the default value.)

There's probably more things that I didn't mention with how these work, I haven't used these variables in any of my scripts lately so I'm kinda rusty but they're used within these classes

RPG::Weapon
RPG::Armor

Game_Actor
Game_Battler

Hope that helps some, I'll look into it more if you have further questions. Also, Gando has a script for Passive Skills that you might want to check out that makes good use of these variables.

And to answer your last question, it only effects a certain actor/enemy, for instance when Aluxes has Mythril Armor equipped, only his PDef is raised, nobody else's. If you modify the base class which these variables are defined though, it might make a difference, go ahead and try it and tell me what happens.
 
The @*_plus variables exist both in Game_Actor and Game_Battler 1. As for the one in Game_Actor, these are permanent changes. The ones for Game_Battler counts only inside battle. As for instance, if you went in a call script and added the following line:
Code:
$game_party.actors[0].maxhp_plus = 500
Then your leading character would gain an extra 500 health (current health plus 500) permanently. If this is added on a Game_Battler instance, it would be completely removed from the actor once battle ended.

I hope this made any sense.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top