Hello all,
I am new to the RPG Maker series of programs and to Ruby. I am also new this forum. For those that wish to know, I do have experience with object oriented programming languages (Java specifically). Anyways, here's what I was tyring to do. The Actors tab in RPG Maker VX does not allow you to make an hp curve for an hp level higher than 9999 hp. So I decided I could just script the rest of the curve myself. Changing the hp limit was easy enough (I set it to 99999), but the real problem I encountered was when I wrote the script to extend the hp curve. Here's the script I wrote (I'll include the entire method it is included in):
def change_exp(exp, show)
last_level = @level
count = last_level
last_skills = skills
@exp = [[exp, 9999999].min, 0].max
while @exp >= @exp_list[@level+1] and @exp_list[@level+1] > 0
level_up
end
while @exp < @exp_list[@level]
level_down
end
#Here is where my script begins.
myActor = $game_party.members[index]
if @hp >= 9999 && @hp < 99999
while count < @level
@hp = @hp + 1000
myActor.maxhp = myActor.maxhp + 1000
count = count + 1
end
else
@hp = [@hp, maxhp].min
@mp = [@mp, maxmp].min
end
#Here is where my script ends.
if show and @level > last_level
display_level_up(skills - last_skills)
end
end
The above method is located inthe Game_Actor class. My script is between the two comments. To test this I scripted a method gives enough xp to raise my characters 10 levels or more and I modifed one of my characters to have 9999 hp by default. That being said, when the xp is gained, the hp caps at either 19998 or 19609. The interesting thing is, I can use Life Up items and the hp max goes up just fine all the way to up the limit I set. My question is, is the problem in my script or is it somewhere else? And if it is in my script, how do I fix it? Any help would be greatly appreciated.
P.S.
Yes I know I haven't put the checker in to see if @hp is > 99999. It is on my todo list. And yes, I know that this is not really needed, but I am studying to be a computer programmer and hope to one day write my own games, so the knowledge would greatly help me. If screens are needed let me know and I can post them.
Thanks in advance for all your help.
--gamerlj