• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Apply timed life not working as intended

Status
Not open for further replies.
Level 2
Joined
Jan 2, 2013
Messages
24
Hello everyone!
I'm here to ask for help about, as the title says, apply timed life command.
I have three custom spells, almost totally operating with triggers, that use dummy units for special effects. Two of them can generate more then 50 dummies during 5 seconds, depending on how many enemies are affected. This, though, wouldn't be a problem (there is absolutely no lag involved) if it wasn't for the fact that these units stay on the map even though i succesfully apply timed life on them. Here is an example:
JASS:
call CreateNUnitsAtLoc( 1 , 'h001', Player(PLAYER_NEUTRAL_PASSIVE), loc, 0)
call UnitApplyTimedLifeBJ( 1.00, 'BTLF', GetLastCreatedUnit() )
First of all, loc is a tmp variable used only to be removed afterwards to avoid leaks. The model for this unit is the visual effect of the ability drain life (dark archer) on the target. After 1 second, it succesfully disappears BUT the unit still remains in the map (i've used a trigger to count units in the map). So I tried to make a test by removing locust from the dummy unit; the result was that I was able to select the unit for 1 second, after that amount of time the selection ring disappeared along with the unit(visually speaking), but the unit was still in the map counting with the count function. This basically happens with all of my dummies, so either I'm doing something horribly wrong, or there is something weird going on, may be something that has to deal with death animations or something. Also, I cannot use RemoveUnit because most of these Dummy creation commands are inside loops and I'm not really good with hashtables. Actually, even hashtables are ok if nothing else, just with some help as I'm not used to use them :D
Can someone help me? This is a very big problem for my map, as this leak is probably too big and will cause too much lag in the long term!
PS: If you want I can post the entire code of one of the abilities, around 60 lines!
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
make a second trigger that runs every time unit dies and checks if the unit is dummy(add some list like Unit-Type of triggering unit equals to mydummy1 or Unit-Type of triggering unit equals to mydummy2 etc for each dummy on map and them call Unit - Remove Triggering Unit
its because there is a constant in Gameplay constants called decay duration or something like that which makes skeletons of your fallen units to remain on the map for that time on the map for things like canibalize etc..
second alternative is to add to every dummy you create(either in object editor or by triggers) ability that no other unit has, for instance some copy of channel and then go Unit Dies, if Level of MyDummyAbility bigger than 0 then Unit - Remove Triggering Unit

Chaosy, 'BTLF' is a buff(Buff Timed Life i believe) not the id of unit, the unit is the third argument
 
Level 2
Joined
Jan 2, 2013
Messages
24
Set their death type to can't raise, does not decay. Units have decay time of 88 seconds.

With that set, units will disappear after ther Death time (object editor value).

I even thought about that, don't know why I didn't try. It was that simple, problem solved! Thank you very much! :)

EDIT: Maker I cannot give you +rep because you already helped me yesterday!! What can I do??

@edo494: ty for your help, but i was just worried about units cumulating during a whole match. If they are destroyed anyway it's ok, even if that happens minutes after! Ty anyway!
 
Status
Not open for further replies.
Top