- Joined
- Jul 25, 2009
- Messages
- 3,091
I have a squad system, the members of the squad are unselectable and locust units via a system I created with the insight of Fingolfin.
It's a standard squad system, all units are tethered by their custom values.
Ie, the leader has the same custom value of all members.
I want to redistribute the damage from the members to the squad leader.
If a squad member takes damage the leader takes the damage instead.
I'm not sure if I should do this with a checking loop, or a DDS? Or something more efficient. Right now I'm using a loop but it does not function properly.
Once the squad leader's hp drops below a certain threshhold, it will trigger the death of a squad member.
Example: Squad leaders health is 300, squad size is 3. Once the leader's health drops to 200, the squad size is reduced to 2, once it drops to 100, the squad size is reduced to 1 (just the leader remains).
This will make the squad system work exactly the same as in Dawn of War 2, where the health of the leader represents the health of the entire squad.
I've already devised a mathematical formula for removing member once the threshhold is reached, but it's not accurate enough, in the 300 HP example, the first threshhold is 198 instead of 200 and the second threshhold is 99 instead of 100.
So 100.00 / 3 = 33.33
I will also need to be able to detect when health is regenerated so that I can add squad members back to the squad after the leader's health reaches the same 200 and 300 threshholds.
If you can help with any of these 3 issues chime in.
It's a standard squad system, all units are tethered by their custom values.
Ie, the leader has the same custom value of all members.
I want to redistribute the damage from the members to the squad leader.
If a squad member takes damage the leader takes the damage instead.
I'm not sure if I should do this with a checking loop, or a DDS? Or something more efficient. Right now I'm using a loop but it does not function properly.
Once the squad leader's hp drops below a certain threshhold, it will trigger the death of a squad member.
Example: Squad leaders health is 300, squad size is 3. Once the leader's health drops to 200, the squad size is reduced to 2, once it drops to 100, the squad size is reduced to 1 (just the leader remains).
This will make the squad system work exactly the same as in Dawn of War 2, where the health of the leader represents the health of the entire squad.
I've already devised a mathematical formula for removing member once the threshhold is reached, but it's not accurate enough, in the 300 HP example, the first threshhold is 198 instead of 200 and the second threshhold is 99 instead of 100.
-
Set GPercentage[GNumber] = (100.00 / (Real((Point-value of (Trained unit)))))
So 100.00 / 3 = 33.33
-
(Percentage life of GLeader[(Custom value of (Picked unit))]) Less than or equal to (GPercentage[(Custom value of (Picked unit))] x (GCurrentSquadSize[(Custom value of (Picked unit))] - 1.00))
-
Then - Actions
-
Set TempUnit = (Random unit from GSquadMembers[(Custom value of (Picked unit))])
-
Unit Group - Remove TempUnit from GSquadMembers[(Custom value of (Picked unit))]
-
Set GCurrentSquadSize[(Custom value of (Picked unit))] = (GCurrentSquadSize[(Custom value of (Picked unit))] - 1.00)
-
Unit - Kill TempUnit
-
I will also need to be able to detect when health is regenerated so that I can add squad members back to the squad after the leader's health reaches the same 200 and 300 threshholds.
If you can help with any of these 3 issues chime in.