I'm working with some spells, and I've been having problems with one ability based on Immolation. The spell is called Soul Control, and it takes control of the best enemy unit nearest to the caster, but it drains mana proportionally to the level of the controlled unit.
Everything works fine except in one thing. If the caster dies while the immolation effect is active, when I revive it, it reborns paused (I can select it, but I looks disabled)
I've checked if I have any bug in the code, but it looks fine.
Is probably the ability itself?? Am I missing something??
Any help will be really appreciated, thanks beforehand.
EDIT: If you want to catch the bug, the caster must have very few life and mana at the same time.
//******************************************************************************************//*//* CSSafety 14.0//* ¯¯¯¯¯¯¯¯//*//* Utilities to make things safer. Currently this simply includes a timer recycling//* Stack. Once you replace CreateTimer with NewTimer and DestroyTimer with ReleaseTimer//* you no longer have to care about setting timers to null nor about timer related issues//* with the handle index stack.//*//******************************************************************************************libraryCSSafety//==========================================================================================globalstimerarraycs_timersintegercs_timern = 0endglobals//==========================================================================================functionNewTimertakesnothingreturnstimerif (cs_timern==0) thenreturnCreateTimer()
endifsetcs_timern=cs_timern-1returncs_timers[cs_timern]
endfunction//==========================================================================================functionReleaseTimertakestimertreturnsnothingcallPauseTimer(t)
if (cs_timern==8191) thendebugcallBJDebugMsg("Warning: Timer stack is full, destroying timer!!")
//stack is full, the map already has much more troubles than the chance of bugcallDestroyTimer(t)
elsesetcs_timers[cs_timern]=tsetcs_timern=cs_timern+1endifendfunctionendlibraryfunctionInitTrig_CSSafetytakesnothingreturnsnothingendfunction
I tested the map out and found no problems (except one small unrelated thing). When the hero died while the immolation was active, and was then resurrected, the hero could walk around fine, and his ability worked perfectly normally.
The small bug is that if the unit you are controlling dies, you should order the hero to unimmolation.
Maybe I didn't exactly understand his problem, and didn't notice what it was when it happened? Could you explain it in more detail perhaps. The ability functioned correctly for me even after revival, and even if it was active when the hero died.
The small bug is that if the unit you are controlling dies, you should order the hero to unimmolation
Ohh yes, that's something that I have to fix, but this bug appeared first and it's very important for me to fix that.
I've tested more and I've found when it really happens, when the life and the mana of the caster are very low at the same time (let's say, 5% life and mana). So try to put the caster in this state and test, you will have more chances to see this weird bug.
Theres no need. The damage taken event always fires precisely before the unit actually takes the damage, so if a fatal blow is going to be dealt, the last thing that happens before the unit actually takes the damage is this trigger will be run. I added the "remove buffs" part in case the unit is stunned etc. This should be 100% foolproof.
There is such a thing called using timers that expire in 0 seconds.
I heard blu say this..(I think I got it right..)
Use the Unit takes damage event. Store everything you need in variables, attach them to a timer, run the timer and make it expire in 0 seconds and call a function. Use the called function for whatever you want.