| 11-22-2006, 01:43 AM | #1 |
EDIT Problem FIXED! Even if the trigger looks huge, don't worry, the problem is small and most of the trigger works out. So... here it is: JASS:function Trig_Earth_Quake_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A03P' endfunction function Trig_Earth_Quake_ImpaleLoop takes nothing returns nothing local timer t = GetExpiredTimer() local unit cast = GetHandleUnit(t, "caster") local location l = GetHandleLocation(t, "Castloc") local integer i = GetHandleInt(t, "times") local location k local location j local player p = GetOwningPlayer(cast) local unit u call BJDebugMsg( I2S(i) ) call BJDebugMsg(GetPlayerName(p)) set k = PolarProjectionBJ( l, 600.00, (22.50 * i) ) set j = PolarProjectionBJ( l, 600.00, ((22.50 * i) + 22.50 ) ) set u = CreateUnit( p, 'h003', GetLocationX(k), GetLocationY(k), bj_UNIT_FACING ) call UnitAddAbility(u, 'A03G') call SetUnitAbilityLevel(u, 'A03G', 1 ) call IssuePointOrderLoc(u, "impale", j ) call UnitApplyTimedLife( u, 'BTLF', 5.00 ) set i = i + 1 call SetHandleInt(t, "times", i) endfunction function Trig_Earth_Quake_Actions takes nothing returns nothing local unit cast = GetTriggerUnit() local location l = GetUnitLoc(cast) local location k local timer t = CreateTimer() local location j local integer i = 1 local unit u local player p = GetOwningPlayer(cast) call PauseUnit(cast, true) loop exitwhen i > 16 set k = PolarProjectionBJ(l, 100.00, ( 22.50 * i )) set u = CreateUnit( p, 'h003', GetLocationX(l), GetLocationY(l), bj_UNIT_FACING ) call UnitAddAbility(u, 'A03G') call SetUnitAbilityLevel(u, 'A03G', GetUnitAbilityLevel(cast, 'A03P') ) call IssuePointOrderLoc( u, "impale", k ) call UnitApplyTimedLife( u, 'BTLF', 5.00 ) set i = i + 1 endloop call TriggerSleepAction(0.25) set i = 1 call SetHandleHandle(t, "Castloc", l) call SetHandleHandle(t, "caster", cast) call SetHandleInt(t, "times", i) call TimerStart(t,0.08,true,function Trig_Earth_Quake_ImpaleLoop) call TriggerSleepAction(1.20) call FlushHandleLocals(t) call DestroyTimer(t) set i = 1 loop exitwhen i > 16 set k = PolarProjectionBJ(l, 600.00, ( 22.50 * i )) set u = CreateUnit( p, 'h003', GetLocationX(k), GetLocationY(k), bj_UNIT_FACING ) call UnitAddAbility(u, 'A03G') call SetUnitAbilityLevel(u, 'A03G', GetUnitAbilityLevel(cast, 'A03P') ) call IssuePointOrderLoc( u, "impale", l ) call UnitApplyTimedLife( u, 'BTLF', 5.00 ) set i = i + 1 endloop call PauseUnit(cast, false) call RemoveLocation(l) call RemoveLocation(j) call RemoveLocation(k) set j = null set l = null set k = null set p = null set u = null set cast = null set t = null endfunction //=========================================================================== function InitTrig_Earth_Quake takes nothing returns nothing set gg_trg_Earth_Quake = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Earth_Quake, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_Earth_Quake, Condition( function Trig_Earth_Quake_Conditions ) ) call TriggerAddAction( gg_trg_Earth_Quake, function Trig_Earth_Quake_Actions ) endfunction Ok, onto explaining: The trigger is simply a reworked version of Ravage in DotA, which throws Impales in all directions. The first loop (Skip the first 2 functions for now) does that and it works. Now, I want the second loop to do the same, but impales go from 600 distance to the caster. It also works perfectly. Now onto... The problem. Between the 2 loops there are some lines, which include handles. It starts a timer which calls a function, and since we can't take parameters the best solution is using the handle variables. What this is supposed to do is make impales cast around the target, from angle 22.50 to 360 degrees, so about 15-16 times. It casts 16 impales around him, like this. O = caster Code:
___
/ \
/ O \
\ /
¯¯They go from Right to left, and come back to right after making a full circle. Technically this is what it's supposed to do. Real problem is: Nothing is casted. Now, as I always try to fix my problems, I included Debug msgs and stuff! Problem is... the debugmsgs indicate everything should work. The integer msg shows 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17... Like it is supposed to. The player message shows my name, like it is supposed to. But I gave the dummy a model actually. Footman, and I saw it DIDN'T create a dummy, and that's why it does nothing. But why doesn't it create a dummy ? There must be something about handles that I missed or anything, because I don't understand why it never creates the dummy :P Thanks in advance (Sorry for long post) EDIT: It works, but at center of map. Dunno why !! |
| 11-22-2006, 02:10 AM | #2 |
This is beside the point, but I would look at running the spell a bit differently rather than waiting 1.20 seconds and then destroying the timer. Gamecache looks to be stored correctly. Do you use handles in any of your other triggers? Maybe you've got something wrong with the custom script for handlevars. |
| 11-22-2006, 02:21 AM | #3 |
My handle triggers work perfectly I use them in about 10 triggers ;) EDIT: I'm curious to how you would proceed ! :P |
| 11-22-2006, 12:17 PM | #4 |
I hate to point out the obvious, but have you checked your dummy unit ID? If they aren't showing up, but your debug messages are, then that's the only real reason I can see. |
| 11-22-2006, 08:57 PM | #5 |
It is the right one. After a bit more testing I'd conclude that the problem should be around the line "CreateUnit" and more precisely, The location. But how ? lol. I'm really puzzled. |
| 11-22-2006, 09:12 PM | #6 |
Shouldn't it create them at loc k? Also, you can use the CreateUnitAtLoc native, rather than turning the location to co-ordinates, or you can work fully in co-ordinates (which is faster, I think). Either way would be an improvement. Oh, and pause timer T before you destroy it, or it could/will bug. |
| 11-22-2006, 09:54 PM | #7 |
Breaking news: The spell works, but at the center of playable map area -_- It casts the impales at the middle of the map, in short. It creates the dummies and all. EDIT: I got it to work. It seems GetHandleLocation doesn't really get a location so I used 2x GetHandleReal to get the coordinates of that location and used those to define the location. Thanks everyone! |
