[VX Ace] Help with turn order

Status
Not open for further replies.

S.Court

Veteran
Veteran
Joined
Oct 17, 2012
Messages
394
Reaction score
98
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
13,600
Reaction score
14,328
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,269
Reaction score
1,287
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
98
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,172
Reaction score
831
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
98
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,172
Reaction score
831
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
98
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
22,299
Reaction score
11,715
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

So I am working on a big DLC package for my game.... and it will add a new intro and extend the ending of the base game, while of course adding additional content to the game... Yeah, that should work! lol
I'm stuck, I'm making some of Mr. N's Dialogue but I can't finish his full Dialogue...heres what I got now [this is the part I'm stuck on] "You treat me like a
bug, I'M SICK OF IT, you had me make these...abominations...well, now..." and at the "Well, now...' part I'm stuck at, anyone got Ideas?
Ami
--- Top Up ---

Merchant: Diamond Sword cost 100 Diamonds
F.Magic Knight
: I don't have Diamonds,what should we do?
M.Knight: I don't have any choice,i have to Buy Diamonds with my Card
F.Magic Knight
: You do?
(M.Knight's Balance Just Have 1.25)
M.Knight: (Chuckle) Maybe,later…
Decided to add the option to customize decor/furniture in the player's base -- a couple of item options per furniture slot, some different carpets, etc. It's not really difficult to event, but oh goodness it's much more tedious to implement than I anticipated :'D

Forum statistics

Threads
107,539
Messages
1,030,367
Members
139,670
Latest member
Arsene04
Top