• 🏆 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!

Riot System

Level 3
Joined
Feb 13, 2020
Messages
24
Ok so... I'm trying to make a riot system that will turn few members of human race units hostile whenever when loyalty is below 60 and less. I used quite a different way before It didn't work so I throw the towel... how can I do that? I mean I tried everything. also this is multiplayer map so when theres 2 human race does it gonna effect each other with this buildup?
1683464481235.png
1683464515299.png
1683464543137.png
1683464560279.png
1683464577315.png
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,565
You're making a few mistakes like using (Picked player) instead of (Matching player) in your Player Group's filter, allowing dead units to be randomly chosen to riot, failing to properly setup the multiboard, and creating a lot of memory leaks.

Here's a version of your system that should do almost exactly what you want. In this case I'm creating a single Multiboard that is shared with everyone IF there is at least 1 Human player in the game. Alternatively, you could give each Player their own Multiboard but I actually forgot to do this and don't feel like fixing it right now (maybe you'll like this better anyway).

If you copy these triggers it's very important to do the following:
  • Set the Initial Value of your Moral_Timer variable to 28. Timer arrays need to be initialized this way unlike most other array types.
  • Turn Moral Decay and Moral Death off by unchecking the Initially On checkbox.
  • Do NOT change the variable names or you'll mess with the Custom script.
  • Moral Multiboard
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • -------- You probably want to make sure they're actually playing the game as well: --------
      • Set VariableSet Moral_Players = (All players matching ((Race of (Matching player)) Equal to Human).)
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of players in Moral_Players) Greater than 0
        • Then - Actions
          • Trigger - Turn on Moral Decay <gen>
          • Trigger - Turn on Moral Death <gen>
          • -------- --------
          • Set VariableSet Moral_PN = 1
          • Player Group - Pick every player in Moral_Players and do (Actions)
            • Loop - Actions
              • Set VariableSet Moral_PN = (Moral_PN + 1)
              • Set VariableSet Moral_Row[(Player number of (Picked player))] = Moral_PN
              • Trigger - Add to Moral Riot <gen> the event (Time - Moral_Timer[(Player number of (Picked player))] expires)
          • -------- --------
          • Multiboard - Create a multiboard with 2 columns and Moral_PN rows, titled Moral Board.
          • Set VariableSet Moral_Multiboard = (Last created multiboard)
          • For each (Integer A) from 1 to Moral_PN, do (Actions)
            • Loop - Actions
              • For each (Integer B) from 1 to 2, do (Actions)
                • Loop - Actions
                  • Multiboard - Set the display style for Moral_Multiboard item in column (Integer B), row (Integer A) to Show text and Hide icons
                  • Multiboard - Set the width for Moral_Multiboard item in column (Integer B), row (Integer A) to 8.00% of the total screen width
          • Multiboard - Set the text for Moral_Multiboard item in column 1, row 1 to Name:
          • Multiboard - Set the text for Moral_Multiboard item in column 2, row 1 to Moral:
          • Multiboard - Show Moral_Multiboard
          • -------- --------
          • Player Group - Pick every player in Moral_Players and do (Actions)
            • Loop - Actions
              • Set VariableSet Moral_PN = (Player number of (Picked player))
              • Multiboard - Set the text for Moral_Multiboard item in column 1, row Moral_Row[Moral_PN] to (Name of (Picked player))
              • Set VariableSet Moral_Modify = 100
              • Trigger - Run Moral Modify <gen> (ignoring conditions)
        • Else - Actions
  • Moral Modify
    • Events
    • Conditions
    • Actions
      • -------- You need to set Moral_Modify and Moral_PN before running this trigger! --------
      • -------- --------
      • Set VariableSet Moral_Player_Amount[Moral_PN] = (Moral_Player_Amount[Moral_PN] + Moral_Modify)
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Moral_Player_Amount[Moral_PN] Less than 0
        • Then - Actions
          • Set VariableSet Moral_Player_Amount[Moral_PN] = 0
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Moral_Player_Amount[Moral_PN] Greater than 100
            • Then - Actions
              • Set VariableSet Moral_Player_Amount[Moral_PN] = 100
            • Else - Actions
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Moral_Player_Amount[Moral_PN] Less than or equal to 60
        • Then - Actions
          • Countdown Timer - Start Moral_Timer[Moral_PN] as a Repeating timer that will expire in 300.00 seconds
        • Else - Actions
          • Countdown Timer - Pause Moral_Timer[Moral_PN]
      • -------- --------
      • Multiboard - Set the text for Moral_Multiboard item in column 2, row Moral_Row[Moral_PN] to (String(Moral_Player_Amount[Moral_PN]))
  • Moral Decay
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in Moral_PlayerGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet Moral_PN = (Player number of (Picked player))
          • Set VariableSet Moral_Modify = -1
          • Trigger - Run Moral Modify <gen> (ignoring conditions)
  • Moral Riot
    • Events
    • Conditions
    • Actions
      • Player Group - Pick every player in Moral_PlayerGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet Moral_PN = (Player number of (Picked player))
          • -------- --------
          • -------- This checks which of the timers expired. The actions between "then" and "endif" will run IF it's the Picked player's timer: --------
          • Custom script: if GetExpiredTimer() == udg_Moral_Timer[udg_Moral_PN] then
          • -------- --------
          • Set VariableSet Moral_AllUnits = (Units owned by (Picked player).)
          • Unit Group - Pick every unit in Moral_AllUnits and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is dead) Equal to False
                  • ((Picked unit) is A Hero) Equal to False
                  • ((Picked unit) is A structure) Equal to False
                • Then - Actions
                  • -------- It's a valid target --------
                • Else - Actions
                  • Unit Group - Remove (Picked unit) from Moral_AllUnits.
          • -------- --------
          • Set VariableSet Moral_RandomUnits = (Random 6 units from Moral_AllUnits)
          • Unit Group - Pick every unit in Moral_RandomUnits and do (Actions)
            • Loop - Actions
              • Unit - Change ownership of (Picked unit) to Neutral Hostile and Change color
          • -------- --------
          • Custom script: call DestroyGroup(udg_Moral_AllUnits)
          • Custom script: call DestroyGroup(udg_Moral_RandomUnits)
          • -------- --------
          • Custom script: endif
  • Moral Death
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Race of (Triggering unit)) Equal to Human
        • Then - Actions
          • Set VariableSet Moral_PN = (Player number of (Owner of (Triggering unit)))
          • Set VariableSet Moral_Modify = -3
          • Trigger - Run Moral Modify <gen> (ignoring conditions)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Race of (Killing unit)) Equal to Human
          • ((Triggering unit) belongs to an enemy of (Owner of (Killing unit)).) Equal to True
        • Then - Actions
          • Set VariableSet Moral_PN = (Player number of (Owner of (Killing unit)))
          • Set VariableSet Moral_Modify = 4
          • Trigger - Run Moral Modify <gen> (ignoring conditions)
        • Else - Actions
This design uses a single trigger (Moral Modify) to handle all of the changes and effects related to a player's Moral. You run this trigger like you would call a function, but first you must set the Moral_PN variable to the Player Number of whoever you want to modify and set the Moral_Modify variable to the amount that you want to add or subtract. This style of triggering is very powerful since everything is contained in one trigger making it super easy to edit in the future.

Here's some info on giving player's their own personal Multiboards:

The attached map requires the latest version of Warcraft 3 to open.
 

Attachments

  • Moral Example 1.w3m
    21.4 KB · Views: 1
Last edited:
Level 3
Joined
Feb 13, 2020
Messages
24
You're making a few mistakes like using (Picked player) instead of (Matching player) in your Player Group's filter, allowing dead units to be randomly chosen to riot, failing to properly setup the multiboard, and creating a lot of memory leaks.

Here's a version of your system that should do almost exactly what you want. In this case I'm creating a single Multiboard that is shared with everyone IF there is at least 1 Human player in the game. Alternatively, you could give each Player their own Multiboard but I actually forgot to do this and don't feel like fixing it right now (maybe you'll like this better anyway).

If you copy these triggers it's very important to do the following:
  • Set the Initial Value of your Moral_Timer variable to 28. Timer arrays need to be initialized this way unlike most other array types.
  • Turn Moral Decay and Moral Death off by unchecking the Initially On checkbox.
  • Do NOT change the variable names or you'll mess with the Custom script.
  • Moral Multiboard
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • -------- You probably want to make sure they're actually playing the game as well: --------
      • Set VariableSet Moral_Players = (All players matching ((Race of (Picked player)) Equal to Human).)
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of players in Moral_Players) Greater than 0
        • Then - Actions
          • Trigger - Turn on Moral Decay <gen>
          • Trigger - Turn on Moral Death <gen>
          • -------- --------
          • Set VariableSet Moral_PN = 1
          • Player Group - Pick every player in Moral_Players and do (Actions)
            • Loop - Actions
              • Set VariableSet Moral_PN = (Moral_PN + 1)
              • Set VariableSet Moral_Row[(Player number of (Picked player))] = Moral_PN
              • Trigger - Add to Moral Riot <gen> the event (Time - Moral_Timer[(Player number of (Picked player))] expires)
          • -------- --------
          • Multiboard - Create a multiboard with 2 columns and Moral_PN rows, titled Moral Board.
          • Set VariableSet Moral_Multiboard = (Last created multiboard)
          • For each (Integer A) from 1 to Moral_PN, do (Actions)
            • Loop - Actions
              • For each (Integer B) from 1 to 2, do (Actions)
                • Loop - Actions
                  • Multiboard - Set the display style for Moral_Multiboard item in column (Integer B), row (Integer A) to Show text and Hide icons
                  • Multiboard - Set the width for Moral_Multiboard item in column (Integer B), row (Integer A) to 8.00% of the total screen width
          • Multiboard - Set the text for Moral_Multiboard item in column 1, row 1 to Name:
          • Multiboard - Set the text for Moral_Multiboard item in column 2, row 1 to Moral:
          • Multiboard - Show Moral_Multiboard
          • -------- --------
          • Player Group - Pick every player in Moral_Players and do (Actions)
            • Loop - Actions
              • Set VariableSet Moral_PN = (Player number of (Picked player))
              • Multiboard - Set the text for Moral_Multiboard item in column 1, row Moral_Row[Moral_PN] to (Name of (Picked player))
              • Set VariableSet Moral_Modify = 100
              • Trigger - Run Moral Modify <gen> (ignoring conditions)
        • Else - Actions
  • Moral Modify
    • Events
    • Conditions
    • Actions
      • -------- You need to set Moral_Modify and Moral_PN before running this trigger! --------
      • -------- --------
      • Set VariableSet Moral_Player_Amount[Moral_PN] = (Moral_Player_Amount[Moral_PN] + Moral_Modify)
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Moral_Player_Amount[Moral_PN] Less than 0
        • Then - Actions
          • Set VariableSet Moral_Player_Amount[Moral_PN] = 0
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Moral_Player_Amount[Moral_PN] Greater than 100
            • Then - Actions
              • Set VariableSet Moral_Player_Amount[Moral_PN] = 100
            • Else - Actions
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Moral_Player_Amount[Moral_PN] Less than or equal to 60
        • Then - Actions
          • Countdown Timer - Start Moral_Timer[Moral_PN] as a Repeating timer that will expire in 300.00 seconds
        • Else - Actions
          • Countdown Timer - Pause Moral_Timer[Moral_PN]
      • -------- --------
      • Multiboard - Set the text for Moral_Multiboard item in column 2, row Moral_Row[Moral_PN] to (String(Moral_Player_Amount[Moral_PN]))
  • Moral Decay
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in Moral_PlayerGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet Moral_PN = (Player number of (Picked player))
          • Set VariableSet Moral_Modify = -1
          • Trigger - Run Moral Modify <gen> (ignoring conditions)
  • Moral Riot
    • Events
    • Conditions
    • Actions
      • Player Group - Pick every player in Moral_PlayerGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet Moral_PN = (Player number of (Picked player))
          • -------- --------
          • -------- This checks which of the timers expired. The actions between "then" and "endif" will run IF it's the Picked player's timer: --------
          • Custom script: if GetExpiredTimer() == udg_Moral_Timer[udg_Moral_PN] then
          • -------- --------
          • Set VariableSet Moral_AllUnits = (Units owned by (Picked player).)
          • Unit Group - Pick every unit in Moral_AllUnits and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is dead) Equal to False
                  • ((Picked unit) is A Hero) Equal to False
                  • ((Picked unit) is A structure) Equal to False
                • Then - Actions
                  • -------- It's a valid target --------
                • Else - Actions
                  • Unit Group - Remove (Picked unit) from Moral_AllUnits.
          • -------- --------
          • Set VariableSet Moral_RandomUnits = (Random 6 units from Moral_AllUnits)
          • Unit Group - Pick every unit in Moral_RandomUnits and do (Actions)
            • Loop - Actions
              • Unit - Change ownership of (Picked unit) to Neutral Hostile and Change color
          • -------- --------
          • Custom script: call DestroyGroup(udg_Moral_AllUnits)
          • Custom script: call DestroyGroup(udg_Moral_RandomUnits)
          • -------- --------
          • Custom script: endif
  • Moral Death
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Race of (Triggering unit)) Equal to Human
        • Then - Actions
          • Set VariableSet Moral_PN = (Player number of (Owner of (Triggering unit)))
          • Set VariableSet Moral_Modify = -3
          • Trigger - Run Moral Modify <gen> (ignoring conditions)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Race of (Killing unit)) Equal to Human
          • ((Triggering unit) belongs to an enemy of (Owner of (Killing unit)).) Equal to True
        • Then - Actions
          • Set VariableSet Moral_PN = (Player number of (Owner of (Killing unit)))
          • Set VariableSet Moral_Modify = 4
          • Trigger - Run Moral Modify <gen> (ignoring conditions)
        • Else - Actions
This design uses a single trigger (Moral Modify) to handle all of the changes and effects related to a player's Moral. You run this trigger like you would call a function, but first you must set the Moral_PN variable to the Player Number of whoever you want to modify and set the Moral_Modify variable to the amount that you want to add or subtract. This style of triggering is very powerful since everything is contained in one trigger making it super easy to edit in the future.

Here's some info on giving player's their own personal Multiboards:

The attached map requires the latest version of Warcraft 3 to open.
That was best fucking explanation I've ever heard. thanks bro I'll try this up. than I'll look to seperate for each people. I'm setting up rn. btw I'm using an older version because of I'm against reforged. I use 1.27.1 as I heard reforged is kinda broken so I dunno how people still hanging on.
 
Level 3
Joined
Feb 13, 2020
Messages
24
You're making a few mistakes like using (Picked player) instead of (Matching player) in your Player Group's filter, allowing dead units to be randomly chosen to riot, failing to properly setup the multiboard, and creating a lot of memory leaks.

Here's a version of your system that should do almost exactly what you want. In this case I'm creating a single Multiboard that is shared with everyone IF there is at least 1 Human player in the game. Alternatively, you could give each Player their own Multiboard but I actually forgot to do this and don't feel like fixing it right now (maybe you'll like this better anyway).

If you copy these triggers it's very important to do the following:
  • Set the Initial Value of your Moral_Timer variable to 28. Timer arrays need to be initialized this way unlike most other array types.
  • Turn Moral Decay and Moral Death off by unchecking the Initially On checkbox.
  • Do NOT change the variable names or you'll mess with the Custom script.
  • Moral Multiboard
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • -------- You probably want to make sure they're actually playing the game as well: --------
      • Set VariableSet Moral_Players = (All players matching ((Race of (Picked player)) Equal to Human).)
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of players in Moral_Players) Greater than 0
        • Then - Actions
          • Trigger - Turn on Moral Decay <gen>
          • Trigger - Turn on Moral Death <gen>
          • -------- --------
          • Set VariableSet Moral_PN = 1
          • Player Group - Pick every player in Moral_Players and do (Actions)
            • Loop - Actions
              • Set VariableSet Moral_PN = (Moral_PN + 1)
              • Set VariableSet Moral_Row[(Player number of (Picked player))] = Moral_PN
              • Trigger - Add to Moral Riot <gen> the event (Time - Moral_Timer[(Player number of (Picked player))] expires)
          • -------- --------
          • Multiboard - Create a multiboard with 2 columns and Moral_PN rows, titled Moral Board.
          • Set VariableSet Moral_Multiboard = (Last created multiboard)
          • For each (Integer A) from 1 to Moral_PN, do (Actions)
            • Loop - Actions
              • For each (Integer B) from 1 to 2, do (Actions)
                • Loop - Actions
                  • Multiboard - Set the display style for Moral_Multiboard item in column (Integer B), row (Integer A) to Show text and Hide icons
                  • Multiboard - Set the width for Moral_Multiboard item in column (Integer B), row (Integer A) to 8.00% of the total screen width
          • Multiboard - Set the text for Moral_Multiboard item in column 1, row 1 to Name:
          • Multiboard - Set the text for Moral_Multiboard item in column 2, row 1 to Moral:
          • Multiboard - Show Moral_Multiboard
          • -------- --------
          • Player Group - Pick every player in Moral_Players and do (Actions)
            • Loop - Actions
              • Set VariableSet Moral_PN = (Player number of (Picked player))
              • Multiboard - Set the text for Moral_Multiboard item in column 1, row Moral_Row[Moral_PN] to (Name of (Picked player))
              • Set VariableSet Moral_Modify = 100
              • Trigger - Run Moral Modify <gen> (ignoring conditions)
        • Else - Actions
  • Moral Modify
    • Events
    • Conditions
    • Actions
      • -------- You need to set Moral_Modify and Moral_PN before running this trigger! --------
      • -------- --------
      • Set VariableSet Moral_Player_Amount[Moral_PN] = (Moral_Player_Amount[Moral_PN] + Moral_Modify)
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Moral_Player_Amount[Moral_PN] Less than 0
        • Then - Actions
          • Set VariableSet Moral_Player_Amount[Moral_PN] = 0
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Moral_Player_Amount[Moral_PN] Greater than 100
            • Then - Actions
              • Set VariableSet Moral_Player_Amount[Moral_PN] = 100
            • Else - Actions
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Moral_Player_Amount[Moral_PN] Less than or equal to 60
        • Then - Actions
          • Countdown Timer - Start Moral_Timer[Moral_PN] as a Repeating timer that will expire in 300.00 seconds
        • Else - Actions
          • Countdown Timer - Pause Moral_Timer[Moral_PN]
      • -------- --------
      • Multiboard - Set the text for Moral_Multiboard item in column 2, row Moral_Row[Moral_PN] to (String(Moral_Player_Amount[Moral_PN]))
  • Moral Decay
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in Moral_PlayerGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet Moral_PN = (Player number of (Picked player))
          • Set VariableSet Moral_Modify = -1
          • Trigger - Run Moral Modify <gen> (ignoring conditions)
  • Moral Riot
    • Events
    • Conditions
    • Actions
      • Player Group - Pick every player in Moral_PlayerGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet Moral_PN = (Player number of (Picked player))
          • -------- --------
          • -------- This checks which of the timers expired. The actions between "then" and "endif" will run IF it's the Picked player's timer: --------
          • Custom script: if GetExpiredTimer() == udg_Moral_Timer[udg_Moral_PN] then
          • -------- --------
          • Set VariableSet Moral_AllUnits = (Units owned by (Picked player).)
          • Unit Group - Pick every unit in Moral_AllUnits and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is dead) Equal to False
                  • ((Picked unit) is A Hero) Equal to False
                  • ((Picked unit) is A structure) Equal to False
                • Then - Actions
                  • -------- It's a valid target --------
                • Else - Actions
                  • Unit Group - Remove (Picked unit) from Moral_AllUnits.
          • -------- --------
          • Set VariableSet Moral_RandomUnits = (Random 6 units from Moral_AllUnits)
          • Unit Group - Pick every unit in Moral_RandomUnits and do (Actions)
            • Loop - Actions
              • Unit - Change ownership of (Picked unit) to Neutral Hostile and Change color
          • -------- --------
          • Custom script: call DestroyGroup(udg_Moral_AllUnits)
          • Custom script: call DestroyGroup(udg_Moral_RandomUnits)
          • -------- --------
          • Custom script: endif
  • Moral Death
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Race of (Triggering unit)) Equal to Human
        • Then - Actions
          • Set VariableSet Moral_PN = (Player number of (Owner of (Triggering unit)))
          • Set VariableSet Moral_Modify = -3
          • Trigger - Run Moral Modify <gen> (ignoring conditions)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Race of (Killing unit)) Equal to Human
          • ((Triggering unit) belongs to an enemy of (Owner of (Killing unit)).) Equal to True
        • Then - Actions
          • Set VariableSet Moral_PN = (Player number of (Owner of (Killing unit)))
          • Set VariableSet Moral_Modify = 4
          • Trigger - Run Moral Modify <gen> (ignoring conditions)
        • Else - Actions
This design uses a single trigger (Moral Modify) to handle all of the changes and effects related to a player's Moral. You run this trigger like you would call a function, but first you must set the Moral_PN variable to the Player Number of whoever you want to modify and set the Moral_Modify variable to the amount that you want to add or subtract. This style of triggering is very powerful since everything is contained in one trigger making it super easy to edit in the future.

Here's some info on giving player's their own personal Multiboards:

The attached map requires the latest version of Warcraft 3 to open.
ok can you just give me initial values of variables u used in the riot map since I cannot acccess to it? also timer initial value cannot be changed in variables section so I'M assuming I'll jsut gonna set up in map initialisition.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,565
I made the same mistake you made :p This should say (Matching player) not (Picked player), I updated it in my last post:
  • -------- You probably want to make sure they're actually playing the game as well: --------
  • Set VariableSet Moral_Players = (All players matching ((Race of (Matching player)) Equal to Human).)
The variable types should be rather self explanatory since they either say it in their name or the Actions/Conditions that use them give it away. If you see "Set Variable SOMETHING = 100" we know that SOMETHING must be an Integer because 100 is an Integer. If there is an [index] following their name then we know it's a Variable with an Array enabled.

Variable types:
Moral_PN = Integer
Moral_Modify = Integer
Moral_AllUnits = Unit Group
Moral_RandomUnits = Unit Group
Moral_Multiboard = Multiboard
Moral_Player_Amount = Integer (ARRAY)
Moral_Row = Integer (ARRAY)
Moral_Timer = Timer (ARRAY with Initial Value of 28)


As of the most recent patch (1.35) the game is in an okay place. The pros outweigh the cons in my opinion:

Pros:
  • Can actually play the map on BNET. Pretty important to most people...
  • Can use the new modding tools/natives.
  • These include: Lua support (much better than Jass), Custom UI (create your own custom Shops, Inventories, Leaderboards, etc), tons of new functions in the Trigger Editor which allow you to manipulate Abilities/Units/Items far more than you could in the past.
Cons:
  • Annoying bugs here and there that require strange workarounds to fix. Luckily, Hive has a lot of solutions.
  • Unfinished functions in the Trigger Editor.
  • Annoying crashes that can happen. They are avoidable if you learn about them. (Backup your maps and save often).

I believe most of the other complaints have been addressed and fixed (like custom campaigns being missing). Anyway, 1.27 is an ancient version, you could at the very least update to one of the 1.31 patches that came prior to Reforged and get access to a lot of new stuff.
 
Last edited:
Level 3
Joined
Feb 13, 2020
Messages
24
I made the same mistake you made :p This should say (Matching player) not (Picked player), I updated it in my last post:
  • -------- You probably want to make sure they're actually playing the game as well: --------
  • Set VariableSet Moral_Players = (All players matching ((Race of (Matching player)) Equal to Human).)
The variable types should be rather self explanatory since they either say it in their name or the Actions/Conditions that use them give it away. If you see "Set Variable SOMETHING = 100" we know that SOMETHING must be an Integer because 100 is an Integer. If there is an [index] following their name then we know it's a Variable with an Array enabled.

Variable types:
Moral_PN = Integer
Moral_Modify = Integer
Moral_AllUnits = Unit Group
Moral_RandomUnits = Unit Group
Moral_Multiboard = Multiboard
Moral_Player_Amount = Integer (ARRAY)
Moral_Row = Integer (ARRAY)
Moral_Timer = Timer (ARRAY with Initial Value of 28)


As of the most recent patch (1.35) the game is in an okay place. The pros outweigh the cons in my opinion:

Pros:
  • Can actually play the map on BNET. Pretty important to most people...
  • Can use the new modding tools/natives.
  • These include: Lua support (much better than Jass), Custom UI (create your own custom Shops, Inventories, Leaderboards, etc), tons of new functions in the Trigger Editor which allow you to manipulate Abilities/Units/Items far more than you could in the past.
Cons:
  • Annoying bugs here and there that require strange workarounds to fix. Luckily, Hive has a lot of solutions.
  • Unfinished functions in the Trigger Editor.
  • Annoying crashes that can happen. They are avoidable if you learn about them. (Backup your maps and save often).

I believe most of the other complaints have been addressed and fixed (like custom campaigns being missing). Anyway, 1.27 is an ancient version, you could at the very least update to one of the 1.31 patches that came prior to Reforged and get access to a lot of new stuff.
ok I did th eset up and changed the multiboard for showing the exact number of the morale point but It seems something is wrong... simply put It doesn't work as first time I run, there was no numbers just few random names. heres the triggers I copycat from you. what's wrong? also I cannot set the timer as because I cannot set initial velue in timer and I cannot do it with set value command so...
1683885996264.png
1683885906389.png
1683885896549.png
1683885888329.png
1683885880993.png
1683885855174.png
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,565
Please name your triggers my friend. :p

Also, post the triggers on Hive like this:

I'll try to help once you have named everything appropriately and post the triggers the correct way.
 
Level 3
Joined
Feb 13, 2020
Messages
24
Please name your triggers my friend. :p

Also, post the triggers on Hive like this:

I'll try to help once you have named everything appropriately and post the triggers the correct way.
  • Moral Decay
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in MoralPlayergroup and do (Actions)
        • Loop - Actions
          • Set Moral_PN = (Player number of (Picked player))
          • Set MoralModifier = -1
          • Trigger - Run Moral Modifier <gen> (ignoring conditions)
  • Moral Riot
    • Events
    • Conditions
    • Actions
      • Set Moral_PN = (Player number of (Picked player))
      • Custom script: if GetExpiredTimer() == udg_Moraltimer[udg_Moral_PN] then
      • Set Moral_Allunits = (Units owned by (Picked player))
      • Unit Group - Pick every unit in Moral_Allunits and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A Hero) Equal to False
              • ((Picked unit) is A structure) Equal to False
              • ((Picked unit) is dead) Equal to False
            • Then - Actions
            • Else - Actions
              • Unit Group - Remove (Picked unit) from Moral_Allunits
      • Set Moral_randomunits = (Random 6 units from Moral_Allunits)
      • Unit Group - Pick every unit in Moral_randomunits and do (Actions)
        • Loop - Actions
          • Unit - Change ownership of (Picked unit) to Neutral Hostile and Change color
      • Custom script: call DestroyGroup(udg_Moral_randomunits)
      • Custom script: call DestroyGroup(udg_Moral_Allunits)
      • Custom script: endif
  • MoralKillDeath
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Race of (Triggering unit)) Equal to Human
        • Then - Actions
          • Set Moral_PN = (Player number of (Owner of (Triggering unit)))
          • Set MoralModifier = -3
          • Trigger - Run Moral Modifier <gen> (ignoring conditions)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Race of (Killing unit)) Equal to Human
          • ((Triggering unit) belongs to an enemy of (Owner of (Killing unit))) Equal to True
        • Then - Actions
          • Set Moral_PN = (Player number of (Owner of (Killing unit)))
          • Set MoralModifier = 4
          • Trigger - Run Moral Modifier <gen> (ignoring conditions)
        • Else - Actions
  • Moral Modifier
    • Events
    • Conditions
    • Actions
      • Set Moral_playeramount[Moral_PN] = (Moral_playeramount[Moral_PN] + MoralModifier)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Moral_playeramount[Moral_PN] Less than 0
        • Then - Actions
          • Set Moral_playeramount[Moral_PN] = 0
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Moral_playeramount[Moral_PN] Greater than 100
            • Then - Actions
              • Set Moral_playeramount[Moral_PN] = 100
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Moral_playeramount[Moral_PN] Less than 60
        • Then - Actions
          • Countdown Timer - Start Moraltimer[Moral_PN] as a Repeating timer that will expire in 300.00 seconds
        • Else - Actions
          • Countdown Timer - Pause Moraltimer[Moral_PN]
          • Multiboard - Set the text for MoralMultiboard item in column 2, row Moral_Row[Moral_PN] to (String(Moral_playeramount[Moral_PN]))
  • Multiboardmorale
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Set MoralPlayergroup = (All players matching ((Race of (Matching player)) Equal to Human))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player number of MoralPlayer) Greater than 0
        • Then - Actions
          • Trigger - Turn on Moral_Decay
          • Trigger - Turn on MoralKillDeath <gen>
          • Set Moral_PN = 1
          • Player Group - Pick every player in MoralPlayergroup and do (Actions)
            • Loop - Actions
              • Set Moral_PN = (Moral_PN + 1)
              • Set Moral_Row[(Player number of (Picked player))] = Moral_PN
              • Trigger - Add to Moral Riot <gen> the event (Time - Moraltimer[(Player number of (Picked player))] expires)
          • Multiboard - Create a multiboard with 1 columns and Moral_PN rows, titled Moral
          • Set MoralMultiboard = (Last created multiboard)
          • For each (Integer A) from 1 to Moral_PN, do (Actions)
            • Loop - Actions
              • For each (Integer B) from 1 to 2, do (Actions)
                • Loop - Actions
                  • Multiboard - Set the display style for MoralMultiboard item in column (Integer B), row (Integer A) to Show text and Hide icons
                  • Multiboard - Set the width for MoralMultiboard item in column (Integer B), row (Integer A) to 8.00% of the total screen width
          • Multiboard - Set the text for MoralMultiboard item in column 1, row 1 to (String(Moral_playeramount[Moral_PN]))
          • Player Group - Pick every player in MoralPlayergroup and do (Actions)
            • Loop - Actions
              • Set Moral_PN = (Player number of (Picked player))
              • Multiboard - Set the text for MoralMultiboard item in column 1, row Moral_Row[Moral_PN] to (Name of (Picked player))
              • Set MoralModifier = 100
              • Trigger - Run Moral Modifier <gen> (ignoring conditions)
        • Else - Actions
There you go gotta renamed and copy pasted the triggers for that. (Edit: Also good to know something new :D )
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,565
Thanks, now I can easily read and edit it which saves me A LOT of time.

Some issues:

Your first Condition in the Moral Multiboard trigger is incorrect. It should look like this, which is an Integer comparison:
  • (Number of players in Moral_Players) Greater than 0
And you're running this Action for no reason after the For Loops:
  • Multiboard - Set the text for MoralMultiboard item in column 1, row 1 to (String(Moral_playeramount[Moral_PN]))
In it's place you should have these three Actions:
  • Multiboard - Set the text for Moral_Multiboard item in column 1, row 1 to Name:
  • Multiboard - Set the text for Moral_Multiboard item in column 2, row 1 to Moral:
  • Multiboard - Show Moral_Multiboard
Your Multiboard doesn't have enough Columns, this should be set to 2 Columns:
  • Multiboard - Create a multiboard with 1 columns and Moral_PN rows, titled Moral
In the Moral Modifier trigger you're making the mistake of putting the last Action inside of the ELSE part of the If Then Else. It's supposed to come after that:
  • Multiboard - Set the text for MoralMultiboard item in column 2, row Moral_Row[Moral_PN] to (String(Moral_playeramount[Moral_PN]))
In the Variable Editor, change the Size of Moraltimer to 28. Then click OK.

You need to compare these triggers side by side with one another. If there's one little mistake then it won't work.
 
Last edited:
Level 3
Joined
Feb 13, 2020
Messages
24
Thanks, now I can easily read and edit it which saves me A LOT of time.

Some issues:

Your first Condition in the Moral Multiboard trigger is incorrect. It should look like this, which is an Integer comparison:
  • (Number of players in Moral_Players) Greater than 0
And you're running this Action for no reason after the For Loops:
  • Multiboard - Set the text for MoralMultiboard item in column 1, row 1 to (String(Moral_playeramount[Moral_PN]))
In it's place you should have these three Actions:
  • Multiboard - Set the text for Moral_Multiboard item in column 1, row 1 to Name:
  • Multiboard - Set the text for Moral_Multiboard item in column 2, row 1 to Moral:
  • Multiboard - Show Moral_Multiboard
Your Multiboard doesn't have enough Columns, this should be set to 2 Columns:
  • Multiboard - Create a multiboard with 1 columns and Moral_PN rows, titled Moral
In the Moral Modifier trigger you're making the mistake of putting the last Action inside of the ELSE part of the If Then Else. It's supposed to come after that:
  • Multiboard - Set the text for MoralMultiboard item in column 2, row Moral_Row[Moral_PN] to (String(Moral_playeramount[Moral_PN]))
In the Variable Editor, change the Size of Moraltimer to 28. Then click OK.

You need to compare these triggers side by side with one another. If there's one little mistake then it won't work.
I was changed multiboard because the old one didn't work so I wanted to see exact amount of morale instead of name or morale etc etc. Thanks for clearing out moraltimer confusion. multiboard is fixed but something prevents from activating actual riot. It doesn't work. edit: It should be fine by the modifier, decay and killdeath. since they work well on multiboard. maybe It's something to do with custom script. heres the event trigger
  • Custom script: if GetExpiredTimer() == udg_Moraltimer[udg_Moral_PN] then
 
Last edited:
Level 3
Joined
Feb 13, 2020
Messages
24
Your Moral Riot trigger is missing the Pick Every Player action. Notice how it's setting Moral_PN to the player number of the (Picked player), but there is no (Picked player) because you forgot to pick it.
It works... since I was had to carry triggers a lot while trying to fix the matching unit I guess I made things spagetti. thank you ma boi for helping an old man out.
 
Top