• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Multiboard bug?

Status
Not open for further replies.
i made a small UI with a multiboard and multibars and all works perfect on my test map. then i CnP it inside my real map but nothing happens. i Debuged the whole library but didn't found something

here is the code (not 100% finished)
JASS:
library UI initializer InitUI requires Multibars, RtCKeyboard
    globals
        private multiboard UIBoard
        private Multibar array Bar
        
        private timer Tim=CreateTimer()
        private timer Temp=CreateTimer()
        
        constant real SpeedMultiplicator=1.4
        
        private constant integer Rows=10
        private constant integer Columns=20
        
        private unit Target
        private boolean Enabled=true
        
        string array Icon
        integer CurAttribute=1
        constant integer MaxAttribute=3
    endglobals
    
    private function UpdateUI takes nothing returns nothing
        if Enabled then
            call MultiboardMinimize(UIBoard, false)
            call Bar[0].UpdateValue(GetUnitStatePercent(Target, UNIT_STATE_LIFE, UNIT_STATE_MAX_LIFE), true)
            call Bar[1].UpdateValue(GetUnitStatePercent(Target, UNIT_STATE_MANA, UNIT_STATE_MAX_MANA), true)
            call Bar[2].UpdateValue(GetUnitStatePercent(Target, UNIT_STATE_MANA, UNIT_STATE_MAX_MANA), true)
        else
            call MultiboardMinimize(UIBoard, true)
        endif
    endfunction
    
    private function SelectAttribute takes nothing returns nothing
        if GetTriggerKey()==NUM_1 or GetTriggerKey()==NUM_2 or GetTriggerKey()==NUM_3 then
            set CurAttribute=GetTriggerKey()-NUM_0
            call BJDebugMsg(I2S(GetTriggerKey()-NUM_0))
            call MultiboardSetItemIconBJ(UIBoard,9,3,Icon[CurAttribute])
        endif
    endfunction
    
    private function CreateUI takes nothing returns nothing
        local Multibar mb
        local integer row=0
        local integer column=0
        set UIBoard=CreateMultiboard()
        call MultiboardSetColumnCount(UIBoard, Columns)
        call MultiboardSetRowCount(UIBoard, Rows)
        call MultiboardSetTitleText(UIBoard, "")
        loop
            exitwhen row==Rows
            loop
                exitwhen column==Columns
                call MultiboardSetItemStyleBJ(UIBoard,column,row,false,false)
                call MultiboardSetItemWidthBJ(UIBoard,column,row,100./Columns)
                set column=column+1
            endloop
            set row=row+1
        endloop
        //call MultiboardSetItemWidthBJ(UIBoard, 0, 1, 100.)
        set Bar[0]=Multibar.create(UIBoard, 0, 1, 5, 100., 100., MULTIBAR_TYPE_HEALTH)
        set Bar[1]=Multibar.create(UIBoard, 0, 2, 5, 100., 100., MULTIBAR_TYPE_MANA)
        set Bar[2]=Multibar.create(UIBoard,15, 1, 5, 100., 100., MULTIBAR_TYPE_RADIO)
        call MultiboardDisplay(UIBoard, true)
        call MultiboardMinimize(UIBoard, false)
        call MultiboardSetItemStyleBJ(UIBoard,9,3,false,true)
        call MultiboardSetItemIconBJ(UIBoard,9,3,Icon[CurAttribute])
        set Target=gg_unit_hfoo_0000
    endfunction
    
    function StartUI takes nothing returns nothing
        set Enabled=true
    endfunction
    
    function StopUI takes nothing returns nothing
        set Enabled=false
    endfunction
    
    private function InitUI takes nothing returns nothing
        call TimerStart(Tim,0.03,true,function UpdateUI)
        call TimerStart(Temp,0.,false,function CreateUI)
        call OnKeyPress(function SelectAttribute)
        set Icon[1]="ReplaceableTextures\\CommandButtons\\BTNBootsOfSpeed.blp"
        set Icon[2]="ReplaceableTextures\\CommandButtons\\BTNDeathPact.blp"
        set Icon[3]="ReplaceableTextures\\PassiveButtons\\PASBTNHardenedSkin.blp"
    endfunction
endlibrary

another question
how can i make that doodads or destructabels doesn't disapper if the origin of the model left the camera?

thx and +rep for the answer ;)
 
multibar sys
only changed the unit
EDIT: ok changed added this part:
JASS:
    private function SelectAttribute takes nothing returns nothing
        if GetTriggerKey()==NUM_1 or GetTriggerKey()==NUM_2 or GetTriggerKey()==NUM_3 then
            set CurAttribute=GetTriggerKey()-NUM_0
            call BJDebugMsg(I2S(GetTriggerKey()-NUM_0))
            call MultiboardSetItemIconBJ(UIBoard,9,3,Icon[CurAttribute])
        endif
    endfunction
 
Last edited:
Status
Not open for further replies.
Top