- Joined
- Nov 22, 2009
- Messages
- 181
JASS:
function Trig_portal_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A000' ) ) then
return false
endif
return true
endfunction
function portal_actions takes nothing returns nothing
local location loc1 = GetRectCenter(RectFromCenterSizeBJ(GetUnitLoc(GetSpellAbilityUnit()), 100.00, 100.00))
local location loc2 = GetRectCenter(RectFromCenterSizeBJ(GetSpellTargetLoc(), 100.00, 100.00))
local unit portal1
local unit portal2
call CreateNUnitsAtLoc( 1, 'h000', GetOwningPlayer(GetSpellAbilityUnit()), loc1, bj_UNIT_FACING )
set portal1 = GetLastCreatedUnit()
call CreateNUnitsAtLoc( 1, 'h000', GetOwningPlayer(GetSpellAbilityUnit()), loc2, bj_UNIT_FACING )
set portal2 = GetLastCreatedUnit()
call WaygateSetDestinationLocBJ( portal1, loc2 )
call WaygateSetDestinationLocBJ( portal2, loc1 )
call RemoveLocation(loc1)
call RemoveLocation(loc2)
set loc1 = null
set loc2 = null
set portal1 = null
set portal2 = null
endfunction
function InitTrig_portal takes nothing returns nothing
set udg_portal = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( udg_portal, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( udg_portal, Condition( function Trig_portal_Conditions ) )
call TriggerAddAction( udg_portal, function portal_actions )
endfunction
Unit 'h000' is a custom unit called Portal with the waygate ability. This JASS script is supposed to create 2 Portals. One portal should be located at the casters location and the other should be located at the ability's target location. Then it should set the waygate destination of the first portal to the location of the second and vice versa. What did I do wrong for each line? I've tried testing the trigger but it says:
"Line 64:Expected a variable name"
the line is: "set gg_trg_portal = CreateTrigger( )"
"Line 65: Expected a name"
and it seems to go: "EVENT_PLAYER_UNIT_SPELL_FINISH" in the add event part of the InitTrig_portal function."
"Line 66: Expected a name"
then it shows and highlights: "Condition( function Trig_portal_Conditions ) )"
"Line 67: Expected a name"
it shows and highlights: ", function portal_actions )"
Last edited: