HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Moving a Unit after summoning

10-12-2006, 06:59 PM#1
aidan_124
I'm trying to get a unit to move 0.5s after summoning. The unit changes ownership within that 0.5s:
Collapse JASS:
function Ethereal_Usher_Conditions takes nothing returns boolean
if GetSpellAbilityId() == 'A012' then
return true
endif
return false
endfunction

function Ethereal_Usher_Actions takes nothing returns nothing
local integer i = 1
local player array Team_1
local player array Team_2
local rect Team1LeftHome
local rect Team2RightHome

call SetRect(Team1LeftHome,-1728,-640,-1536,-128)
call SetRect(Team2RightHome,1728,-704,1920,-192)

call TriggerSleepAction( 0.5 )
loop
exitwhen i > 5
if  IsUnitOwnedByPlayer(GetSummoningUnit(),ConvertedPlayer(i)) == true then
call SetUnitPositionLoc(GetSummonedUnit(), GetRectCenter(Team2RightHome) )
endif
if IsUnitOwnedByPlayer(GetSummoningUnit(),ConvertedPlayer(i+5)) == true then
call SetUnitPositionLoc(GetSummonedUnit(), GetRectCenter(Team1LeftHome) )
endif
set i = i + 1
endloop
//This is supposed to be the unit moving part, but nothing happens :/

endfunction

function InitTrig_Ethereal_Usher takes nothing returns nothing
local trigger gg_trg_Ethereal_Usher
set gg_trg_Ethereal_Usher = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Ethereal_Usher,EVENT_PLAYER_UNIT_SUMMON)
call TriggerAddCondition(gg_trg_Ethereal_Usher,Condition(function Ethereal_Usher_Conditions))
call TriggerAddAction(gg_trg_Ethereal_Usher,function Ethereal_Usher_Actions)
endfunction
10-12-2006, 07:07 PM#2
Fyrestorm
I'm not sure of the problem here, but changing
Collapse JASS:
function Ethereal_Usher_Conditions takes nothing returns boolean
if GetSpellAbilityId() == 'A012' then
return true
endif
return false
endfunction
to
Collapse JASS:
function Ethereal_Usher_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A012' 
would surely be more efficient for a start.
Secondly, I'd advise you to use timers instead of TriggerSleepAction().
10-12-2006, 07:21 PM#3
aidan_124
ok, changed condition...you'd have to explain how to use timers coz im a noob :/