Ok so here's the ability setup that I have:
One hero has two skills. One skill summons a fire bear unit. The other skill summons an ice bear unit. Both of these units have an ability for a 6 item inventory that wont let them use items, but will let them pick them up and hold them.
Im making two separate scripts for each summoned unit that stores the items in an array when they die and when the unit is next summoned, puts the items back into the inventory.
Here is my script so far:
I need to know why the effect isnt being removed in the part:
Thanks for the help.
One hero has two skills. One skill summons a fire bear unit. The other skill summons an ice bear unit. Both of these units have an ability for a 6 item inventory that wont let them use items, but will let them pick them up and hold them.
Im making two separate scripts for each summoned unit that stores the items in an array when they die and when the unit is next summoned, puts the items back into the inventory.
Here is my script so far:
JASS:
function Is_Storing takes nothing returns boolean
return ( GetUnitTypeId(GetDyingUnit()) == 'n004' )
endfunction
function Is_Restoring takes nothing returns boolean
return ( GetSpellAbilityId() == 'A00B' )
endfunction
function Trig_AG_Items_Frost_Actions takes nothing returns nothing
local item array AG_Bear_Inventory
local integer AG_Item_Index = 0
local location AG_Summoner_Index
local location AG_Death_Pos
local effect AG_Death_Effect
local unit AG_Item_Recipient
if ( Is_Storing() == true ) then
loop
exitwhen (AG_Item_Index == 6)
call DisplayTextToForce( GetPlayersAll(), I2S(AG_Item_Index) ) //DEBUG OUTPUT
set AG_Bear_Inventory[AG_Item_Index] = UnitItemInSlot(GetDyingUnit(), AG_Item_Index)
set AG_Item_Index = (AG_Item_Index + 1)
endloop
set AG_Death_Pos = GetUnitLoc(GetDyingUnit())
call AddSpecialEffectLoc("Abilities\\Spells\\Orc\\SpiritLink\\SpiritLinkZapTarget.mdl", AG_Death_Pos)
set AG_Death_Effect = bj_lastCreatedEffect
set AG_Death_Pos = null
call RemoveLocation(AG_Death_Pos)
call RemoveUnit(GetDyingUnit())
call TriggerSleepAction(3)
call DestroyEffect(AG_Death_Effect)
set AG_Death_Effect = null
endif
endfunction
//==== Init Trigger AG_Items_Frost ====
function InitTrig_AG_Items_Frost takes nothing returns nothing
set gg_trg_AG_Items_Frost = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_AG_Items_Frost, EVENT_PLAYER_UNIT_DEATH )
call TriggerRegisterAnyUnitEventBJ(gg_trg_AG_Items_Frost, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddAction(gg_trg_AG_Items_Frost, function Trig_AG_Items_Frost_Actions)
endfunction
I need to know why the effect isnt being removed in the part:
JASS:
set AG_Death_Pos = GetUnitLoc(GetDyingUnit())
call AddSpecialEffectLoc("Abilities\\Spells\\Orc\\SpiritLink\\SpiritLinkZapTarget.mdl", AG_Death_Pos)
set AG_Death_Effect = bj_lastCreatedEffect
set AG_Death_Pos = null
call RemoveLocation(AG_Death_Pos)
call RemoveUnit(GetDyingUnit())
call TriggerSleepAction(3)
call DestroyEffect(AG_Death_Effect)
set AG_Death_Effect = null
Thanks for the help.