- Joined
- Nov 9, 2011
- Messages
- 326
When the unit dies from enemy i check what lvl it is to give the exp based on the basic formula(slightly changed) for the exp. now it wont check the level of the unit somehow? Does that only work for heroes?
Example for showing that detecting a level of a dying unit works
Events
Unit - A Unit Dies
Conditions
(Triggering Unit) Equal to 'Your Unit) == You can use unit type then
Actions
Set RIP_Unit = (Triggering Unit)
Game - Show (Integer To String (Level of RIP_Unit)) to All Players
------ Ok if it shows the unit level then it's ok, u can do anything. ------
The Only possibility I can guess if the trigger above doesn't work , the issue would be :
Events
Unit - A Unit dies
Conditions
Actions
Unit - Remove (Triggering Unit) from the game == This will interrupt last trigger :/ so if you have a trigger like this, remove it or modify it , I don't suggest this.
If a unit dies, he still exists, unless you remove it.Try this :
Example for showing that detecting a level of a dying unit works
Events
Unit - A Unit Dies
Conditions
(Triggering Unit) Equal to 'Your Unit) == You can use unit type then
Actions
Set RIP_Unit = (Triggering Unit)
Game - Show (Integer To String (Level of RIP_Unit)) to All Players
------ Ok if it shows the unit level then it's ok, u can do anything. ------
It may mess with this trigger ( If you have one that exists ):
The Only possibility I can guess if the trigger above doesn't work , the issue would be :
Events
Unit - A Unit dies
Conditions
Actions
Unit - Remove (Triggering Unit) from the game == This will interrupt last trigger :/ so if you have a trigger like this, remove it or modify it , I don't suggest this.
One thing to note is that units always leak 4kb of memory. (Even when removed.)
You should try to avoid creating the units over and over again. Especially in spells.
Try to use one dummy unit for spells to lower this memory leak.
As for triggers there are lots of ways to do them with only one unit. You should try to do what you can to reduce the amount of units being created and removed.
When the unit dies from enemy i check what lvl it is to give the exp based on the basic formula(slightly changed) for the exp. now it wont check the level of the unit somehow? Does that only work for heroes?
What is the limit and i will try to do that
The limit for units is when the game crashes from running out of memory.
The best way as mentioned is to save the units into a hashtable based on their unit type then load them as needed.
To prevent lag from building up more the unused units onto a spot on the map that will not be seen for the game and hide the units.