Restauration (PV/PM) grâce à l'action se défendre
Ce tutorial permet de récupéré un tel pourcentage d'HP ou/et de MP en utilisant l'action "se défendre" lors des combats.
Dans le script "Scene_Battle 4" remplacer cette ligne:
| @help_window.set_text($data_system.words.guard, 1) |
Par ce code:
| a = 10 #Percentage of Max HP to restore. b = 10 #Variance in HP restoration. c = 10 #Percentage of Max SP to restore. d = 10 #Variance in SP restoration. e = @active_battler.maxhp * a / 100 #Converting to percentage. f = @active_battler.maxsp * c / 100 if b > 0 #Randomizing HP. e += rand((e * b / 100) + 1) + rand((e * b / 100) + 1) - (e * b / 100) end if d > 0 #Randomizing SP. f += rand((f * d / 100) + 1) + rand((f * d / 100) + 1) - (f * d / 100) end #This chunk determines whether HP or SP is being restored and does so. #It also generates a help window message explaining what was restored, if anything. #I added the battler's name to the defense message. Ya' like that?;) if @active_battler.hp == @active_battler.maxhp and @active_battler.sp == @active_battler.maxsp @help_window.set_text(@active_battler.name + " is defending...", 1) elsif @active_battler.sp == @active_battler.maxsp @help_window.set_text(@active_battler.name + " is defending. " + e.to_s + " HP regained!", 1) @active_battler.damage = (e * -1) @active_battler.damage_pop = true @active_battler.hp += e elsif @active_battler.hp == @active_battler.maxhp @help_window.set_text(@active_battler.name + " is defending. " + f.to_s + " SP regained!", 1) @active_battler.sp += f else @help_window.set_text(@active_battler.name + " is defending. " + e.to_s + " HP and " + f.to_s + " SP regained!", 1) @active_battler.damage = (e * -1) @active_battler.damage_pop = true @active_battler.hp += e @active_battler.sp += f end |
La variable "a" définie le pourcentage de PV récupéré.
La variable "b" définie la variation sur a% de PV récupéré.
La variable "c" définie le pourcentage de PM récupéré.
La variable "d" définie la variation sur c% de PM récupéré.