• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

Some sort of MUI conflict

Status
Not open for further replies.
Hi all the Hive members and helpers! I have a sort of the handle problem. When I run the spell under this code for two same heroes at the same time, I receive some non-MUI ending... The special effect only vanishes from the last caster. Screenshot of handle checking.

JASS:
function Trig_SandStorm_Conditions takes nothing returns boolean
     return GetSpellAbilityId() == 'A000'
endfunction

function SandStormEffectRemove takes nothing returns nothing
     local timer t = GetExpiredTimer()
     local timer t2 = LoadTimerHandle(udg_SandHeroHashtable,GetHandleId(t),3)
     local effect e = LoadEffectHandle(udg_SandHeroHashtable,GetHandleId(t),1)
     local unit caster = LoadUnitHandle(udg_SandHeroHashtable,GetHandleId(t),2)
     set udg_SandStormEnded[GetPlayerId(GetOwningPlayer(caster))] = true
     call BJDebugMsg("Unit Name: " + GetUnitName(caster))
     call BJDebugMsg("Unit Owner ID: " + I2S(GetPlayerId(GetOwningPlayer(caster))))
     call BJDebugMsg("Expired Timer Handle: " + I2S(GetHandleId(t)))
     call UnitRemoveAbility(caster,'A001')
     call UnitAddAbility(caster,'A000')
     call DestroyEffect(e)
     call PauseTimer(t2)
     call DestroyTimer(t)
     call DestroyTimer(t2)
     set e = null
     set t = null
endfunction

function SandStormGroupFilter takes nothing returns boolean
     local unit u = LoadUnitHandle(udg_SandHeroHashtable,GetHandleId(GetExpiredTimer()),2)
     local unit e = GetFilterUnit()
     if IsUnitEnemy(e,GetOwningPlayer(u)) then
         call UnitDamageTarget(u,e,50,true,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,WEAPON_  TYPE_WHOKNOWS)
     endif
     set u = null
     set e = null
     return false
endfunction

function SandStormSpellRepeat takes nothing returns nothing
     local timer t = GetExpiredTimer()
     local unit caster = LoadUnitHandle(udg_SandHeroHashtable,GetHandleId(t),2)
     local group g = CreateGroup()
     call GroupEnumUnitsInRange(g,GetUnitX(caster),GetUnitY(caster),200,Filter(function SandStormGroupFilter))
     set g = null
     set t = null
     set caster = null
endfunction

function Trig_SandStorm_Actions takes nothing returns nothing
     local unit caster = GetSpellAbilityUnit()
     local effect e = AddSpecialEffectTarget("war3mapImported\\SandTornado.mdx",caster,"origin")
     local integer id = GetPlayerId(GetOwningPlayer(caster))
     local timer array st
     local timer array et
     set st[id] = CreateTimer() // Spell Timer
     set et[id] = CreateTimer() // Effect Timer
     set udg_SandHeroHashtable = InitHashtable()
     call SaveEffectHandle(udg_SandHeroHashtable,GetHandleId(et[id]),1,e)
     call SaveUnitHandle(udg_SandHeroHashtable,GetHandleId(st[id]),2,caster)
     call SaveUnitHandle(udg_SandHeroHashtable,GetHandleId(et[id]),2,caster)
     set udg_SandStormEnded[GetPlayerId(GetOwningPlayer(caster))] = false
     call TimerStart(st[id],1,true,function SandStormSpellRepeat)
     call TimerStart(et[id],udg_SandStormDur[GetUnitAbilityLevel(caster,'A000')],false,function SandStormEffectRemove)
     call BJDebugMsg("Source Timer Handle: " + I2S(GetHandleId(et[id])))
     call BJDebugMsg("Started an Effect timer with duration: " + I2S(udg_SandStormDur[GetUnitAbilityLevel(caster,'A000')]))
     call SaveTimerHandle(udg_SandHeroHashtable,GetHandleId(et[id]),3,st[id])
     call UnitRemoveAbility(caster,'A000')
     call UnitAddAbility(caster,'A001')
     set et[id] = null
     set caster = null
     set st[id] = null
     set e = null
endfunction

//===========================================================================
function InitTrig_SandStorm takes nothing returns nothing
     set gg_trg_SandStorm = CreateTrigger()
     call TriggerRegisterAnyUnitEventBJ(gg_trg_SandStorm,EVENT_PLAYER_UNIT_SPELL_EFFECT)
     call TriggerAddCondition(gg_trg_SandStorm,Condition(function Trig_SandStorm_Conditions))
     call TriggerAddAction(gg_trg_SandStorm,function Trig_SandStorm_Actions)
endfunction
 
Status
Not open for further replies.
Top