Snippet Damage Counter

Jesus4Lyf

Good Idea™
Reaction score
397
Mm. Suffering from the same problems movement tracking did - unit ids recycling and all. You should make the real array an AIDS struct - for the same efficiency you will get the safety by setting the count to 0 in AIDS_onCreate.

So [LJASS]DamageCount[GetUnitIndex(GetTriggerUnit())][/LJASS] would be [LJASS]MySimpleDataStruct[GetTriggerUnit()].damageCount[/LJASS].
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
Okay i have updated the snippet can it be approved now
 

Jesus4Lyf

Good Idea™
Reaction score
397
I think a better design of this would be a struct.
JASS:
struct DamageCounter
    static method create takes unit whichUnit returns thistype
    method getDamage takes nothing returns real
    method destroy takes nothing returns nothing
endstruct

Maybe adding "pauseTracking" and "unpauseTracking" or something. This would be really cool, because then you can support multiple trackings of one unit. :thup:

At the moment I feel the interface is illogical and limited. It does not capture the real point of damage counting.

>struct DC extends array
This should be private?

Anyway, you'd need a doubly linked list of these structs attached to unit to update them correctly. :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top