Actually I have troubles on sorting Units based on a custom Initiative integer value (inherited from Unit Parent and different for every unit: for example enemy ranged has an initiative value of 5, player ranged has 6 etc.) … basically I’ve implemented an insertion sort algorythm but it doesn’t work in clean way.
Anybody here has implemented a working sorting algorythm?
It seems like that the GET function during debug gets a wrong value on the array index… for example a* where i=4 and array has 5 elements (0,1,2,3,4) get a value out of bounds (none value) but it should pick the correct value as I can see in the debugger… not easy to explain at all.
Any suggestion?