- Joined
- Sep 20, 2015
- Messages
- 385
Hello, i am learning JASS and i can't figure out how to get the equivalent of there 2 GUI trigger is JASS. I think that i didn't understand how timers work in JASS, it seems tha ti can't use udg_variables.
Trigger 1
Of course the 0 index in all arrays should be replaced with GetPlayerId(GetTriggerPlayer) in GUI
A LoopForIntegerA should be in the actions here i know, i was just testing.
I wrote these in JASS.
Second JASS code block
Thanks in advance for the help
Trigger 1
Of course the 0 index in all arrays should be replaced with GetPlayerId(GetTriggerPlayer) in GUI
-
UnitFacingGUI
-
Events
- Player - Player 1 (Red) issues Mouse Move event
- Conditions
-
Actions
- Custom script: call RemoveLocation (udg_MousePosition[GetPlayerId(GetTriggerPlayer())])
- Set MousePosition[0] = (Mouse Position for Triggered Mouse Event)
- Set Fangle[0] = (Angle from (Position of PXHero[0]) to MousePosition[0])
- Unit - Make PXHero[0] face (Angle from (Position of PXHero[0]) to MousePosition[0]) over 0.00 seconds
-
Events
A LoopForIntegerA should be in the actions here i know, i was just testing.
-
FacingloopGUI
-
Events
- Time - FTimer expires
- Conditions
-
Actions
- Unit - Make PXHero[0] face Fangle[0] over 0.00 seconds
- Countdown Timer - Start FTimer as a One-shot timer that will expire in 0.01 seconds
-
Events
I wrote these in JASS.
JASS:
function Trig_UnitFacingJASS_Copy_Actions takes nothing returns nothing
local integer i = GetPlayerId(GetTriggerPlayer())
if BlzGetTriggerPlayerMouseX() != 0.00 and BlzGetTriggerPlayerMouseY() != 0.00 then
set udg_MousePosition[i] = BlzGetTriggerPlayerMousePosition()
set udg_Fangle[i] = AngleBetweenPoints(GetUnitLoc(udg_PXHero[i]), udg_MousePosition[i])
call RemoveLocation (udg_MousePosition[i])
call SetUnitFacing( udg_PXHero[i], udg_Fangle[i] )
call DisplayTimedTextToForce( GetPlayersAll(), 1.00, I2S(GetPlayerId(GetTriggerPlayer() )))
else
endif
endfunction
//===========================================================================
function InitTrig_UnitFacingJAss takes nothing returns nothing
local integer i=0
set gg_trg_UnitFacingJAss = CreateTrigger( )
loop
exitwhen(i > 24)
call TriggerRegisterPlayerEvent( gg_trg_UnitFacingJAss, Player(i), EVENT_PLAYER_MOUSE_MOVE )
set i = i + 1
endloop
call TriggerAddAction( gg_trg_UnitFacingJAss, function Trig_UnitFacingJASS_Copy_Actions )
endfunction
Second JASS code block
JASS:
function Trig_FacingLoopJASS_Actions takes nothing returns nothing
local integer i = 0
loop
exitwhen ( i > 24)
call SetUnitFacing( udg_PXHero[i], udg_Fangle[i] )
//call DisplayTimedTextToForce( GetPlayersAll(), 1.00, R2S(udg_Fangle[0]) )
set i = i + 1
endloop
//call SetUnitFacingTimed( udg_PXHero[0], udg_Fangle[0], 0 )
//call StartTimerBJ( udg_FTimer, false, 0.01 )
endfunction
//===========================================================================
function InitTrig_FacingLoopJASS takes nothing returns nothing
set gg_trg_FacingLoopJASS = CreateTrigger( )
call TriggerRegisterTimerExpireEventBJ( gg_trg_FacingLoopJASS, udg_FTimer )
call TriggerAddAction( gg_trg_FacingLoopJASS, function Trig_FacingLoopJASS_Actions )
endfunction
Thanks in advance for the help