(VXAce) Press Turn Battle System undefined method

Hello, hope anyone can help me with this one
I'm currently using PTB on my game and it works well so far, everything works as it should except magic reflection.
When you add the scripts to your project and start a battle, you get this error as soon as you or an enemy perfoms an attack:
Spoiler: Error
error.PNG
Commenting out those lines of code on both patches and fixes the crash, but then the party won't lose all their turns when magic is reflected, as they should due to the PTB config. Same happens with Yanfly's element reflect, works fine with absorb though. I've tested it on an empty project with no other scripts and the same thing happens, either the game crashes or the reflect won't work properly if you delete those lines of code.
Spoiler: Scripts
error2.PNG
I have the scripts in the correct order (same happens without element reflect or if its above the ptb scripts)
does this happen with battletest, with a saved game or with a new game?
please state the answer for all three options.
Just checked if it happens with old savefiles and it does, so yeah. In battletest and new game it always happens.
OK, then back to the basics - you read the error message wrong.

undefined method x for y usually means that y is undefined.
Or in your case, you're likely missing an actor, or an actor has incomplete data.

That's why I asked the question above - there are several ways how battletest and savefiles can get data wrong, but new game would always have the correct data because it wil be newly initialized data.

the cause for this problem can be missing data in the database, or incompatible scripts, or wrong order of scripts, or wrong configuration of scripts.
And there are very few ways other than experimenting to get to identify which cause.

what you can do is follow the link "how to use a script" in my signature to the bughunting section, download the backtracer mentioned there and install it in your game, then open the console and play the game to see the console output of the error message. That usually gives more info.
Alright, thanks for the correction, i'm trying to learn ruby so anything helps
I did what you told me, this is the full error message:
Spoiler: Error
Error3.PNG
Also i probably should've added the part of the code that gives the error, which is also the only part in the whole script where said magic_reflection is mentioned
Spoiler: CODE
Ruby:
  #--------------------------------------------------------------------------
  # alias method: item_apply
  #--------------------------------------------------------------------------
  def item_apply(user, item)
    ptbn_item_apply(user, item)
    return unless user
    return unless SceneManager.scene_is?(Scene_Battle)
    BattleControl.additonal_cost(item.ptbn_cost)
    last_state = user.ptbn_state
    user.ptbn_state = 0
    if item.ptbn_instant
      user.ptbn_state = 9
    elsif item.ptbn_pass || item.ptbn_half
      user.ptbn_state = 8
    elsif item.ptbn_gain > 0
      user.ptbn_state = item.ptbn_gain + 10
    end
    return if item.damage.none? || item.ptbn_pass || item.ptbn_instant
    if @result.missed
      user.ptbn_state = 5
    elsif @result.evaded
      user.ptbn_state = 4
    elsif @result.critical
      user.ptbn_state = 1
    elsif user.magic_reflection
      user.ptbn_state = 7
    elsif item_element_rate(user, @result.item) > 1
      user.ptbn_state = 1
    elsif item_element_rate(user, @result.item) == 0
      user.ptbn_state = 3
    elsif item_element_rate(user, @result.item) < 1 && item_element_rate(user, @result.item) > 0
      user.ptbn_state = 2
    elsif item_element_rate(user, @result.item) < 0
      user.ptbn_state = 6
    end
    user.ptbn_state = [last_state, user.ptbn_state].max if last_state = 8
  end
Can't make much sense of it though.
You see, I can't find the magic_reflection method in any of the scripts that I downloaded from Archeia/AEA github repository. If the Element Reflect script you added doesn't include it, then I'd need to see if Battle Luna or Yanfly's BS (Core perhaps?) does.
You see, I can't find the magic_reflection method in any of the scripts that I downloaded from Archeia/AEA github repository. If the Element Reflect script you added doesn't include it, then I'd need to see if Battle Luna or Yanfly's BS (Core perhaps?) does.
Yanfly's element reflect doesn't have it, neither the battle core. I don't have Luna engine so i can't check if it does

I've moved this thread to Script Support. Thank you.

@Finneess Then please check the instructions and website of where you got the element reflect script from for instructions and requirements.
because it sounds as if you have forgotten to install a script that is required for that one.
@Finneess Then please check the instructions and website of where you got the element reflect script from for instructions and requirements.
because it sounds as if you have forgotten to install a script that is required for that one.
Yanfly's element reflect doesn't need require other scripts to work, but like i said the game still crashes without it:
Spoiler: Error
error4.PNG
And i have all the PTB scripts placed in the right order (in my first screenshot i had the patches on the wrong order for some reason, but that doesn't affect anything because it crashed whether you placed correctly or not)
Someone needs to find out where magic_reflection is defined, because that script is either missing or damaged for you.

unfortunately I don't have Ace installed anymore....

right-click on the script list in the script editor, you should have a point "find all" or List all" somewhere in that context menu. please use this to search for magic_reflection and make a screenshot of the result (or list all scripts mentioned there for us)
Someone needs to find out where magic_reflection is defined, because that script is either missing or damaged for you.

unfortunately I don't have Ace installed anymore....

right-click on the script list in the script editor, you should have a point "find all" or List all" somewhere in that context menu. please use this to search for magic_reflection and make a screenshot of the result (or list all scripts mentioned there for us)
Okay, basically magic_reflection is only used in the patches and the main script, but isn't defined anywhere aparently, as it only apears in the item_aply method which defines if the party gains or looses turns based on the attack result
error5.PNG

This is that part of the code:
Spoiler: CODE
Ruby:
  #--------------------------------------------------------------------------
  # alias method: item_apply
  #--------------------------------------------------------------------------
  def item_apply(user, item)
    ptbn_item_apply(user, item)
    return unless user
    return unless SceneManager.scene_is?(Scene_Battle)
    BattleControl.additonal_cost(item.ptbn_cost)
    last_state = user.ptbn_state
    user.ptbn_state = 0
    if item.ptbn_instant
      user.ptbn_state = 9
    elsif item.ptbn_pass || item.ptbn_half
      user.ptbn_state = 8
    elsif item.ptbn_gain > 0
      user.ptbn_state = item.ptbn_gain + 10
    end
    return if item.damage.none? || item.ptbn_pass || item.ptbn_instant
    if @result.missed
      user.ptbn_state = 5
    elsif @result.evaded
      user.ptbn_state = 4
    elsif @result.critical
      user.ptbn_state = 1
    elsif user.magic_reflection
      user.ptbn_state = 7
    elsif item_element_rate(user, @result.item) > 1
      user.ptbn_state = 1
    elsif item_element_rate(user, @result.item) == 0
      user.ptbn_state = 3
    elsif item_element_rate(user, @result.item) < 1 && item_element_rate(user, @result.item) > 0
      user.ptbn_state = 2
    elsif item_element_rate(user, @result.item) < 0
      user.ptbn_state = 6
    end
    user.ptbn_state = [last_state, user.ptbn_state].max if last_state = 8
  end
It's the same on both patches and the main script
Okay, basically magic_reflection is only used in the patches and the main script, but isn't defined anywhere aparently, as it only apears in the item_aply method which defines if the party gains or looses turns based on the attack result
You changed something. and not in a good way or there is something really wrong.
1707741296408.png
You changed something. and not in a good way or there is something really wrong.
View attachment 294987
Okay. That's really weird. I created another new project to check just in case i deleted it without knowing, but none of my projects have the magic_reflection thing
error6.PNG

I'll assume it's an error on my rpg maker?
It looks like that - what is your version of Ace and did you get it from?
It looks like that - what is your version of Ace and did you get it from?
v1.00, admittedly a pirated version (i'm not that active here so i don't know if i can get in trouble for that?)
Okay, so I asked someone to lend me a copy of a blank project to get the game_battler code, so now that magic_reflection actually exist, the game no longer crashes. But there's still the issue with the PTB turns, when an attack gets reflected, the party is supposed to lose all their turns left, but instead they randomly either lose the default amount or just lose 1 additional turn, so it's not even a consistent loss
[pirate]@Finneess [/pirate]

Original thread: https://forums.rpgmakerweb.com/threads/vxace-press-turn-battle-system-undefined-method.165670/