Sooda
Diversity enchants
- Reaction score
- 318
"whichUnit" was in my example local unit variable name. You totally have forgotten that if you use local variable you first have to declare it at the start of your function.
"whichUnit" is just a variable name, it could have been "thisIsVariableName" and it would give you same result.
How much JASS you know after all ?
"whichUnit" is just a variable name, it could have been "thisIsVariableName" and it would give you same result.
How much JASS you know after all ?
JASS:
function Trig_Ion_Shield_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 039;A001039;
endfunction
function Trig_Ion takes nothing returns nothing
local integer i = GetTriggerExecCount(GetTriggeringTrigger())
local real x = GetUnitX(udg_ShieldCaster<i>)
local real y = GetUnitY(udg_ShieldCaster<i>)
call SetUnitPosition(udg_ShieldDummies<i>,x,y)
endfunction
function Trig_Ion_Shield_Actions takes nothing returns nothing
local timer t = CreateTimer()
local integer i = GetTriggerExecCount(GetTriggeringTrigger())
set udg_ShieldCaster<i> = GetSpellAbilityUnit() // Same as GetTriggerUnit() but only worse.
local unit whichUnit = GetTriggerUnit()
local player whichPlayer = GetOwningPlayer(whichUnit)
call DisplayTextToForce( GetForceOfPlayer(whichPlayer) ), "|cffffcc00YOU HAVE ENABLED ION SHIELD|r." )
call RemoveUnit(bj_lastCreatedUnit)
<b>set udg_ShieldDummies<i> = CreateUnit(whichPlayer,039;h001039;,GetLocationX(udg_ShieldCasterLoc),GetLocationY(udg_ShieldCasterLoc),GetUnitFacing(whichUnit))</i></b><i>
set bj_lastCreatedUnit = udg_ShieldDummies<i>
call TimerStart(t,0.03,true,function Trig_Ion)
set whichUnit = null
endfunction
//===========================================================================
function InitTrig_Ion_Shield takes nothing returns nothing
set gg_trg_Ion_Shield = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Ion_Shield, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Ion_Shield, Condition( function Trig_Ion_Shield_Conditions ) )
call TriggerAddAction( gg_trg_Ion_Shield, function Trig_Ion_Shield_Actions )
endfunction</i></i></i></i></i></i>