- Joined
- Jul 29, 2007
- Messages
- 5,174
I just tried making a simple arc movement with timers but I got kinda stuck since im a total noob in JASS.
The code is this (yes I know it does nothing and it sucks, you can laugh at me if you want)
Basicly what I wanted to do was making the unit "jump" untill the height is worth the distance beetwin point 1 and point 2, and then come down the same way.
Now the problem is, I don't know how to use timers for this, can I call functions from other triggers, so I can use a normal timer event ?
I don't really want you guys to make me the code since im doing this to learn how to use JASS, but hints and bits of code would be nice and helpfull![Stick Out Tongue :p :p](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
The code is this (yes I know it does nothing and it sucks, you can laugh at me if you want)
JASS:
function Trig_Untitled_Trigger_002_Actions takes nothing returns nothing
local real maxpower = DistanceBetweenPoints(GetUnitLoc(GetTriggerUnit()), GetSpellTargetLoc())
local location l = GetSpellTargetLoc()
local real a = x.l
local real b = y.l
local timer time
local integer start = 1
local integer end = 30
loop
exitwhen start > end
set start = start + 1
call SetUnitPositionLoc( GetTriggerUnit(), PolarProjectionBJ(GetUnitLoc(GetTriggerUnit()), 10.00, GetUnitFacing(GetTriggerUnit())) )
call StartTimerBJ( time, true, 0.02 )
endloop
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_002 takes nothing returns nothing
set gg_trg_Untitled_Trigger_002 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Untitled_Trigger_002, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddAction( gg_trg_Untitled_Trigger_002, function Trig_Untitled_Trigger_002_Actions )
endfunction
Basicly what I wanted to do was making the unit "jump" untill the height is worth the distance beetwin point 1 and point 2, and then come down the same way.
Now the problem is, I don't know how to use timers for this, can I call functions from other triggers, so I can use a normal timer event ?
I don't really want you guys to make me the code since im doing this to learn how to use JASS, but hints and bits of code would be nice and helpfull