HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Trigger wont work...

07-28-2004, 03:15 AM#1
loudness90
When i try to test map it says... Line 76 Expected Variable Name..Line 77 Expected Name...Line 78 Expected Name...line 79 Expected NAme....

//============================================================================
// Trigger: Spell Cast
// Script Author: ME
// Info: This Trigger casts a spell on all units around the caster.
//
//
// enemy: 0 = Target own units 1 = Target enemy/neutral units
// spell: change its tho the command you want for example "antimagicshell"
// radius: the radius of the item.
//============================================================================

function Trig_Spell_Conditions takes nothing returns boolean
return ( GetUnitTypeId(GetSummonedUnit()) == 'nrdr' )
endfunction

function Trig_Spell_Filter takes nothing returns boolean
local integer enemy = 0 // 0 = Target own units 1 = Target enemy/neutral units
if (enemy == 1) then
return ( GetOwningPlayer(GetFilterUnit()) != GetOwningPlayer(GetSummoningUnit()) )
else
return ( GetOwningPlayer(GetFilterUnit()) == GetOwningPlayer(GetSummoningUnit()) )
endif
endfunction

function Trig_Spell_CastSpell takes nothing returns nothing
local string spell = "antimagicshell" // Change the spell to whatever you want
call CreateNUnitsAtLocFacingLocBJ( 1, 'nC01' , Player(0), GetUnitLoc(GetEnumUnit()), GetUnitLoc(GetEnumUnit()) )
call IssueTargetOrderBJ( GetLastCreatedUnit(), spell, GetEnumUnit() )
endfunction

function Trig_Spell_RemoveCaster takes nothing returns nothing
call RemoveUnit( GetEnumUnit() )
endfunction

function Trig_Spell_Actions takes nothing returns nothing
local real radius = 512 // change this value for bigger or smaller range
call RemoveUnit( GetSummonedUnit() )
call ForGroup( GetUnitsInRangeOfLocMatching(radius, GetUnitLoc(GetSummoningUnit()), Condition(function Trig_Spell_Filter)), function Trig_Spell_CastSpell )
call TriggerSleepAction( 0.10 )
call ForGroup( GetUnitsOfTypeIdAll('nC01'), function Trig_Spell_RemoveCaster)
endfunction

//===========================================================================
function InitTrig_Spell_Cast takes nothing returns nothing
set gg_trg_Spell_Cast = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Spell_Cast, Player(0), EVENT_PLAYER_UNIT_SUMMON )
call TriggerAddCondition( gg_trg_Spell_Cast, Condition( function Trig_Spell_Conditions ) )
call TriggerAddAction( gg_trg_Spell_Cast, function Trig_Spell_Actions )
endfunction
07-28-2004, 02:00 PM#2
johnfn
Errrrr... Can you tell us what is line 77, 78, and 79? Because there is no way to know without clever guesswork... And I think it highlights them or something similar, so it would be convienant to know.