I am trying to create a battle in which the actors are between an enemy pincer attack. So I need to change the position the actors start the battle in (from the right, to the middle).
My attempt was to alias Game_Actor screen_x, but only have it alias if a variable was at a certain value. I was thinking that I would equate the variable right before the battle (to activate the aliasing) and then after the battle set the value so that the aliasing would no longer be active.
Here is the code:
I put it right above Main and tried to run it, but got this error:
Script 'Bridge_Battle_Setup' line 3: NoMethodError occurred
undefined method `[]' for nil:NilClass
I could be going about this all wrong, not really sure. So if anyone could provide some insight I would be very appreciative :biggrin:
My attempt was to alias Game_Actor screen_x, but only have it alias if a variable was at a certain value. I was thinking that I would equate the variable right before the battle (to activate the aliasing) and then after the battle set the value so that the aliasing would no longer be active.
Here is the code:
class Game_Actor < Game_Battler
if $game_variable[4] == 1
alias old_screen_x screen_x
def screen_x
if $game_party.actors.size == 1
if self.index == 0
return 200
end
end
if $game_party.actors.size == 2
if self.index == 0
return 200
end
if self.index == 1
return 200
end
end
if $game_party.actors.size == 3
if self.index == 0
return 200
end
if self.index == 1
return 200
end
if self.index == 2
return 200
end
end
if $game_party.actors.size == 4
if self.index == 0
return 200
end
if self.index == 1
return 200
end
if self.index == 2
return 200
end
if self.index == 3
return 200
end
end
end
end
end
if $game_variable[4] == 1
alias old_screen_x screen_x
def screen_x
if $game_party.actors.size == 1
if self.index == 0
return 200
end
end
if $game_party.actors.size == 2
if self.index == 0
return 200
end
if self.index == 1
return 200
end
end
if $game_party.actors.size == 3
if self.index == 0
return 200
end
if self.index == 1
return 200
end
if self.index == 2
return 200
end
end
if $game_party.actors.size == 4
if self.index == 0
return 200
end
if self.index == 1
return 200
end
if self.index == 2
return 200
end
if self.index == 3
return 200
end
end
end
end
end
Script 'Bridge_Battle_Setup' line 3: NoMethodError occurred
undefined method `[]' for nil:NilClass
I could be going about this all wrong, not really sure. So if anyone could provide some insight I would be very appreciative :biggrin: