Today is my first time I take a look in BattleManager in my journey in learning RGSS3 :) .
This is a module method in BattleManager.
Can someone tell me the meaning of the line I point out below?
def self.next_command begin if !actor || !actor.next_command @actor_index += 1 return false if @actor_index >= $game_party.members.size # <= This line end end until actor.inputable? return truethe @actor_index, what actually is that?
return false if @actor_index >= $game_party.members.size # <= This lineWhat is the simple idea of this line? Did it means all actor is dead so it return false and no next command to be processed?
I hope I post in the right place, Thank you.
What the mean of this line of code?
● ARCHIVED · READ-ONLY
-
-
battle system is not my strong point, but I'll give it a go.
The def is basically just checking to see if the actor is there and ready for some battle commands (attack, skill select, guard, use item, etc). After the actor selects their attack, then it adds one to the counter variable (@actor_index). So after all the party members use their battle commands, the @actor_index will be bigger then the number of people in the party and could cause errors (checking for party member number 5 and you only have 4 members in the party). So that line of code says to stop the jumping to the next command if the @actor_index is greater then the party's size (aka return false).
Hope that makes some sense. Someone else may be able to explain it better then me -
@venka Thank you for your great explanation, :)
@admin : If you see this text, you can close this thread :) And perhaps before that, you want to add some explanation? Thank you.
-
The method is next_command. It is simply looking for the next actor to have their turn. If there are no more actors (the line you highlighted indicates that @actor_index - the index of the "current" actor - has moved beyond the last party member), it returns false, which probably indicates to stop the turn processing.
I don't have Ace in front of me right now, but I imagine this is called by the process that allows you to select an action for each of your battlers. When it receives false back, it knows you've selected an action for everybody, and can move on to executing the actions.
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.