HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

*Little* moving problemz ;(

08-27-2007, 11:02 AM#1
Landalos
Hello :P Ive got strangle problem with spell that knockbacks target. Didnt really want to use some systems so tried to make easier thing on my own...
this is first part.
Trigger:
Motion
Collapse Events
Time - Every 0.03 seconds of game time
Conditions
Collapse Actions
Collapse For each (Integer i) from 1 to num, do (Actions)
Collapse Loop - Actions
Custom script:call motion(udg_i)

Trigger:
Push Stream
Collapse Events
Unit - A unit begins to cast an ability
Collapse Conditions
(Ability being cast) equal to Push Stream
Collapse Actions
Timer - Start PushTimer[num] as a single timer that will expire in 1.0 seconds
Set num = (num+1)
Set u[num] = (target unit of ability being cast)
Set PushPoint[num]= ((Position of u[num]) offset by 1000.00 towards (Angle from(Position of (Triggering Unit)) to (Position of u[num])) degrees)

This is something like initialize part :P

And here goes main code:

Collapse JASS:
function motion takes integer i returns nothing

local unit u = udg_u[i]
local location p = GetUnitLoc(u)
local location p2 = udg_PushPoint[i]
local real a
local effect e = null

if DistanceBetweenPoints(p, p2) > 0 and ( not ( TimerGetRemaining(GetLastCreatedTimerBJ()) < 0.20 ) ) then
   set a = AngleBetweenPoints(p, p2)
   call MoveLocation(p, GetLocationX(p) + 1 * CosBJ(a), GetLocationY(p) + 1 * SinBJ(a))
   call SetUnitPositionLoc( u, p )
else
    set udg_u[i]=udg_u[udg_num]
    set udg_i = udg_i-1 
    set udg_num = udg_num -1
    call AddSpecialEffectTargetUnitBJ( "origin", u, "Abilities\\Spells\\Human\\HolyBolt\\HolyBoltSpecialArt.mdl" )
    set e = GetLastCreatedEffectBJ()
    call PolledWait( 2 )
    call DestroyEffectBJ( e )
endif
 set u = null
call RemoveLocation(p)
call RemoveLocation(p2)
 set p = null
 set p2 = null
 set a = 0
endfunction

(ugh, i know that timer leak, but its not main problem, ill fix that later)

Well here is my problem - something strange is with unit moving oO It moves not to PushPoint, but to strange point in my map. I thnk this point is 0,0 coordinates. With any point errors in my triggers, these points move to this spot. Dunno why.
So, can someone tell me where is point error here? oO

P.S. Someone told me that problem is in event... Ugh?
08-28-2007, 07:08 AM#2
botanic
if it is moving to 0,0 then it means that the point is not a valid one ;P)
08-28-2007, 08:52 AM#3
Landalos
Ugh i see now lol.
Fixed problem. lol thanks.