Cokemonkey11
New Member
- Reaction score
- 18
As I noted in this thread - http://www.thehelper.net/forums/showthread.php?t=107530
I turned .1 second wait action into a more final draft of every .03 game seconds.
Here is my code currently.
My question is - how do I stop the rotation from running without just "masking" it. I want the trigger to actually stop calling every .03 seconds.
Maybe an if then that says after 360 degrees cancel timer or something.
My other question is - You will see in this video http://www.xfire.com/video/30a05/ of my trigger running that the rifleman starts to attack the footman but after awhile he just stops and they both start trying to "walk" back to their original placed position. Is there any simple way of avoiding this? I think I could just put order rifle to attack footman at the loop every time, but then again maybe that won't work.
AFTER these questions I will be interested in ways of cleaning up/making better my trigger. But please don't just say DO THIS DO THAT, I'd like an explanation of whats changing and why it's better.
I turned .1 second wait action into a more final draft of every .03 game seconds.
Here is my code currently.
JASS:
globals
unit centerUnit
unit rifleAttacker
unit footAttacked
integer i
endglobals
function moveInCircle takes nothing returns nothing
local location posCenter = GetUnitLoc(centerUnit)
local location posCenterOff
local real posRifleOffX
local real posRifleOffY
local location posCenterOff2
local real posFootOffX
local real posFootOffY
set i = i+1
set posCenterOff = PolarProjectionBJ(posCenter,512,i)
set posRifleOffX = GetLocationX(posCenterOff)
set posRifleOffY = GetLocationY(posCenterOff)
set posCenterOff2 = PolarProjectionBJ(posCenter,450,i)
set posFootOffX = GetLocationX(posCenterOff2)
set posFootOffY = GetLocationY(posCenterOff2)
call SetUnitX(rifleAttacker,posRifleOffX)
call SetUnitY(rifleAttacker,posRifleOffY)
call SetUnitX(footAttacked,posFootOffX)
call SetUnitY(footAttacked,posFootOffY)
endfunction
function Trig_dummyCenter_Actions takes nothing returns nothing
local timer time = CreateTimer()
set centerUnit = CreateUnitAtLoc(Player(0),039;hfoo039;,GetRectCenter(GetPlayableMapRect()),270)
set rifleAttacker = CreateUnitAtLoc(Player(15),039;hrif039;,PolarProjectionBJ(GetRectCenter(GetPlayableMapRect()),512,0),270)
set footAttacked = CreateUnitAtLoc(Player(15),039;hfoo039;,PolarProjectionBJ(GetRectCenter(GetPlayableMapRect()),390,0),270)
call IssueTargetOrder(rifleAttacker,"attack",footAttacked)
set i = 0
call TimerStart(time,.03,true,function moveInCircle)
endfunction
function InitTrig_movingCircleFast takes nothing returns nothing
set gg_trg_movingCircleFast = CreateTrigger()
call TriggerRegisterTimerEvent(gg_trg_movingCircleFast,2,false)
call TriggerAddAction(gg_trg_movingCircleFast, function Trig_dummyCenter_Actions)
endfunction
My question is - how do I stop the rotation from running without just "masking" it. I want the trigger to actually stop calling every .03 seconds.
Maybe an if then that says after 360 degrees cancel timer or something.
My other question is - You will see in this video http://www.xfire.com/video/30a05/ of my trigger running that the rifleman starts to attack the footman but after awhile he just stops and they both start trying to "walk" back to their original placed position. Is there any simple way of avoiding this? I think I could just put order rifle to attack footman at the loop every time, but then again maybe that won't work.
AFTER these questions I will be interested in ways of cleaning up/making better my trigger. But please don't just say DO THIS DO THAT, I'd like an explanation of whats changing and why it's better.