Multiboard Not Updating.

Status
Not open for further replies.
Level 7
Joined
Nov 6, 2019
Messages
195
Ok now after nearly 2 years, i have got my Save/Load System working, i am thinking of continuing with my map.

However issue i got is multiboard doesnt update

EDIT: I Changed This To Code Below, and it now updates.

  • MineralUpdate
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 8, do (Actions)
        • Loop - Actions
          • Multiboard - Set the text for MineralBoard[(Integer A)] item in column 1, row 1 to (Coal: + (String(CoalMineral[(Integer A)])))
          • Multiboard - Set the text for MineralBoard[(Integer A)] item in column 1, row 2 to (|cff808080Iron|r: + (String(IronMineral[(Integer A)])))
          • Multiboard - Set the text for MineralBoard[(Integer A)] item in column 1, row 3 to (|cffffff00Gold|r: + (String(GoldMineral[(Integer A)])))
          • Multiboard - Set the text for MineralBoard[(Integer A)] item in column 1, row 4 to (|cff0000ffSapphire|r: + (String(SapphireMineral[(Integer A)])))
          • Multiboard - Set the text for MineralBoard[(Integer A)] item in column 1, row 5 to (|cffff0000Ruby|r: + (String(RubyMineral[(Integer A)])))
  • MineralUpdate
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 8, do (Actions)
        • Loop - Actions
          • Multiboard - Set the text for MineralBoard[(Integer A)] item in column 1, row 1 to (Coal: + (String(CoalMineral[(Integer A)])))
          • Multiboard - Set the text for MineralBoard[(Integer A)] item in column 1, row 2 to (|cff808080Iron|r: + (String(IronMineral[(Integer A)])))
          • Multiboard - Set the text for MineralBoard[(Integer A)] item in column 1, row 3 to (|cffffff00Gold|r: + (String(GoldMineral[(Integer A)])))
          • Multiboard - Set the text for MineralBoard[(Integer A)] item in column 1, row 4 to (|cff0000ffSapphire|r: + (String(SapphireMineral[(Integer A)])))
          • Multiboard - Set the text for MineralBoard[(Integer A)] item in column 1, row 5 to (|cffff0000Ruby|r: + (String(RubyMineral[(Integer A)])))
          • Set VariableSet ShowPlayer = (Player((Integer A)))
          • Custom script: if GetLocalPlayer() == udg_ShowPlayer then
          • Multiboard - Hide MineralBoard[(Integer A)]
          • Custom script: endif
          • Set VariableSet ShowPlayer = (Player((Integer A)))
          • Custom script: if GetLocalPlayer() == udg_ShowPlayer then
          • Multiboard - Show MineralBoard[(Integer A)]
          • Custom script: endif

Now Another Question, Mineral Shop Issue,

  • Cancel
    • Events
      • Time - CancelTimer expires
    • Conditions
    • Actions
      • Custom script: call IssueImmediateOrderById(udg_CancelUnit, 851976)
  • SetupShop
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set VariableSet MineralHash = (Last created hashtable)
      • -------- Cost Coal --------
      • Set VariableSet UType = Counterfeiter
      • Custom script: set udg_UType_Int = udg_UType
      • Hashtable - Save 50 as (Key Coal.) of UType_Int in MineralHash.
      • Set VariableSet UType = Peasant
      • Custom script: set udg_UType_Int = udg_UType
      • Hashtable - Save 25 as (Key Coal.) of UType_Int in MineralHash.
      • -------- Cost Iron --------
      • Set VariableSet UType = Counterfeiter Iron
      • Custom script: set udg_UType_Int = udg_UType
      • Hashtable - Save 300 as (Key Iron.) of UType_Int in MineralHash.
  • TheSale
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Hut
    • Actions
      • Custom script: set udg_UType_Int = GetIssuedOrderId()
      • Set VariableSet CoalCost = (Load (Key Coal.) of UType_Int from MineralHash.)
      • Set VariableSet IronCost = (Load (Key Iron.) of UType_Int from MineralHash.)
      • Set VariableSet GoldCost = (Load (Key Gold.) of UType_Int from MineralHash.)
      • Set VariableSet SapphireCost = (Load (Key Sapphire.) of UType_Int from MineralHash.)
      • Set VariableSet RubyCost = (Load (Key Ruby.) of UType_Int from MineralHash.)
      • Set VariableSet PlayerNum = (Player number of (Triggering player))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CoalMineral[PlayerNum] Greater than or equal to CoalCost
          • IronMineral[PlayerNum] Greater than or equal to IronCost
          • GoldMineral[PlayerNum] Greater than or equal to GoldCost
          • SapphireMineral[PlayerNum] Greater than or equal to SapphireCost
          • RubyMineral[PlayerNum] Greater than or equal to SapphireCost
        • Then - Actions
          • Set VariableSet CoalMineral[PlayerNum] = (CoalMineral[PlayerNum] - CoalCost)
          • Set VariableSet IronMineral[PlayerNum] = (IronMineral[PlayerNum] - IronCost)
          • Set VariableSet GoldMineral[PlayerNum] = (GoldMineral[PlayerNum] - GoldCost)
          • Set VariableSet SapphireMineral[PlayerNum] = (SapphireMineral[PlayerNum] - SapphireCost)
          • Set VariableSet RubyMineral[PlayerNum] = (RubyMineral[PlayerNum] - RubyCost)
        • Else - Actions
          • Set VariableSet CancelUnit = (Triggering unit)
          • Countdown Timer - Start CancelTimer as a One-shot timer that will expire in 0.00 seconds
          • Game - Display to (All players) the text: (Requires " + ((String(CoalCost)) + " Coal!))
          • Game - Display to (All players) the text: (Requires " + ((String(IronCost)) + " Iron!))
          • Game - Display to (All players) the text: (Requires " + ((String(GoldCost)) + " Gold!))
          • Game - Display to (All players) the text: (Requires " + ((String(SapphireCost)) + " Sapphire!))
          • Game - Display to (All players) the text: (Requires " + ((String(RubyCost)) + " Ruby!))
Now for this issue i want to train units, research upgrades, and build structures, but items to cost Minerals

If i have only 1 item in shop costing 1 specific price, it somewhat works, however if u spam click the train unit, it builds without charging

i tried to add a second item to shope, and from what i thought i had to have all minerals in TheSale tab, so there in there, i added display to show what it cost in one note hoping that worked, but says requires ## of each resource does text, but if i put in seperate 2 different if all conditions, it shows both the text still not just the one from the one text.

And if i set it like this it pips up need coal and iron 100 times and crashes game

  • TheSale
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Hut
    • Actions
      • Custom script: set udg_UType_Int = GetIssuedOrderId()
      • Set VariableSet CoalCost = (Load (Key Coal.) of UType_Int from MineralHash.)
      • Set VariableSet IronCost = (Load (Key Iron.) of UType_Int from MineralHash.)
      • Set VariableSet GoldCost = (Load (Key Gold.) of UType_Int from MineralHash.)
      • Set VariableSet SapphireCost = (Load (Key Sapphire.) of UType_Int from MineralHash.)
      • Set VariableSet RubyCost = (Load (Key Ruby.) of UType_Int from MineralHash.)
      • Set VariableSet PlayerNum = (Player number of (Triggering player))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Counterfeiter
          • CoalMineral[PlayerNum] Greater than or equal to CoalCost
        • Then - Actions
          • Set VariableSet CoalMineral[PlayerNum] = (CoalMineral[PlayerNum] - CoalCost)
        • Else - Actions
          • Set VariableSet CancelUnit = (Triggering unit)
          • Countdown Timer - Start CancelTimer as a One-shot timer that will expire in 0.00 seconds
          • Game - Display to (All players) the text: (Requires " + ((String(CoalCost)) + " Coal!))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Counterfeiter Iron
          • IronMineral[PlayerNum] Greater than or equal to IronCost
        • Then - Actions
          • Set VariableSet IronMineral[PlayerNum] = (IronMineral[PlayerNum] - IronCost)
        • Else - Actions
          • Set VariableSet CancelUnit = (Triggering unit)
          • Countdown Timer - Start CancelTimer as a One-shot timer that will expire in 0.00 seconds
          • Game - Display to (All players) the text: (Requires " + ((String(IronCost)) + " Iron!))
 
Last edited:
Level 26
Joined
Apr 3, 2018
Messages
499
Regarding the "order with no target" trigger. The "triggering unit" type in conditions is hut.
You then compare "triggering unit" type again to "counterfeiter", it of course fails because triggering unit is a hut, and it goes to the else block. The cancel timer then gives order with no target (cancel) to the hut and infinitely loops crashing the game.

Maybe replace "triggering unit" with "issued order id" for checking who is being trained. And add a condition to the trigger that triggering order is not the cancel order you give.
 

Uncle

Warcraft Moderator
Level 72
Joined
Aug 10, 2018
Messages
7,643
Regarding the Multiboard update trigger, I recommend making it more efficient by using the Pick Every Player action and a Player Group that contains only active Users in the game (non-computer players that haven't left the game).

Also, you don't need to use that GetLocalPlayer() custom script twice. Simply Show the Multiboard immediately after Hiding it:
  • Multiboard - Hide MineralBoard[(Integer A)]
  • Multiboard - Show MineralBoard[(Integer A)]

(Edit) It would look something like this:
  • Actions
    • Player Group - Pick every player in ActiveUsers and do (Actions)
      • Loop - Actions
        • Set VariableSet PN = (Player number of (Picked player))
        • Multiboard - Set the text for MineralBoard[PN] item in column 1, row 1 to (String(Resource[PN]))
        • Multiboard - Set the text for MineralBoard[PN] item in column 1, row 2 to (String(Resource[PN]))
        • Multiboard - Set the text for MineralBoard[PN] item in column 1, row 3 to (String(Resource[PN]))
        • Multiboard - Set the text for MineralBoard[PN] item in column 1, row 4 to (String(Resource[PN]))
        • Multiboard - Set the text for MineralBoard[PN] item in column 1, row 5 to (String(Resource[PN]))
        • Custom script: if GetLocalPlayer() == GetEnumPlayer() then
        • Multiboard - Hide MineralBoard[PN]
        • Multiboard - Show MineralBoard[PN]
        • Custom script: endif
GetEnumPlayer() is the code form of (Picked player).

ActiveUsers would need to be setup beforehand:
  • Setup ActiveUsers
    • Events
      • Time - Elapsed game time is 0.50 seconds
    • Conditions
    • Actions
      • -------- You MUST do this after Map Initialization otherwise it can desync! --------
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) controller) Equal to User
              • ((Picked player) slot status) Equal to Is playing
            • Then - Actions
              • Player Group - Add (Picked player) to ActiveUsers
            • Else - Actions
Also, when a player leaves the game you would want to Remove them from ActiveUsers:
  • Player Group - Remove (Triggering player) from ActiveUsers

This way you're only referencing players that actually exist. So if say only 2 people were in the game the code wouldn't need to run for 6 other players.
 
Last edited:
Level 7
Joined
Nov 6, 2019
Messages
195
Regarding the Multiboard update trigger, I recommend making it more efficient by using the Pick Every Player action and a Player Group that only contains active Users in the game (non-computer players that haven't left the game).

Also, you don't need to use that GetLocalPlayer() custom script twice. Simply Show the Multiboard immediately after Hiding it:
  • Multiboard - Hide MineralBoard[(Integer A)]
  • Multiboard - Show MineralBoard[(Integer A)]

i originally set it like that, but it didnt work but like this it works if this what you mean

  • MineralUpdate
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 8, do (Actions)
        • Loop - Actions
          • Multiboard - Set the text for MineralBoard[(Integer A)] item in column 1, row 1 to (Coal: + (String(CoalMineral[(Integer A)])))
          • Multiboard - Set the text for MineralBoard[(Integer A)] item in column 1, row 2 to (|cff808080Iron|r: + (String(IronMineral[(Integer A)])))
          • Multiboard - Set the text for MineralBoard[(Integer A)] item in column 1, row 3 to (|cffffff00Gold|r: + (String(GoldMineral[(Integer A)])))
          • Multiboard - Set the text for MineralBoard[(Integer A)] item in column 1, row 4 to (|cff0000ffSapphire|r: + (String(SapphireMineral[(Integer A)])))
          • Multiboard - Set the text for MineralBoard[(Integer A)] item in column 1, row 5 to (|cffff0000Ruby|r: + (String(RubyMineral[(Integer A)])))
          • Set VariableSet ShowPlayer = (Player((Integer A)))
          • Custom script: if GetLocalPlayer() == udg_ShowPlayer then
          • Multiboard - Hide MineralBoard[(Integer A)]
          • Multiboard - Show MineralBoard[(Integer A)]
          • Custom script: endif
Regarding the "order with no target" trigger. The "triggering unit" type in conditions is hut.
You then compare "triggering unit" type again to "counterfeiter", it of course fails because triggering unit is a hut, and it goes to the else block. The cancel timer then gives order with no target (cancel) to the hut and infinitely loops crashing the game.

Maybe replace "triggering unit" with "issued order id" for checking who is being trained. And add a condition to the trigger that triggering order is not the cancel order you give.

The Code Like This Works of cos

  • TheSale
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Hut
    • Actions
      • Custom script: set udg_UType_Int = GetIssuedOrderId()
      • Set VariableSet CoalCost = (Load (Key Coal.) of UType_Int from MineralHash.)
      • Set VariableSet IronCost = (Load (Key Iron.) of UType_Int from MineralHash.)
      • Set VariableSet GoldCost = (Load (Key Gold.) of UType_Int from MineralHash.)
      • Set VariableSet SapphireCost = (Load (Key Sapphire.) of UType_Int from MineralHash.)
      • Set VariableSet RubyCost = (Load (Key Ruby.) of UType_Int from MineralHash.)
      • Set VariableSet PlayerNum = (Player number of (Triggering player))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CoalMineral[PlayerNum] Greater than or equal to CoalCost
        • Then - Actions
          • Set VariableSet CoalMineral[PlayerNum] = (CoalMineral[PlayerNum] - CoalCost)
        • Else - Actions
          • Set VariableSet CancelUnit = (Triggering unit)
          • Countdown Timer - Start CancelTimer as a One-shot timer that will expire in 0.00 seconds
          • Game - Display to (All players) the text: (Requires " + ((String(CoalCost)) + " Coal!))
However it only works if am using only 1 mineral for items in the shop, but i can add multiple things to cost coal and they all work, but as said if u click like 3+ times fast it doesnt issue to cancel the building, even if u dont got the minerals
 
Status
Not open for further replies.
Top