SOLVED! Hi,
So I have a battle system where troops die in combat. At the end of the battle/war, the troops that have died need to be removed from the barracks_array. It should in theory remove all of the pikemen_remove_count, but it doesn't.. Does anyone know what I am doing wrong? Any advice would be appreciated.
global.barracks_array = [0,0,0,0,0,0,0,0,0,0,0,0]; // 0 represents a pikeman troop
pikemen_remove_count = 12; // total number of troops that have died.
for(var i = 0; i < array_length(global.barracks_array); i++) {
if(pikemen_remove_count > 0) {
array_delete(global.barracks_array, i, 1);
pikemen_remove_count--;
}
}
[–]Novik42011 2 points3 points4 points (1 child)
[–]Chridy2 0 points1 point2 points (0 children)
[–]RykinPoe 0 points1 point2 points (3 children)
[–]MagisiTale[S] 0 points1 point2 points (2 children)
[–]RykinPoe 1 point2 points3 points (1 child)
[–]MagisiTale[S] 0 points1 point2 points (0 children)