Fatal Error

AdamGriffith

You can change this now in User CP.
Reaction score
69
For some reason I am getting a fatal error with this trigger:

JASS:
scope Projectile initializer Init

globals
    multiboard MULTIBOARD = CreateMultiboard()
    real VELOCITY_X = 0.0
    real VELOCITY_Y = 0.0
    real VELOCITY_Z = 0.0
    real X = 0.0
    real Y = 0.0
    real Z = 0.0
    timer TIMER = CreateTimer()
    unit UNIT
endglobals

private function TimerCallback takes nothing returns nothing
    set X = X + (VELOCITY_X / 32.0)
    set Y = Y + (VELOCITY_Y / 32.0)
    set Z = Z + (VELOCITY_Z / 32.0)
    call SetUnitX(UNIT, X)
    call SetUnitY(UNIT, Y)
    call MultiboardSetItemValueBJ(MULTIBOARD, 2, 1, R2S(X))
    call MultiboardSetItemValueBJ(MULTIBOARD, 2, 2, R2S(Y))
    call MultiboardSetItemValueBJ(MULTIBOARD, 2, 3, R2S(Z))
endfunction
    
public function Create takes real x, real y, real z, real velx, real vely, real velz returns nothing
    set UNIT = CreateUnit(Player(0), 'h000', x, y, 0.0)
    call SetUnitFlyHeight(UNIT, z, 0.0)
    set X = x
    set Y = y
    set Z = z
    set VELOCITY_X = velx
    set VELOCITY_Y = vely
    set VELOCITY_Z = velz
    call MultiboardSetItemValueBJ(MULTIBOARD, 2, 1, R2S(X))
    call MultiboardSetItemValueBJ(MULTIBOARD, 2, 2, R2S(Y))
    call MultiboardSetItemValueBJ(MULTIBOARD, 2, 3, R2S(Z))
    call TimerStart(TIMER, 0.03125, true, function TimerCallback)
endfunction

//===========================================================================
private function Init takes nothing returns nothing
    local trigger t = CreateTrigger()
    call MultiboardSetRowCount(MULTIBOARD, 3)
    call MultiboardSetColumnCount(MULTIBOARD, 2)
    call MultiboardSetTitleText(MULTIBOARD, "Projectile")
    call MultiboardDisplay(MULTIBOARD, true)
    call MultiboardSetItemValueBJ(MULTIBOARD, 1, 1, "x")
    call MultiboardSetItemValueBJ(MULTIBOARD, 1, 2, "y")
    call MultiboardSetItemValueBJ(MULTIBOARD, 1, 3, "z")
endfunction

endscope
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
JASS:
call MultiboardSetRowCount(MULTIBOARD, 3)
    call MultiboardSetColumnCount(MULTIBOARD, 2)
    call MultiboardSetTitleText(MULTIBOARD, "Projectile")
    call MultiboardDisplay(MULTIBOARD, true)
    call MultiboardSetItemValueBJ(MULTIBOARD, 1, 1, "x")
    call MultiboardSetItemValueBJ(MULTIBOARD, 1, 2, "y")
    call MultiboardSetItemValueBJ(MULTIBOARD, 1, 3, "z")


Try move those into some action function and use the event "Elapsed Gametime is .5 seconds" or something silimar.
 

Xorifelse

I'd love to elaborate about discussions...........
Reaction score
87
JASS:

Is merged with the main globals block, which means its initialized at map initialization.
This causes the crash.

But I dont understand on why you want a public MULTIBOARD.
"private multiboard mb" can be accessed from withing the scope without any prefixes.
And if for any reason you want to beable to access the multiboard variable outside of the scope you can do it with the prefix of the scope.
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top