issues with heal on level script Rpgmaker XP

Dabiee

some guy that makes video games
Member
Joined
Aug 16, 2020
Messages
2
Reaction score
0
First Language
English
Primarily Uses
RMXP
Couldnt find issue in script help forum and everyone for the post i found the below scripts from said everything worked perfect for them so im at a loss on what to do...

Sorry if this is stupid but im having issues getting my script for heal on level to work, i used a previous post to find the 2 scripts here and even tried altering it to make it stop giving me Line XXX syntax error codes. I tried copy paste both of these and get as syntax error at def level_up or i will get script 'Game_Actor line xxx: NameError occured
undefined method 'level_up' for class 'Game_Actor' and thats when i copy it/ type it by hand. ill post a screenshot of the location and look of the codes inside my script editor as well. Any help would be appreciated as im on the final stretch of my game and noticed thru extraneous play testing that my party ends up low on hp/mp before level up, i want to force healing items to be semi rare but i dont want to feel like the player is fighting an uphill battle in multi level dungeons etc with no heal points before bosses.

class Game_Actor < Game_Battler
alias heal_on_level_up level_up
#--------------------------------------------------------------------------
# * Level Up
#--------------------------------------------------------------------------
def level_up
heal_on_level_up
recover_all
end
end

class Game_Actor < Game_Battler
alias heal_on_level_up level_up
#--------------------------------------------------------------------------
# * Level Up
#--------------------------------------------------------------------------
def level_up
heal_on_level_up
@hp = mhp
@mp = mmp
end
end


1597527925704.png
this code as well as the recover_all causes the same undefined name error. to get rid of this i did this 1597528049663.png but it causes the script to not work at all i.e: when any actor levels up their hp/mp do not restore nor do their states(poison etc.) get removed with recover_all script, recover_all also doesnt heal hp/mp its as if the script isnt active at all.
 
Last edited:

KK20

Just some XP Scripter
Veteran
Joined
Oct 11, 2018
Messages
278
Reaction score
103
First Language
English
Primarily Uses
RMXP
Would you mind sharing where you got that script from? I'm guessing you took a script meant for VXA as it has a Game_Actor#level_up method.

Here's an example of one written for XP, obtained from Tons of Add-ons. I tweaked it slightly so you don't need to include all 3 parts. (If you do find more scripts from here that pique your interest, then just add all 3 parts and enable them accordingly--no need to add the script I'm posting).

By the way, when adding scripts, it is generally advised you add them after Scene_Debug but before Main unless the script(er) tells you to do otherwise.
Ruby:
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Heal at LvlUp by Blizzard
# Version: 1.0b
# Type: Game Alteration
# Date: 4.12.2006
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Compatibility:
#
#   90% compatible with SDK v1.x. 40% compatible with SDK v2.x. Might not work
#   with exotic CBS-es or exotic Status displays during battle.
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=

#==============================================================================
# Window_BattleStatus
#==============================================================================

class Window_BattleStatus
 
  alias refesh_heal_at_lvlup_later refresh
  def refresh(number = nil)
    $game_party.actors.each_index {|i|
      if @level_up_flags[i]
        $game_party.actors[i].hp = $game_party.actors[i].maxhp
        $game_party.actors[i].sp = $game_party.actors[i].maxsp
      end}
    if number == nil
      refesh_heal_at_lvlup_later
    else
      refesh_heal_at_lvlup_later(number)
    end
  end
 
end
 

kyonides

Reforged is laughable
Veteran
Joined
Nov 17, 2019
Messages
287
Reaction score
71
First Language
English
Primarily Uses
RMXP
Here's my alternative. I gotta admit I just edited KK's edit. :D

It shouldn't ask you to paste any other script for it only depends on the original implementation, it doesn't need you to pass any parameter. There's also a plus here, it removes states as well.

Code:
class Window_BattleStatus
  alias :refresh_after_lvl_up :refresh
  def refresh
    $game_party.actors.each_index do |i|
      next unless @level_up_flags[i]
      $game_party.actors[i].recover_all
    end
    refresh_after_lvl_up
  end
end
I suspect both versions won't work if you're planning to implement any kind of ARPG...
 
Last edited:

Dabiee

some guy that makes video games
Member
Joined
Aug 16, 2020
Messages
2
Reaction score
0
First Language
English
Primarily Uses
RMXP
I appreciate the respones, to reply to KK20 it was in an old forum back from 2006 or something in the maker specifc for xp but maybe i read the forum title/where it was in maker specific wrong. The scripter said to put it anywhere in the game actor/battler in script editor but i bet youre 100% correct and it was supposed to be implemented in vxace instead of xp(my vxace game im making, i dont need this script as i already set that up with my own heal on lvl script. I feel like vxace is much easier to script in than xp or 2003 that i make in.) And thank you kyonides i appreciate the additional edit on the script. When i get home from work im gonna check them both out and see if i have the same issues i was having the other day. Thanks a million guys!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

People1.png & SF_People1.png added!!!!

Adventurer:
"Why your body looks like a bird?"

Stranger:
"Because I'm harpy"

Adventurer:
"Clap along if you feel like a room without a roof"

*Both dancing to Pharrell Williams song*
Stream will be live shortly with a make-up session of the Interactive Text Adventure! Feel free to drop by!
Pootscooter wrote on Pharonix's profile.
Hey @Pharonix, just wondering what you're up to lately and if you've had an opportunity to check out the LTBS thread in the past few days...(a couple of us could really use your expertise). Hope you are well and Happy Thanksgiving!

Forum statistics

Threads
105,506
Messages
1,014,263
Members
137,173
Latest member
zoetsoi
Top