Snippet Damage Counter

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
when i didt create a new trigger for some reason the damage that was added when a unit takes damage was multiplied by how many units was added to the trigger.
 

uberfoop

~=Admiral Stukov=~
Reaction score
177
That's because you're adding a triggeraction every time you register a unit.
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
No wonder thanks ill get on fixing that

Edit: fixed
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
but they are used so they must not be destroyed
 

uberfoop

~=Admiral Stukov=~
Reaction score
177

Becase you're registering an event per unit which never gets destroyed. Most mappers argue that event leaks are so tiny that unless you're being an idiot it doesn't matter either way, which is generally true: handles by themselves can be pretty small, and you can register tens of events per second and watch the memory usage go up, and then you can press a few arrow keys and watch as the memory usage starts going up several times faster. Considering how few units generally exist on a map over a game this is usually a non-issue. In fact, for most situations, it's probably more efficient in run-time to just let the events build up. However, J4L demands dynamic triggers to clear the leaks, hence why everyone here has been telling you that a submission on TH like this will probably have to use J4L's Damage.

but they are used so they must not be destroyed
Unless the unit dies.
 

Jesus4Lyf

Good Idea™
Reaction score
397
Becase Most mappers argue that event leaks are so tiny that unless you're being an idiot it doesn't matter either way, which is generally true: handles by themselves can be pretty small, and you can register tens of events per second and watch the memory usage go up, and then you can press a few arrow keys and watch as the memory usage starts going up several times faster.
Are they really this small? I had no idea.
Maybe I should investigate.
... When I have WC3. :p
 

Viikuna

No Marlo no game.
Reaction score
265
Actually, I just argued about this stuff in that simple damage detection system thread.

If you really care about event leaks, one good way would be to do something like Griffen does in his Light and Leakless Damage Detection system, and just swap your damage detection trigger to new one, every few minutes and destroy the old one.

I just dont know how big spike that creates when trigger is "refreshed".

Then again, you can have one dynamic trigger per unit, but thats just waste. You end up creating and destroying handles alla time, when you could just do it with one trigger handle.

Recycling units is one cool option, because then you dont leak any unit specific thingies. Ofc unit recycling is unnecessary hard to make for some maps, so it cant really solve world hunger or anything. But when it works its really cool.
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
so periodically create a new trigger and destroy the old. I already have a group so when a unit dies i just remove it for the group and when i create the new trigger just pick the group and add the event for enum units?
 

Viikuna

No Marlo no game.
Reaction score
265
Yea, you need to detect when unit is actually removed from the game.

I think grim001´s status event stuff is pretty cool. It detects animate death, ressurection and reincarnate at least. ( Although, you can also trigger that stuff, which makes detecting simple )
 

Jesus4Lyf

Good Idea™
Reaction score
397
I think grim001´s status event stuff is pretty cool. It detects animate death, ressurection and reincarnate at least. ( Although, you can also trigger that stuff, which makes detecting simple )
Kinda off topic, isn't useful here. ;)

>you need to detect when unit is actually removed from the game.
That.
 

Azlier

Old World Ghost
Reaction score
461
JASS:
function DamageCountRemoveUnit takes unit remove returns nothing
    if IsUnitInGroup(remove, DCG) == true then
        call GroupRemoveUnit(DCG, remove)
    endif
endfunction


That's not how you detect a removed unit. Native hook on RemoveUnit and some Undefend hax are what you require.
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
what i dont understand most of the paragraph could you rephrase in newbie jasser language please.
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
should it look like that and waht is the point of it?
 
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