I'm having a little problem with a script witch I'm trying to make in RMVX
Actually I have done it already in RMXP, but I'm redoing it again. It is a leveling-up system, designed for my game(sorry guys, can't post it here)
I'm particularly having problems with this piece of code(witch worked just fine on XP)
The problem is, the game doesn't lowers the experience. In fact, it gives an error message and shuts.
My question is: Is there a diference in the way RMVX is handling the experience? how can I lower it, then?
P.S.: Please let me know if you want to help, but couldn't understand what I'm trying to say. My English is very bad, so I"m struggling to write some of these thing here(including translating the commentaries, witch are in portuguese, my native language)
Thanks!!!
Actually I have done it already in RMXP, but I'm redoing it again. It is a leveling-up system, designed for my game(sorry guys, can't post it here)
I'm particularly having problems with this piece of code(witch worked just fine on XP)
Code:
def incatk #def to increase attack
atk = @actor.atk
for item in @actor.equips.compact do atk -= item.atk end #remove the attack of weapons to calculate exp
exp = (atk*atk*atk)/10 + 2 #calculates the exp needed for increasing the stat
inc = atk/10 + 2 #calculates the amount the stat will increase at this level
if @actor.exp < exp #if you haven't enough experience...
Sound.play_cancel
return #plays "cancel" sound and return to menu
else
Sound.play_decision #but if you have the experience...
@actor.atk += inc
@actor.exp -= exp #increase the stat and lower the experience
return
end
end
The problem is, the game doesn't lowers the experience. In fact, it gives an error message and shuts.
My question is: Is there a diference in the way RMVX is handling the experience? how can I lower it, then?
P.S.: Please let me know if you want to help, but couldn't understand what I'm trying to say. My English is very bad, so I"m struggling to write some of these thing here(including translating the commentaries, witch are in portuguese, my native language)
Thanks!!!