looking for an formula

Sartan

New Member
Reaction score
23
if i have x units stored in a unit varible with array
and if 1 of these units die, i want to remove the dead unit from my unit array and set all units above the unit that died one step lower.

for example:

i got 5 units stored in unit array called U[1], U[2] ... U[5].
if U[3] dies, U[4] will be set to U[3] and U[5] will be set to U[4].

could someone give me the formula for this?
 

jig7c

Stop reading me...-statement
Reaction score
123
Trigger:
  • ur trig
    • events
      • a unit dies
    • conditions
    • actions
      • for each integer a from (the unit number which died) to (however many units you got, the last number)
        • loop
          • if/then/else
            • if
              • (dying unit) equal to u[integer a]
            • then
              • set U[integer a] = U[integer a - 1]
              • ----use arithmetic func to get ^
              • ----not sure, still thinking---
            • else


let me think, hold on...
im pretty sure you will need a unit-group and put all those units in that group!

edit: something like the above trigger should work.. i dont have WE on this comp, so this is coming from my head...
 

Zanderist

New Member
Reaction score
5
I've actually done something like this.

That's the old verison of that map. (1.0b)


Here's the Newer test verison. Try (1.1a)
 

Sartan

New Member
Reaction score
23
cant say it realy helped me^^ since i cant se the connection from that to my problem^^
 

Zanderist

New Member
Reaction score
5
It's a unit array that goes down when one of the towers dies.

Because the index number is set to an integer. That increases as new units of the same type are introduced and decreases as they are killed or replaced.

However the problem in that map is if you kill the last tower you built no unit will spawn there. Though if you kill the second tower out of say 4, a footman will spawn there, he will die, and one tower will still remain.

Are these units the same?

If they are just go with a unit group.
 

Sartan

New Member
Reaction score
23
no my units are x diffrent units. based on their current health and i cant do it like you have done it, when a unit dies, i need all units to be put at the right order at the same time.
 

Dirac

22710180
Reaction score
147
Event
A unit dies
Conditions
---
Actions
Loop Integer A 1 to 10
If
Triggering unit equal to Var[IntegerA]
Then
Loop Integer B from 1 to Integer A
Set Var[Integer B - 1] equal to Var[Integer B]
Else
----
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top