Hello everyone, having an issue while trying to work with a variable.
I am reading the value from the enemy notetag with a regex and saving the value to a global variable, then using said value to apply a state on an enemy, but I get an error in the state aplying part.
My script is as follows:
enemy = $game_troop.members[$game_variables[2]]
$game_variables[109] = enemy.data_battler.note =~ /<Element = (\d+)>/i ? $1 : nil
enemy.add_state($game_variables[109])
The variable 2 is assigned to a loop that goes from 0 to 7, and breaks when it reaches 7 (in my game the max amount of enemies per troop is 8)
Then it reads the Element notetag from the enemy and assigns that value to variable 109, and then it assigns a state corresponding to the same number, however I get an error saying it cannot convert string to integer.
How can I save the notetag value as integer, or change the value in variable 109 to integer so I can work with it??
Thank you in advance!
I am reading the value from the enemy notetag with a regex and saving the value to a global variable, then using said value to apply a state on an enemy, but I get an error in the state aplying part.
My script is as follows:
enemy = $game_troop.members[$game_variables[2]]
$game_variables[109] = enemy.data_battler.note =~ /<Element = (\d+)>/i ? $1 : nil
enemy.add_state($game_variables[109])
The variable 2 is assigned to a loop that goes from 0 to 7, and breaks when it reaches 7 (in my game the max amount of enemies per troop is 8)
Then it reads the Element notetag from the enemy and assigns that value to variable 109, and then it assigns a state corresponding to the same number, however I get an error saying it cannot convert string to integer.
How can I save the notetag value as integer, or change the value in variable 109 to integer so I can work with it??
Thank you in advance!