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.

Making Stats = 0

Hello everyone! I have a a real basic question that I can't seem to solve on my own through scripting in RMXP. In my game, I would like to have my main character start off with a value of 0 for Strength, Dexterity and Intelligence. I've looked through Game_Actors and can't seem to find a way to set the minimum value for these stats. The lowest they will go is 1.

Does anyone know how to make stats have a value of 0? Any help is appreciated.
 

poccil

Sponsor

I don't understand why the parameters (stats) need to be set to 0 instead of, say, 1.  In fact, using parameters of 0 may cause division errors, as is the case for dexterity and agility.
 
If you really want the stats to show up as zero, I suggest making it only a cosmetic change. Find every instance of the stat being drawn, and simply change it in the scripts so that it draws (stat - 1) that would have it show up as zero from the start, without causing problems with devision by 0
 
Well, the game I'm designing is not really an RPG. There's no battle system, in fact, the entire game is essentially a series of mini-games ala Mario Party. The stats for Str, Dex and Int are merely used as a player reference and are never divided. Let me explain further, the player is exploring Disneyland and visiting the various rides (mini-games). Pins are awarded that raise three different stats "Adventure," "Fantasy" and "Time." These stats can only be increased by equipping certain pins. New mini-games are unlocked by checking the value of these stats via map events.

I wanted those three stats to start off as 0, since you have no Pins. These pins would increase the stats by 5, 10, 20, etc. That was what I was trying to do originally.
 
Well, I could, but then I would have to find a way to increase those variables when certain equipments are equipped. I thought it was easier to just have those values go up ala stat changes in the database.
 
I still think the simplest way is to just do a cosmetics change, and alter the class to show 0 when the stat is one. (i.e. always show the stat - 1) that way the calculations still run fine, and the player has no clue that they are done with 1 more than the stat
 
This requires a couple of small edits really. Since you can't set the str stat to be 0 in the database, you'll have to set it to 0 through the standard scripts. I'll take str as an example, but it's the same with all the other stats
first off, in Game_Actor, find the line "def base_str"
there's a couple of things you need to change in this method
firstly, this line
Code:
n = $data_actors[@actor_id].parameters[2, @level]
change that to
Code:
n = $data_actors[@actor_id].parameters[2, @level] - 1
sadly, enterbrain was determined in making our lives hell, so you'll also have to change this line
Code:
return[[n,1].max, 999].min
to this:
Code:
return[[n,0].max, 999].min
I hear you saying...yay, that seems like it would do the trick...
Sadly, no. There's a similar line in Game_Battler, that has a similar clause in it.
so change these 2 lines under def str (note: they're not actually consecutive in the script):
Code:
n = [[base_str + @str_plus, 1].max, 999].min
n = [[Integer(n), 1].max,999].min
to these 2 lines
Code:
n = [[base_str + @str_plus, 0].max, 999].min
n = [[Integer(n), 0].max, 999].min
and NOW you're done. This bit of code change simply means that, anytime an actor has "1" as a stat it shows up, and acts like,0

Another possible way to do this is through an event script call, that way you wouldn't have to alter the actual scripts.
The call would look like
Code:
$data_actors[actor_number].parameters[stat, level] = 0
actor_number needs to be replaced by an actor's number in the database
the stat needs to be replaced with one of the following
0 for max hp
1 for max sp
2 for str
3 for dex
4 for agi
5 for int
and finally, level needs to be replaced by the value of the level at which you want to change the str.
Note that you still won't have 0 str if you have anything equipped that will increase your str...duhz :P
Also, one thing I forgot to mention, if you still want to be able to have 999 points in an edited stat, you'd have to change 999 to 1000 in all the lines I just mentioned ;)
 

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