- Joined
- Sep 12, 2008
- Messages
- 657
okay, i've made a mpi code in jass, that is praticly like meat hook of pudge wars..
i was curious on how it worked, so i tried making it..
it works perfect for me, exept the repeat part..
if i use the spell once, and repeat it again after it comes back, the unit doesnt appear.. any help?
i was curious on how it worked, so i tried making it..
it works perfect for me, exept the repeat part..
if i use the spell once, and repeat it again after it comes back, the unit doesnt appear.. any help?
JASS:
library Hook
globals
private integer array Hook_Distance
private integer array Hook_Count
private location array Hook_RPoint
endglobals
function Trig_Hook_Func001A takes nothing returns nothing
if Hook_Distance[GetPlayerId(GetOwningPlayer(GetEnumUnit()))] == 600 then
if Hook_Count[GetPlayerId(GetOwningPlayer(GetEnumUnit()))] >= 0 then
call SetUnitPositionLoc(GetEnumUnit(), Hook_RPoint[Hook_Count[GetPlayerId(GetOwningPlayer(GetEnumUnit()))]])
set Hook_RPoint[Hook_Count[GetPlayerId(GetOwningPlayer(GetEnumUnit()))]] = null
set Hook_Count[GetPlayerId(GetOwningPlayer(GetEnumUnit()))] = Hook_Count[GetPlayerId(GetOwningPlayer(GetEnumUnit()))]-1
else
call RemoveUnit(GetEnumUnit())
set Hook_Diaatance[GetPlayerId(GetOwningPlayer(GetEnumUnit()))] = Hook_Distance[GetPlayerId(GetOwningPlayer(GetEnumUnit()))]-30
endif
else
call SetUnitPositionLoc(GetEnumUnit(), PolarProjectionBJ(GetUnitLoc(GetEnumUnit()), 30, GetUnitFacing(GetEnumUnit())))
set Hook_RPoint[Hook_Count[GetPlayerId(GetOwningPlayer(GetEnumUnit()))]] = GetUnitLoc(GetEnumUnit())
set Hook_Count[GetPlayerId(GetOwningPlayer(GetEnumUnit()))] = Hook_Count[GetPlayerId(GetOwningPlayer(GetEnumUnit()))]+1
set Hook_Distance[GetPlayerId(GetOwningPlayer(GetEnumUnit()))] = Hook_Distance[GetPlayerId(GetOwningPlayer(GetEnumUnit()))]+30
endif
endfunction
function Trig_Hook_Actions takes nothing returns nothing
call ForGroupBJ( GetUnitsOfTypeIdAll('h000'), function Trig_Hook_Func001A )
endfunction
endlibrary
//===========================================================================
//===========================================================================
function InitTrig_Hook takes nothing returns nothing
set gg_trg_Hook = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Hook, 0.05 )
call TriggerAddAction( gg_trg_Hook, function Trig_Hook_Actions )
endfunction