New account registration is temporarily disabled.

THE MECHANICS OF A TURN BASED SYSTEM...

Posts

Pages: 1
I'm currently making a plugin to change the default battle system into a turn based system where each actor(hero/monster) can only input one action until every other actor has had an action. They will take their actions in the order of their agility, if equal then priority is given to the player's actor.

What I need help with is how to implement such a system. So far I have the plugin get the agility values of every actor, then the plugin sets the ATB of the actor with the highest agility to 300,000 (full bar) and every other actor to 0 (no bar). My problem arises after said actor takes an action. I'm not sure how to keep track of the actors who have taken their "turn" and those who haven't. I'm guessing I need to use a boolean array of some kind, but I'm not sure how to implement it.

Also, If anyone knows any websites that teaches the coding of game mechanics please post links, preferably in C++.
Say your agility works in small numbers, use a loop and add the agility of everyone on the field like so until 100 (or 1000 if working with huge numbers for some reason.)

I don't know C++ but I know if/else/variables are common enough language in programming that you should be able to catch what I'm saying in rpgmaker laymans terms.

If var N1 greater than 100, go to next label. Else,
Var N1 +10,
If var N1 is greater than 100+, character acts,
+1 to turn limit var.
If turn limit var = total actors in battle, reset all N variables to 0 and jump to top.
else (N1 was less than 100),

Repeat same code using var N2, etc, for thr total number of actors on the field.

The number of actors can be also be determined by setting a var, so id actor limit var is equal to set var, everything resets.

This way the highest agility always hits 100 first and makes the first hit. To ensure the player wins tie breaks, check the players agility first.

In this case, an agility of 10 would take 10 loops for the character to play, but an agility of 11 would only take 9 loops, thus playing first.
I used a variable to track every battler's agility and set the turn order based on that by returning the highest value, then used a boolean array to track which battlers have taken a turn and set their agility to 0 depending on if the bool was on or off.
Pages: 1