I'm new to structs

Romek

Super Moderator
Reaction score
963

Magthridon96

Member
Reaction score
2
Same for these:

JASS:
private function pressl takes nothing returns nothing
    if left[GetPlayerId(GetTriggerPlayer())] == true then
        set left[GetPlayerId(GetTriggerPlayer())] = false
    else
        set left[GetPlayerId(GetTriggerPlayer())] = true
    endif
endfunction


->

JASS:
private function pressl takes nothing returns nothing
    set left[GetPlayerId(GetTriggerPlayer())] = not left[GetPlayerId(GetTriggerPlayer())]
endfunction


---------------------------------------------

JASS:
private function pressu takes nothing returns nothing
    if up[GetPlayerId(GetTriggerPlayer())] == true then
        set up[GetPlayerId(GetTriggerPlayer())] = false
    else
        set up[GetPlayerId(GetTriggerPlayer())] = true
    endif
endfunction


->

JASS:
private function pressu takes nothing returns nothing
    set up[GetPlayerId(GetTriggerPlayer())] = not up[GetPlayerId(GetTriggerPlayer())]
endfunction


--------------------------------------------

Is suspect you're using AIDS, so:

JASS:
private function setglobals takes nothing returns nothing
    local shipdata ud=shipdata.create()
    set ship[0] = CreateUnit(Player(0),'H000',-3000.,-3000.,0.)
    call SetUnitUserData(ship[0],ud)
    call ud.store(ship[0],GetPlayerId(GetOwningPlayer(ship[0])))
endfunction


Using SetUnitUserData will break it :p

Instead, a simple hashtable save/load or array lookup would be better :3

Another thing:

In your turn function:

JASS:
if b==true and this.y < d then
    set this.y = this.y + a
elseif c==true and this.y > d*(-1) then
    set this.y = this.y - a
endif


It could be:

JASS:
if b and .y < d then
    set .y = .y + a
elseif c and .y > -d then
    set .y = .y - a
endif


Also:

JASS:
call PanCameraToTimed(x,y,0.)
call SetCameraRotateMode(x,y,Deg2Rad(270+GetUnitFacing(ship<i>)),0.)
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE,3900.,0.)
</i>


That would affect all players :p
Using these calls inside a GetLocalPlayer block would be the solution. (If this is a problem to begin with lol)

----
And I believe 0.03125 is the proper timer interval for high-frequency periodic stuff :p
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top