[solved] alias a command from another script without overwriting it

I want to add a line to a section of another script without completely overwriting the whole script, which I believe is what alias is for, but I'm having trouble initializing it. it either errors out or overwrites it still. I've looked at other scripts, but didn't seem to help

example for one script for class Game_Battler < Game_BattlerBase

#========================================================================= #At end of Turn #========================================================================= def on_turn_end @result.clear turn_tick regenerate_all update_state_turns update_buff_turns remove_states_auto(2) end #========================================================================= #At end of Turn #========================================================================= def turn_tick Sound.play_click unless $game_party.in_battle or Deilin::CLICK == false count_time count_duration end if in another script I wanted to add the line

check_ class_effect

under on_turn_end without overwriting the whole section, how is it aliased?
Well, do you want to add it just anywhere, or does it have to go in a specific spot? If it's a specific spot, you need to overwrite the method. If it doesn't matter in relation to the current method, you make an alias like this:

alias the_new_name the_old_namedef the_old_name my_new_stuff the_new_nameendthe_new_name is an exact copy of what the method looked like before, and then we're changing it to have out custom stuff, and then doing whatever was already there.
alias whatever_on_turn_end on_turn_end

def on_turn_end

actions here

  whatever_on_turn_end

or actions here

end

but I'm having trouble initializing it. it either errors out or overwrites it still. I've looked at other scripts, but didn't seem to help
What kind of error does it show?
there was un-initialized method and one was undefined variable. then there was a freeze on one attempt.
which lines are shown on the error code? that will be much easier to look at...
the alias line works now

this will help with a lot of my scripting

thanks

Original thread: https://forums.rpgmakerweb.com/threads/solved-alias-a-command-from-another-script-without-overwriting-it.15957/