[VX Ace] Help with turn order

Status
Not open for further replies.

S.Court

Veteran
Veteran
Joined
Oct 17, 2012
Messages
394
Reaction score
97
First Language
Español
Primarily Uses
RMVXA
Hello. I created a battle and I noticed sometimes the slower battler can attack first, I tried to check and I think I found the trouble, and it's the random factor in Game_Action script

Code:
  #--------------------------------------------------------------------------
  # * Calculate Action Speed
  #--------------------------------------------------------------------------
  def speed
    speed = subject.agi + rand(5 + subject.agi / 4)
    speed += item.speed if item
    speed += subject.atk_speed if attack?
    speed
  end
I removed the random calc but the problem persists, is there another script is involved in turn order? How can I modify the turn order to remove the involved random factor? Thanks for the help
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
12,936
Reaction score
13,306
First Language
English
Primarily Uses
RMVXA
Check the speed of the item or skill used, as that factors in too. For example if actor A has Agility 50 and actor B has Agility 44, usually Actor B goes first, but if actor A uses a skill with speed 10, then A will now go first, as Actor A's Agility + skill speed is 50 + 10 > 55 (B's Agility)
 

gstv87

Veteran
Veteran
Joined
Oct 20, 2015
Messages
2,081
Reaction score
1,036
First Language
Spanish
Primarily Uses
RMVXA
Code:
def self.make_action_orders
    @action_battlers = []
    @action_battlers += $game_party.battle_members unless @surprise
    @action_battlers += $game_troop.members unless @preemptive
    @action_battlers.each {|battler| battler.make_speed }
    @action_battlers.sort! {|a,b| b.speed - a.speed }
  end
that is the real sorting of actions, from BattleManager.
what you posted initially, is the battler's own action speed, which is called through battler.make_speed

Code:
@action_battlers.sort! {|a,b| b.speed - a.speed }
has the final say.
 

S.Court

Veteran
Veteran
Joined
Oct 17, 2012
Messages
394
Reaction score
97
First Language
Español
Primarily Uses
RMVXA
@bgillisp No, any of the moves I used for the test has an increased/decreased speed.

@gstv87 I see, is there any random factor involved in this part as well?
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,136
Reaction score
809
First Language
Hungarian
Primarily Uses
RMVXA
Code:
def self.make_action_orders
    @action_battlers = []
    @action_battlers += $game_party.battle_members unless @surprise
    @action_battlers += $game_troop.members unless @preemptive
    @action_battlers.each {|battler| battler.make_speed }
    @action_battlers.sort! {|a,b| b.speed - a.speed }
  end
that is the real sorting of actions, from BattleManager.
what you posted initially, is the battler's own action speed, which is called through battler.make_speed

Code:
@action_battlers.sort! {|a,b| b.speed - a.speed }
has the final say.
That's the sorting process itself, and it is based on the exact method posted in the opening post, so modifying that part directly modifies the sorting order.
If you removed the random part, there should be no randomization left in the order.

Basic attacks can also take advantage of the feature named Attack Speed, but only basic attacks, any other skill will ignore this feature. So, if you tested it with basic attacks (Skill 1), than check if your actors/enemies have this feature somewhere on them or not.
Other than this, the already mentioned Speed setting for items/skills is the only other factor for determining the order of actions, unless you have some custom scripts changing this.
 

S.Court

Veteran
Veteran
Joined
Oct 17, 2012
Messages
394
Reaction score
97
First Language
Español
Primarily Uses
RMVXA
@Sixth I'm not using any other battle system related script and I added a script between materials and main with this

Code:
  #--------------------------------------------------------------------------
  # * Calculate Action Speed
  #--------------------------------------------------------------------------
  def speed
    speed = subject.agi
    speed += item.speed if item
    speed += subject.atk_speed if attack?
    speed
  end
But it's still adding certain random factor with turn order where sometimes the slower character is moving first
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,136
Reaction score
809
First Language
Hungarian
Primarily Uses
RMVXA
You can try to debug it by adding this line right above the simple speed line in that method:
Code:
p "#{subject.name}'s speed: #{speed}"
And check what's the console printing. If the speed values are not what you would expect, than something changes it, and you will have to find that something.
 

S.Court

Veteran
Veteran
Joined
Oct 17, 2012
Messages
394
Reaction score
97
First Language
Español
Primarily Uses
RMVXA
Well, I removed the custom script and I directly modified the one in Game_Action, and it worked. So I guess this thread can be closed
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
21,844
Reaction score
11,058
First Language
English
Primarily Uses
RMVXA
[closed]IgnoreMe[/closed]
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Every RPG and MMO should let you transmog\glamour your gear so you can look the way you want.
So, to clear up things, this section is to speak about personal life stuff and such? or maybe upload game content?
excerpt from my game FW: WHAT?! You want me to shear sheep? I had servants, who had servants, that had servants that did peasants work. Vincent: Do you see any of your servants here? FW: Well... no. Of course not. Vincent: Then get to work.
The dumbest mechanic I just encountered today : boss recovers 10% HP when a party member is KO-ed, who thinks this is a great idea again...?
Apparently my brain took a holiday today, so far I've stared blankly at the maker for 3 hours. Duuuuuuuuh.

Forum statistics

Threads
97,758
Messages
946,774
Members
128,970
Latest member
FreePint97
Top