T
Tofu Heavy Industries
Guest
I have an Rpg im making, with 6 slots in an array for enemies in the battle screen (global.enemy_slot[0-5]). They each take their turn when their alarm is ready (each has an alarm in the obj_control_battle object). I use the below script to try to stagger the enemies actions if multiple ones are ready at one time.
obj_control_battle alarm[x] event
It checks each enemy in the enemy array lower than themselves, and if one is acting, it adds +20 to its own alarm to create the stagger. Each alarm event for each enemy has the almost the exact same code.(Except alarm #, and iii 'less than' X comparison).
Problem is, after the 1st or second turn, no matter how many enemies there are, it will mess up and some enemies will act at the same time. How do i fix this?
obj_control_battle alarm[x] event
Code:
for(iii=0;iii<6;iii+=1) {
if ((instance_exists(global.enemy_slot[iii]) && (iii < 2)) ) {
if (alarm[iii+1] == global.enemy_slot[iii].en_fightgauge) {
alarm[3] += 20;
exit;
}
}
}
Problem is, after the 1st or second turn, no matter how many enemies there are, it will mess up and some enemies will act at the same time. How do i fix this?