- Joined
- Jul 30, 2018
- Messages
- 445
Hey!
I have a map where I've tried to create a turn based combat. So, I was planning to use the unit's Custom Value for unit's "Initial" as in that speed that determines how often the unit gets a turn.
So far I've made so that each turn all units gain their Custom Value (so their chance to be the next randomly chosen unit for the next turn rises) and once a unit is chosen for the current turn, then I set the Custom Value back to zero again. My plan is to prevent from same unit having consecutive turns (unless intended) and once a unit gets a turn, it's kind of pushed last on the line, and also make certain units have a higher chance to be chosen to get their turn.
So, the question is, is there a way to call a unit with highest Custom Value (or any other value, for that matter)? What I know have is "Pick every unit in (Random 1 units from (Units in Battlefield <gen> matching ((Custom value of (Matching unit)) Greater than or equal to 10))) and do (Actions)".
But my current system is flawed with the fixed threshold, because when there's a lot of units on the game, many slower units will get over it and can be chosen before the faster units, and when there's less units, none might be over the magical line.
The randomness elements is not a necessity. I'd be happy with a system that always picks the unit with highest gained Custom Value (as "faster" units gain it faster, they would be on the top more often).
Thanks already in advance for your advice!
I have a map where I've tried to create a turn based combat. So, I was planning to use the unit's Custom Value for unit's "Initial" as in that speed that determines how often the unit gets a turn.
So far I've made so that each turn all units gain their Custom Value (so their chance to be the next randomly chosen unit for the next turn rises) and once a unit is chosen for the current turn, then I set the Custom Value back to zero again. My plan is to prevent from same unit having consecutive turns (unless intended) and once a unit gets a turn, it's kind of pushed last on the line, and also make certain units have a higher chance to be chosen to get their turn.
So, the question is, is there a way to call a unit with highest Custom Value (or any other value, for that matter)? What I know have is "Pick every unit in (Random 1 units from (Units in Battlefield <gen> matching ((Custom value of (Matching unit)) Greater than or equal to 10))) and do (Actions)".
But my current system is flawed with the fixed threshold, because when there's a lot of units on the game, many slower units will get over it and can be chosen before the faster units, and when there's less units, none might be over the magical line.
The randomness elements is not a necessity. I'd be happy with a system that always picks the unit with highest gained Custom Value (as "faster" units gain it faster, they would be on the top more often).
Thanks already in advance for your advice!