Hey there.
I'm still struggling with the same problem for over half a year now, and decided to not look further for someone that wants to take over creating the system I need, but I'm going to give it a go again with my own approach.
I was wondering if there's anyone here that could give me info or thoughts about the following:
Given: There are 16 units owner by Player A and 16 units owner by Player B on the field. Every unit can attack for up to 3 hits, but a dead unit can (obviously) not attack anymore after dying.
- When 'combat' starts the first (as in unit with highest 'speed' stat) unit will randomly chose a target from the opponent's units and approach it to strike it once. Then that target can strike back if it still has one of the 3 hits left (cus any unit can only attack 3 times). Then they repeat this until both units have 0 strikes left.
- Then the unit with the 2nd highest speed will approach a randomly chosen enemy, and the same will happen. This will continue until all units have used their 3 strikes.
Now this scenario happens quite often in the map I'm working on, so I'm trying to think of a way to make this go faster. If unit A attacks unit B, and later on unit C attacks unit D. The outcomes of this fighting has no effect on eachother, so I thought I need a way to let these 2 battles happen simultaneously so that I save time and players don't have to watch an endless combat scene in slo-mo.
Is there a way to 'calculate' the outcome of all these mini battles beforehand so I can (after calculating) order units to move in waves and attack in groups. Imagine unit A attacking unit B and killing it, and then unit C has randomly selected unit A as its target and kills unit A. In this case I don't want unit A to die before unit B dies, else the whole kill order makes no sence. So I need a smart way of creating an order of events within this battle.
I hope its understandable, and I hope there's a smart guy out that that knows a good way to handle this in Jass. I don't have that much experience with Jass, so I would appreciate some more detailed information instead of answers like 'Use this', or check 'Hashtables' or whatever.
Thanks in advance!
I'm still struggling with the same problem for over half a year now, and decided to not look further for someone that wants to take over creating the system I need, but I'm going to give it a go again with my own approach.
I was wondering if there's anyone here that could give me info or thoughts about the following:
Given: There are 16 units owner by Player A and 16 units owner by Player B on the field. Every unit can attack for up to 3 hits, but a dead unit can (obviously) not attack anymore after dying.
- When 'combat' starts the first (as in unit with highest 'speed' stat) unit will randomly chose a target from the opponent's units and approach it to strike it once. Then that target can strike back if it still has one of the 3 hits left (cus any unit can only attack 3 times). Then they repeat this until both units have 0 strikes left.
- Then the unit with the 2nd highest speed will approach a randomly chosen enemy, and the same will happen. This will continue until all units have used their 3 strikes.
Now this scenario happens quite often in the map I'm working on, so I'm trying to think of a way to make this go faster. If unit A attacks unit B, and later on unit C attacks unit D. The outcomes of this fighting has no effect on eachother, so I thought I need a way to let these 2 battles happen simultaneously so that I save time and players don't have to watch an endless combat scene in slo-mo.
Is there a way to 'calculate' the outcome of all these mini battles beforehand so I can (after calculating) order units to move in waves and attack in groups. Imagine unit A attacking unit B and killing it, and then unit C has randomly selected unit A as its target and kills unit A. In this case I don't want unit A to die before unit B dies, else the whole kill order makes no sence. So I need a smart way of creating an order of events within this battle.
I hope its understandable, and I hope there's a smart guy out that that knows a good way to handle this in Jass. I don't have that much experience with Jass, so I would appreciate some more detailed information instead of answers like 'Use this', or check 'Hashtables' or whatever.
Thanks in advance!