• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Multiboard not displaying for player1, but player2

Status
Not open for further replies.
Level 11
Joined
Jun 30, 2008
Messages
580
So, I'm trying to display a multiboard locally to each player, usually I've never had a problem doing this and I can not seem to find the problem with the code. It displays the multiboard to player 2 only, the BJDebugMsg does run correct for both players. Anyone seeing what I'm doing wrong?

Here is the PlayerHUD struct

JASS:
    struct PHUD
        multiboard pHUD
        
        MultibarHelper pH
        MultibarHelper pE
        
        method ActivateHUD takes CHARDATA cd returns nothing
            local CHARDATA tempcd = cd
            local multiboarditem mitem = null
            local integer loop1 = 0
            local integer loop2 = 0
            local integer rows = 0
            
            set .pHUD = CreateMultiboard()
            call MultiboardDisplay(.pHUD, false)
                //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//  
                // Set Col and Rows
                set rows = 4
                call MultiboardSetColumnCount(.pHUD, COLUMNS)
                call MultiboardSetRowCount(.pHUD, rows)
                //
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
    // Row 1
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
                //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
                // Clear Rows and Cols
                
                    loop
                    exitwhen loop1 > COLUMNS
                        
                        loop
                        exitwhen loop2 > rows
                            
                            set mitem = MultiboardGetItem(.pHUD, loop2, loop1)
                            call MultiboardSetItemStyle(mitem, false, false)
                            call MultiboardSetItemWidth(mitem, CLEAR_ITEM_WIDTH) // Sets Cell Width
                            call MultiboardReleaseItem(mitem) // Clears multiboarditem mitem
                        
                        set loop2 = loop2+1
                        endloop
                        set loop2 = 0
                        
                    set loop1 = loop1+1
                    endloop
                    set loop1 = 0
                //   
                //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
                // Charater Icon
                set mitem = MultiboardGetItem(.pHUD, 0, 0)
                call MultiboardSetItemStyle(mitem, false, true) // Only Icon
                call MultiboardSetItemWidth(mitem, ICON_WIDTH) // Sets Cell Width
                call MultiboardReleaseItem(mitem) // Clears multiboarditem mitem
                //
                //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
                // Charater Name Space
                set mitem = MultiboardGetItem(.pHUD, 0, 1)
                call MultiboardSetItemStyle(mitem, false, false)
                call MultiboardSetItemWidth(mitem, NAME_SPACE) // Sets Cell Width
                call MultiboardReleaseItem(mitem) // Clears multiboarditem mitem
                //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
                // Charater Name
                set mitem = MultiboardGetItem(.pHUD, 0, 2)
                call MultiboardSetItemStyle(mitem, true, false) // Only Text
                call MultiboardSetItemValue(mitem, tempcd.cData.Name)
                call MultiboardSetItemWidth(mitem, NAME_WIDTH) // Sets Cell Width
                call MultiboardReleaseItem(mitem) // Clears multiboarditem mitem
                //
                //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
                
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
    // Row 2
    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
                //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
                // Bar Setup
                set loop2 = 1
                
                    loop // Loops through col to set Icon only
                    exitwhen loop1 > 11
                    
                        loop
                        exitwhen loop2 > 2
                        
                            set mitem = MultiboardGetItem(.pHUD, loop2, loop1)
                            call MultiboardSetItemStyle(mitem, false, true)
                            call MultiboardReleaseItem(mitem)
                        
                        set loop2 = loop2+1
                        endloop
                        set loop2 = 1
                        
                    set loop1 = loop1+1
                    endloop
                    set loop1 = 0
                
                //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
                // Health Bar Space
                set mitem = MultiboardGetItem(.pHUD, 1, 0)
                call MultiboardSetItemStyle(mitem, false, false)
                call MultiboardSetItemWidth(mitem, 0.01) // Sets Cell Width
                call MultiboardReleaseItem(mitem) // Clears multiboarditem mitem
                // Creates the Health Bar that displays on the Multiboard
                set .pH = MultibarHelper.create(tempcd.cData.Unit, .pHUD, 1, 1, 12, MULTIBAR_TYPE_HEALTH, MULTIBAR_HELPER_HEALTH)
                //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
                // Energy Bar Space
                set mitem = MultiboardGetItem(.pHUD, 2, 0)
                call MultiboardSetItemStyle(mitem, false, false)
                call MultiboardSetItemWidth(mitem, 0.01) // Sets Cell Width
                call MultiboardReleaseItem(mitem) // Clears multiboarditem mitem
                // Creates the Energy Bar that displays on the Multiboard
                set .pE = MultibarHelper.create(tempcd.cData.Unit, .pHUD, 1, 2, 12, MULTIBAR_TYPE_MANA, MULTIBAR_HELPER_MANA)
                //
                //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
            call MultiboardDisplay(.pHUD, GetOwningPlayer(tempcd.cData.Unit) == GetLocalPlayer())
            call BJDebugMsg("Multiboard Ran for " + GetPlayerName(GetOwningPlayer(tempcd.cData.Unit)))
            
            call tempcd.destroy()
        endmethod

And the CHARDATA struct

JASS:
   struct CHARDATA
        //CHARBOARD cbord
        UNITDATA cData
        UNITCHARS cChars
        PHUD mHUD
        
        static method create takes unit u returns CHARDATA
            local CHARDATA c = CHARDATA.allocate()
                //set c.cbord = cbord.create(GetOwningPlayer(u))
                call EnableThirdPersonCam(GetOwningPlayer(u), u, 0.0)//This goes to CharacterInit
                set c.cData.Unit = u
                set c.cData.Name = "GameMaster "+ GetPlayerName(GetOwningPlayer(u))
                set c.mHUD = PHUD.create()
                call c.mHUD.ActivateHUD(c)
                call SaveInteger(CharacterHash, GetPlayerId(GetOwningPlayer(u)), 1, c) 
                
            return c
        endmethod
    endstruct

And this is the GUI script that initiates these

  • GameStart
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Custom script: local unit u = CreateUnit(Player(0), 'nvil', GetRectCenterX(gg_rct_Start), GetRectCenterY(gg_rct_Start), 0)
      • Custom script: local CHARDATA temp = CHARDATA.create(u)
      • Custom script: local unit uu = CreateUnit(Player(1), 'nvil', GetRectCenterX(gg_rct_Start), GetRectCenterY(gg_rct_Start), 0)
      • Custom script: local CHARDATA tempu = CHARDATA.create(uu)
      • Visibility - Disable fog of war
      • Visibility - Disable black mask
      • Custom script: call SetSkyModel("Environment\\Sky\\Sky\\SkyLight.mdl")
 
Level 11
Joined
Jun 30, 2008
Messages
580
well its a local struct being declared just for the uses inside of the method, I've already tried commenting that out and it still doesn't work,

Also when I remove the local unit uu and the local CHARDATA for player 2 initiation, the multiboard works for player 1

Am I doing something wrong here in the display portion?
 
Status
Not open for further replies.
Top