HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Multi-instance Spell

08-22-2006, 01:01 PM#1
n13astra
Can someone check if this is mutli-instanceable.

Collapse JASS:
function Trig_Assimilate_Disrupter_Actions takes nothing returns nothing
    local unit un_Unit = udg_Assimilate_Unit[GetConvertedPlayerId(GetOwningPlayer(GetSpellTargetUnit()))]
    local effect ef_Effect = null
    local string st_effect = "Abilities\\Spells\\Orc\\LightningShield\\LightningShieldTarget.mdl"

    if(GetSpellAbilityId() == 'A05D') then
        call PauseUnitBJ(true, un_Unit)
        call AddSpecialEffectTargetUnitBJ("overhead", GetSpellTargetUnit(), st_effect)
        set ef_Effect = GetLastCreatedEffectBJ()
        call PolledWait(4.30)
        call DestroyEffectBJ(ef_Effect)
        call AddSpecialEffectTargetUnitBJ("overhead", GetSpellTargetUnit(), st_effect)
        set ef_Effect = GetLastCreatedEffectBJ()
        call PolledWait(0.70)
        call DestroyEffectBJ(ef_Effect)
        call PauseUnitBJ(false, un_Unit)
    endif

    set un_Unit = null
    set ef_Effect = null
    set st_effect = null
endfunction

//===========================================================================
function InitTrig_Assimilate_Disrupter takes nothing returns nothing
    set gg_trg_Assimilate_Disrupter = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Assimilate_Disrupter, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddAction(gg_trg_Assimilate_Disrupter, function Trig_Assimilate_Disrupter_Actions)
endfunction
08-22-2006, 01:32 PM#2
Daelin
Actually you should store GetSpellTargetUnit() into a local as well, for it will return no unit after the slightest wait. And replace the BJ functions with the equivalent native.

~Daelin
08-22-2006, 01:32 PM#3
Captain Griffen
local unit un_Unit = udg_Assimilate_Unit[GetConvertedPlayerId(GetOwningPlayer(GetSpellTargetUnit()))] is not fully multi-instanceable. What are you trying to get there?

Add a condition to the trigger, or it will run on all castings, which is inefficient. Strings do not need to be nullified.

Also suggest you extract the common.j and blizzard.j files (rename them to txt so you can read them). That is riddled with needless and pointless BJs.
08-23-2006, 03:15 AM#4
n13astra
udg_Assimilate_Unit[] is a unit array of size 10, which i use to keep track of the current players tank/hero. Is that still multi-instanceable or do i have to make 10 separate variables??

Ill add that condition, dont know why i removed it.