Hi!
EDIT: Well, I'd like to actually "fuse" this thread with the Front/Back row one. In the end what I was doing didn't work so I scrapped it. I'm trying to keep it simple now so I think what I basically need is to know how to add and remove states to the first 4 party members (the front and back row states) and remove any state to any actor not currently in the party. My guess is to create a method that does this and include it on the initialize_battle_members method in Yanfly's Party script I think, or maybe the rearrange method. But I'm kind of lost trying to figure out the syntax to do that :/
Here's what I got so far, thanks to some background of programming in college and that the errors are pretty good at telling what's wrong I managed to make it so it doesn't give errors, but it also does nothing apparently :/
Code:
#--------------------
# new method: add or remove row states
#--------------------
def party_row_states
for i in 0...max_battle_members
next if $game_party.battle_members[i].nil?
if i == 0 || i == 1
$game_party.battle_members[i].add_state(3)
$game_party.battle_members[i].remove_state(4)
$game_party.battle_members[i].remove_state(27)
end
if i == 2 || i == 3
$game_party.battle_members[i].add_state(4)
$game_party.battle_members[i].add_state(27)
$game_party.battle_members[i].remove_state(3)
end
end
for actor_id in @actors
next if $game_actors[actor_id].nil?
if !$game_party.battle_members.include?(actor_id)
$game_actors[actor_id].clear_states
end
end
end
Forgive me if it's reeeeally bad code, I'm just using what programming logic I still remember using examples I see around the scripts, I don't actually know Ruby syntax :/
I added this method in Game_Party and call it before the refresh at the end of the "initialize_battle_member" method in Yanfly's party script.
I tried doing it with common events but it doesn't update the state change until you leave the menu screen and it also gives an error with the party system script when you remove a character and leave the menu :/
EDIT2: So yeah, after testing it some more I figured this part of the code is why it wasn't doing anything:
Code:
for actor_id in @actors
next if $game_actors[actor_id].nil?
if !$game_party.battle_members.include?(actor_id)
$game_actors[actor_id].clear_states
end
end
That was supposed to clear the states of any character not in the party but it's actually clearing the states of everyone.... so now I need to know how that would be.
EDIT3:
Well, I think I managed to solve it by myself. Here's the method I made in the Yanfly party scrip in the Game Party class:
Code:
#--------------------
# new method: add or remove row states
#--------------------
def party_row_states
for i in 0...max_battle_members
next if $game_party.battle_members[i].nil?
if i == 0 || i == 1
$game_party.battle_members[i].add_state(3)
$game_party.battle_members[i].remove_state(4)
$game_party.battle_members[i].remove_state(27)
end
if i == 2 || i == 3
$game_party.battle_members[i].add_state(4)
$game_party.battle_members[i].add_state(27)
$game_party.battle_members[i].remove_state(3)
end
end
for actor_id in @actors
next if $game_actors[actor_id].nil?
if !@battle_members_array.include?(actor_id)
$game_actors[actor_id].clear_states
end
end
Then I call it on initialize_battle_members and rearrange_battlers.
Also add the initialize_battle_members method on the formation_ok method in the Scene_Menu.
This basically adds states according to the position in the party and removes any state to those in reserve, so if you want to create row effects just create the row states you want and add those states to the position you want.