It doesn't crash anymore, but it's not giving me 10% of my max HP. It's recovering, or damaging me, a random number lower than 50, including decimals, and the Hit points get decimal values.
EDIT: I fixed that myself, calculations, which I believe you were doing to create randomness, were leaving something out. I removed the randomness so it currently recovers a flat percentage. I will try to implement the randomness again.
EDIT: I added a randomness. It's sloppy, because I'm not a scripter, but now it regens 9-11% of your hit points each turn if the percentage is set to 10%. It still works if the percentage is modified.
I'm satisfied with this script now, it works perfectly for what I needed. Thank you very much

CODE
#==============================================================================
#=#============================================================================
# #** Jens of Zanicuud rigene in battle script v 1.0
# # -free use, just credit
# # -free customization, however, posting on RRR the modified version is
# # mandatory
# # -you can find me on www.rpgrevolution.com
#=#============================================================================
#==============================================================================
#==============================================================================
# ** Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ** constants
#--------------------------------------------------------------------------
RIGENE_STATES = [] #put here rigene stati - example:
#RIGENE_STATES = [2,3]
#means status 2 and 3 give the battler rigene
RIGENE_PERCENTAGE = 10.0 #percentage of life recovered each turn
#(1.0 -> 100.0)
#--------------------------------------------------------------------------
# ** randomizer
#--------------------------------------------------------------------------
def lsrandomval
end
#--------------------------------------------------------------------------
# ** rigene?
#--------------------------------------------------------------------------
def rigene?
for i in @states
if RIGENE_STATES.include?(i)
return true
end
end
return false
end
#--------------------------------------------------------------------------
# ** rigene_effect
#--------------------------------------------------------------------------
def rigene_effect
# calculate rigene value (10% maxhp by default)
self.damage = self.maxhp * RIGENE_PERCENTAGE / -100.0
lsrandomval = self.damage / -10
self.damage = self.damage - lsrandomval + rand(lsrandomval) + rand(lsrandomval)
self.damage = self.damage.round
# increase HP
self.hp -= self.damage
# return true
return true
end
end
#==============================================================================
# ** Scene_Battle
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ** aliases
#--------------------------------------------------------------------------
alias joz3_rigene_update_phase4_step1 update_phase4_step1
#--------------------------------------------------------------------------
# ** update_phase4_step1
#--------------------------------------------------------------------------
def update_phase4_step1
joz3_rigene_update_phase4_step1
if @active_battler != nil
if @active_battler.hp > 0 and @active_battler.rigene?
@active_battler.rigene_effect
@active_battler.damage_pop = true
end
end
end
end
This post has been edited by LostSamurai: Feb 17 2012, 02:25 PM