Hello again ^___^
So i continue to make some jass thingies, and one day i got an idea to make knockbacking spell... But theres little problem. There goes the code:
this is first part.
And here goes main code:
(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 dunno what point is that, its not center of the map, but something little left and down from that. 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
Ugh i just tried something like that but it didnt work too. whyyyy the heelll. Its absolutely correct. As i think. Lol
So i continue to make some jass thingies, and one day i got an idea to make knockbacking spell... But theres little problem. There goes the code:
this is first part.
- Motion
-
Events
- Time - Every 0.03 seconds of game time
- Conditions
-
Actions
-
For each (Integer i) from 1 to num, do (Actions)
-
Loop - Actions
- Custom script:call motion(udg_i)
-
Loop - Actions
-
For each (Integer i) from 1 to num, do (Actions)
- Push Stream
-
Events
- Unit - A unit begins to cast an ability
-
Conditions
- (Ability being cast) equal to Push Stream
-
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)
And here goes main code:
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
local timer b = udg_PushTimer[i]
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 dunno what point is that, its not center of the map, but something little left and down from that. 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
Ugh i just tried something like that but it didnt work too. whyyyy the heelll. Its absolutely correct. As i think. Lol
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 location p3
local real a
local effect e = null
local timer b = udg_PushTimer[i]
if DistanceBetweenPoints(p, p2) > 0 and ( not ( TimerGetRemaining(GetLastCreatedTimerBJ()) < 0.20 ) ) then
set a = AngleBetweenPoints(p, p2)
set p3 = PolarProjectionBJ(p, 15.00, a)
call SetUnitPositionLoc( u, p3 )
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
Last edited: