Cokemonkey11
Spell Reviewer
- Joined
- May 9, 2006
- Messages
- 3,570
JASS:
globals
unit array nativeTent
endglobals
scope nativeTentPlacement initializer i
globals
private constant integer PLACECODE='A003'
private constant integer TIEDOWNPLACECODE='A005'
private constant real BLUETYPEX=-5708
private constant real BLUETYPEY=-4804
endglobals
private function c takes nothing returns boolean
return GetSpellAbilityId()==PLACECODE
endfunction
private function a takes nothing returns nothing
local location where=GetSpellTargetLoc()
local real x=GetLocationX(where)
local real y=GetLocationY(where)
if GetTerrainType(x,y)==GetTerrainType(BLUETYPEX,BLUETYPEY) then
set nativeTent[GetPlayerId(GetOwningPlayer(GetSpellAbilityUnit()))]=CreateUnit(GetOwningPlayer(GetSpellAbilityUnit()),'h007',x,y,270)
call UnitRemoveAbility(GetSpellAbilityUnit(),GetSpellAbilityId())
call UnitAddAbility(GetSpellAbilityUnit(),TIEDOWNPLACECODE)
else
call DisplayTextToPlayer(GetOwningPlayer(GetSpellAbilityUnit()),0,0,"|cff999900Tent|r placement |cff990000failed|r.")
endif
call RemoveLocation(where)
endfunction
private function i takes nothing returns nothing
local trigger t=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(t,Condition(function c))
call TriggerAddAction(t,function a)
endfunction
endscope
The unit gets the old ability removed, but the new one isn't replaced. I even tried copy pasting the add ability and trying the new one, and on top of that I tried remaking said dummy ability with a different base ID (breath of fire instead of carrion swarm)
I also tried giving the ability to a different unit, and tried comparing rawcodes to verify it was the correct one.
I also tried checking the ability level and was able to conclude that the casting unit was legitimately not getting the new ability at all.
Anyone got any ideas?
Edit: Wow okay what. the. fuck.
Toadcop suggested I do this:
JASS:
call PauseUnit(GetSpellAbilityUnit(),true)
call UnitRemoveAbility(GetSpellAbilityUnit(),GetSpellAbilityId())
call UnitAddAbility(GetSpellAbilityUnit(),TIEDOWNPLACECODE)
call PauseUnit(GetSpellAbilityUnit(),false)
And the unit never got unpaused. Meaning the thread is being terminated halfway through the trigger (i think). TT What do I do!?