| 04-14-2004, 03:56 PM | #1 |
Can someone tell me why it is asking for an "endif" even though I have one? function Trig_Shadow_Pin_V2_Conditions takes nothing returns boolean if ( not ( GetSpellAbilityId() == 'A000' ) ) then return false endif return true endfunction function Trig_Shadow_Pin_V2_Actions takes nothing returns nothing // Set local variables. local unit oTarget = GetSpellTargetUnit() local real nWait = 0.50 local real nDelay = 0.75 local real nElapsed = 0.00 local real nDuration if IsUnitType(oTarget, UNIT_TYPE_HERO) then local real nDuration = 5.00 // <=====It says it Expected an "endif" else local real nDuration = 30.00 // <=====Here aswell endif // <===== But there is an "endif" here // Just incase the Caster Starts casting but is interupted. call PolledWait(nDelay) // Apply Effects. if UnitHasBuffBJ(oTarget, 'B000') then call PauseUnitBJ(true, oTarget) call SetUnitTimeScalePercent(oTarget, 0.00) call SetUnitVertexColorBJ(oTarget, 0.00, 0.00, 0.00, 75.00) call SetUnitInvulnerable(oTarget, true) // Add Unit to Global "ShadowPin" Group call GroupAddUnitSimple(oTarget, udg_ShadowPin ) endif // Wait for buff to be removed by spell or just wear off. loop call PolledWait(nWait) if not UnitHasBuffBJ(oTarget, 'B000') then // Exit Loop. exitwhen true endif set nElapsed = nElapsed + nWait exitwhen nElapsed >= nDuration endloop // Remove Effects. call UnitRemoveBuffBJ('B000', oTarget) call SetUnitTimeScalePercent(oTarget, 100.00) call PauseUnitBJ( false, oTarget) call SetUnitVertexColorBJ(oTarget, 100.00, 100.00, 100.00, 0.00) call SetUnitInvulnerable(oTarget, false) endfunction //=========================================================================== function InitTrig_Shadow_Pin_V2 takes nothing returns nothing set gg_trg_Shadow_Pin_V2 = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Shadow_Pin_V2, EVENT_PLAYER_UNIT_SPELL_CAST ) call TriggerAddCondition( gg_trg_Shadow_Pin_V2, Condition( function Trig_Shadow_Pin_V2_Conditions ) ) call TriggerAddAction( gg_trg_Shadow_Pin_V2, function Trig_Shadow_Pin_V2_Actions ) endfunction Also.. How do you have a trigger that fires when a buff is applied to a unit? or, if you can't, then what is the target called for the second half of the SpellSteal ability, I know it's not GetSpellTargetUnit() that just returns the guy your pulling the buff off, I want to know what the designation for the guy your putting the buff onto, that would be very useful for getting around some CustomSpells/SpellSteal issues. Thank you for your time. |
| 04-14-2004, 10:35 PM | #2 |
The word 'local' is only used to declare a local variable (which is done at the top of a function). To assign a value to the variable you'll have to use 'set' Code:
if IsUnitType(oTarget, UNIT_TYPE_HERO) then
set nDuration = 5.00
else
set nDuration = 30.00
endif |
| 04-14-2004, 10:41 PM | #3 |
I didn't know that, Thanks! |
