| 02-03-2005, 05:34 PM | #1 |
What i need: now, i've been learned that locals can only be used in one function but i need the same in 2 now, anyone have any idea? the teal marked text is where i create the locals, and the lime colored is where i need it again. Any idea, thoughts? Code:
function Trig_Mass_Poison_Dagger_JASS_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A003' ) ) then
return false
endif
return true
endfunction
function Trig_Mass_Poison_Dagger_JASS_Func002002003 takes nothing returns boolean
return ( GetOwningPlayer(GetFilterUnit()) != GetOwningPlayer(GetSpellAbilityUnit()) )
endfunction
function Trig_Mass_Poison_Dagger_JASS_Func003A takes nothing returns nothing
call CreateNUnitsAtLoc( 1, 'h001', GetOwningPlayer(GetSpellAbilityUnit()), [color=Lime]CasterPoisonDaggerPoint[/color], 270.00 )
call ShowUnitHide( GetLastCreatedUnit() )
call UnitAddAbilityBJ( 'AEsh', GetLastCreatedUnit() )
call SetUnitAbilityLevelSwapped( 'AEsh', GetLastCreatedUnit(), GetUnitAbilityLevelSwapped(GetSpellAbilityId(), GetSpellAbilityUnit()) )
call IssueTargetOrderBJ( GetLastCreatedUnit(), "shadowstrike", GetEnumUnit() )
call UnitApplyTimedLifeBJ( 1.00, 'BTLF', GetLastCreatedUnit() )
endfunction
function Trig_Mass_Poison_Dagger_JASS_Actions takes nothing returns nothing
[color=Teal]local location CasterPoisonDaggerPoint
local group PoisonDaggerGroup[/color]
set CasterPoisonDaggerPoint = GetUnitLoc(GetSpellAbilityUnit())
set PoisonDaggerGroup = GetUnitsInRangeOfLocMatching(( 300.00 + ( 100.00 * I2R(GetUnitAbilityLevelSwapped(GetSpellAbilityId(), GetSpellAbilityUnit())) ) ), udg_CasterPoisonDaggerPoint, Condition(function Trig_Mass_Poison_Dagger_JASS_Func002002003))
call ForGroupBJ( PoisonDaggerGroup, function Trig_Mass_Poison_Dagger_JASS_Func003A )
call RemoveLocation( CasterPoisonDaggerPoint )
call DestroyGroup( PoisonDaggerGroup )
set CasterPoisonDaggerPoint = null
set PoisonDaggerGroup = null
endfunction
//===========================================================================
function InitTrig_Mass_Poison_Dagger_JASS takes nothing returns nothing
set gg_trg_Mass_Poison_Dagger_JASS = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Mass_Poison_Dagger_JASS, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Mass_Poison_Dagger_JASS, Condition( function Trig_Mass_Poison_Dagger_JASS_Conditions ) )
call TriggerAddAction( gg_trg_Mass_Poison_Dagger_JASS, function Trig_Mass_Poison_Dagger_JASS_Actions )
endfunction |
| 02-03-2005, 08:16 PM | #2 |
Create a global temporary variable to hold the group/point. Remember that the variable is just a pointer to the group/location object in memory, so you dont need to remove it in the other function if it's already being removed somewhere else. |
