| 11-13-2007, 08:31 PM | #1 |
This time I can't see anything wrong with this, but like always the answer is gonna be super obvious. The problem is the actions don't seem to be running at all: JASS:function Trig_Thruster_Calc_Actions takes nothing returns nothing local real x local real y local real c local integer count local real angle loop set count = count + 1 call BJDebugMsg("here?") if udg_upcheck[count] then set x = udg_curspeed[count] * CosBJ(udg_curangle[count]) + udg_speedpersec[count] * CosBJ(GetUnitFacing(udg_ship[count])) set y = udg_curspeed[count] * SinBJ(udg_curangle[count]) + udg_speedpersec[count] * SinBJ(GetUnitFacing(udg_ship[count])) set c = SquareRoot(Pow(x,2) + Pow(y,2)) call BJDebugMsg ("Here?") set angle = AsinBJ(y/c) if c > udg_maxspeed[count] then set c = udg_maxspeed[count] endif set udg_curangle[count] = angle set udg_curspeed[count] = c endif exitwhen count == 8 endloop endfunction //=========================================================================== function InitTrig_Thruster_Calc takes nothing returns nothing set gg_trg_Thruster_Calc = CreateTrigger( ) call TriggerRegisterTimerEventPeriodic( gg_trg_Thruster_Calc, 0.03 ) call TriggerAddAction( gg_trg_Thruster_Calc, function Trig_Thruster_Calc_Actions ) endfunction None of the Debugs show any message. And the variable "upcheck" is turned to true when the user presses up, so what the heck is wrong? |
| 11-13-2007, 08:46 PM | #2 |
try this: local integer count = 0. And improve your code in this part: Change this: set c = SquareRoot(Pow(x,2) + Pow(y,2)) by this: set c = SquareRoot(x*x + y*y)). It's is much better. |
| 11-13-2007, 10:23 PM | #3 | |
Quote:
See theres always something small I miss :P Thanks both for the fix and the suggestion. |
