The first one should work, and the second one should work in a skill formula. You need to make sure that x and y are the values you want them to be. x definitely should be an integer greater than 0.
In your method, try the following after setting x and y to what they need to be:
Code:
$game_variables[x] = y
p(x, y, $game_variables[x])
# ^this will print to the console the value of x, y, and the value of variable x
even writing things like $game_variables[1] = 9 aren't working. ive been calling a method from an attack formula and added a method to on_turn_end which prints variables 1-4 (which actually works fine but didn't report any changes when the method was called by the attack)
Ive written another attack with v[2]=4 in the formula which does show up in the console print.
its an interesting mystery about $game_variables but I've decided to just push forward with what I have functioning. I've managed to assign my variables as needed inside the attack formula and now am focused on fixing this line to check the state of an objects last target (the function of the variables)
def check_state_from_var
return if not state?(20)
if $game_variables[self.index].state?(27)
self.remove_state(20)
self.add_state(22)
else
return
end
this runs on round end 4 times (redundant but not the priority problem)
it checks for state 20
if so check the variable equal to the objects index which is assigned the last targets index which im wanting to check for state 27
if state 27 is found remove state 20 on the object
and add state 22.
the problem is with testing for state 27. I've tried a number of combinations today in order to test the objects last targets states but most of that time I had another error with assigning the variables and was unaware. thanks to theo Ive learned just enough about the console to be able to print out my variables and know for sure they were assigned.
.......reasons.