| 12-10-2007, 10:44 PM | #1 |
The following trigger works, but causes horrible lag at the first callback of the timer. Any reason why? JASS:function TetherSoulHeal takes nothing returns nothing local timer t = GetExpiredTimer() local unit u = udg_TetherSoulTarget local real x = GetUnitX(u) local real y = GetUnitY(u) if (GetUnitAbilityLevel(u, 'BHbn') > 0 ) then call UnitDamageTargetBJ(udg_VoidBeast,u,10.00,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL) call DummyCasterUnitTarget(udg_VoidBeast, udg_VoidBeast, x, y, 'A02G','A02F',"shadowstrike") set u = null else call DestroyTimer(t) set t = null endif endfunction function Trig_Tether_Soul_Actions takes nothing returns nothing local timer t = CreateTimer() set udg_TetherSoulTarget = GetSpellTargetUnit() call TimerStart(t,1.00,true,function TetherSoulHeal) set t = null endfunction The timer is meant to stop calling back after a unit loses a buff. Thanks ahead of time. |
| 12-10-2007, 11:21 PM | #2 |
It would most likely be tat you havent preloaded a spell effect, the dumym ability that your casting most likely has a spell effect, preload it |
| 12-10-2007, 11:25 PM | #3 |
I don't know how to pre-load spell effects (if you don't mind telling or directing me to a tutorial) The DummyCasterUnitTarget() function is a custom one I made that just does a dummy spell. The dummy spell in question is just a modified shadow strike. Will that still cause lag? Because it happens when the spell is cast multiple times, not just the first time. |
| 12-10-2007, 11:54 PM | #4 |
Use the Preload function, with the string being the string of the effect model (or soundor anything else). You only need to do it once, and it is supposed to be done at map initialization Also your code isnt multinstancable (need to use H2I for that) |
| 12-10-2007, 11:59 PM | #5 |
I am not sure why you are using a timer for that, since you are dependant on that global variable it is not multi instanceable and a 1 seconds period is big enough to allow you a loop with waits. |
| 12-11-2007, 12:06 AM | #6 |
@ Pandamine: I don't need it to be MUI, but thanks though @ Vex: I'm trying to learn how to use local timers, but I guess I overcomplicated it. Edit: Ok, this strange thing happened. I got lag from the spell no matter what. So I redid the spell using PolledWait(), just to made the code simpler. Problem is that it still lagged. I tried using different spell effects and such, but it didn't work itself out until I deleted the original dummy spell and make a new one exactly like it. I'm baffled. |
