- Joined
- Jul 14, 2011
- Messages
- 3,213
<< Edit >>
Nevermind, the cicle speed (angle increase) was too fast (high) so the Dummy was doing the full round around the target. My bad. This is Solved
Hi!
I'm helping someone with an abilty that makes some spirits move around a unit
I used this method to create the dummies in a Circular Shape around the Target of the ability. It works perfectly
Now I use this method to move the dummies around the target
It also works, but I noticed that the dummies remain the a circular Shape, and move around the target, but not in the same order like clock pointers. I Tough they would move with logic, like having Dummies 1, 2, 3, 4, 5 changing positions in the same order and keeping their original creation order, but it's not working like that. Instead the dummies are being moved to some random point in the circle; maintaining the shape, angle, speed, and everything just as if they were moving like clock pointers, but they're not.
Nevermind, the cicle speed (angle increase) was too fast (high) so the Dummy was doing the full round around the target. My bad. This is Solved
Hi!
I'm helping someone with an abilty that makes some spirits move around a unit
I used this method to create the dummies in a Circular Shape around the Target of the ability. It works perfectly
JASS:
function SpartSpiritSetActions takes nothing returns nothing
local unit Target = GetSpellTargetUnit()
local real DBS = 360 / Spart_SpiritCount // Distance between spirits
local integer looper = 0
local unit dummy
local real angle
local real x
local real y
local integer cv
loop
exitwhen looper == Spart_SpiritCount
set angle = (R2I(looper) * DBS) * bj_DEGTORAD
set x = GetUnitX(Target) + Spart_SpiritOffset * Cos(angle)
set y = GetUnitY(Target) + Spart_SpiritOffset * Sin(angle)
set dummy = CreateUnit(GetOwningPlayer(Target), Spart_SpiritId, x, y, 0)
set cv = GetUnitUserData(dummy)
set Spart_SpiritAngle[cv] = angle
set Spart_SpiritTarget[cv] = Target
call GroupAddUnit(Spart_SpiritProtectGroup, dummy)
set looper = looper+1
endloop
call EnableTrigger(gg_trg_SpartSpirit_Protect_Loop)
set Target = null
set dummy = null
endfunction
Now I use this method to move the dummies around the target
JASS:
function SpartSpirit_Protect_Loop_GroupActions takes nothing returns nothing
local unit dummy = GetEnumUnit()
local integer cv = GetUnitUserData(dummy)
local unit target = Spart_SpiritTarget[cv]
local real x
local real y
local real angle = Spart_SpiritAngle[cv] + Spart_SpiritSpeed
set Spart_SpiritAngle[cv] = angle
set x = GetUnitX(target) + Spart_SpiritOffset * Cos(angle)
set y = GetUnitY(target) + Spart_SpiritOffset * Sin(angle)
call SetUnitX(dummy, x)
call SetUnitY(dummy, y)
set dummy = null
set target = null
endfunction
It also works, but I noticed that the dummies remain the a circular Shape, and move around the target, but not in the same order like clock pointers. I Tough they would move with logic, like having Dummies 1, 2, 3, 4, 5 changing positions in the same order and keeping their original creation order, but it's not working like that. Instead the dummies are being moved to some random point in the circle; maintaining the shape, angle, speed, and everything just as if they were moving like clock pointers, but they're not.
Last edited: