JASS:
function Trig_Crush_PushEmBack takes nothing returns nothing
//Local variable declarations
//Units
local unit PickedUnit = GetEnumUnit()
local unit TriggeringUnit = GetTriggerUnit()
//Reals
local real Angle
//Locations
local location PickedUnitLoc = GetUnitLoc(PickedUnit)
local location TargetLoc = GetSpellTargetLoc()
local location pushbackedMinus200
//Loop Debug stuff
local boolean loccheck = false
local integer loopdebug = 0
//Declarations done
//Set the declared but not defined variables
set Angle = AngleBetweenPoints(TargetLoc, PickedUnitLoc)
set pushbackedMinus200= PolarProjectionBJ(TargetLoc, 200.00, Angle)
//Variables done
// call UnitDamageTargetBJ( TriggeringUnit, PickedUnit, 200.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_ENHANCED )
call SetUnitPositionLocFacingLocBJ( PickedUnit, GetUnitLoc(PickedUnit), TargetLoc)
loop
exitwhen loccheck == true
if (pushbackedMinus200 == GetUnitLoc(PickedUnit)) then
set loccheck = true
set loopdebug = loopdebug-1
else
set loopdebug = loopdebug+1
call MoveUnitBack(loopdebug, PickedUnit, TargetLoc, Angle)
call TriggerSleepAction(0.020)
endif
endloop
endfunction
here's the other functions that it calls;
JASS:
function PolarMinus5 takes real angle returns location
local real x = GetLocationX(GetUnitLoc(GetEnumUnit())) + 5.00 * Cos(angle * bj_DEGTORAD)
local real y = GetLocationY(GetUnitLoc(GetEnumUnit())) + 5.00 * Sin(angle * bj_DEGTORAD)
return Location(x, y)
endfunction
function MoveUnitBack takes integer loopdebug, unit PickedUnit, location TargetLoc, real Angle returns nothing
//Moves the unit back 5 distance and causes it to face the spell center
local location face = TargetLoc
local location loc = PolarMinus5(Angle)
call SetUnitPositionLoc(PickedUnit, loc)
call SetUnitFacing(PickedUnit, AngleBetweenPoints(loc, face))
call DisplayTextToForce(GetPlayersAll(),I2S(loopdebug))
endfunction
okay, the trigger only runs MoveUnitBack once, I want it to run at least 20 times, call MoveUnitBack is in a loop that SHOULD run like 20 times, and not 1 time, what have I done wrong?