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

Percent Chance to Perform Action?

Status
Not open for further replies.
Level 6
Joined
Aug 12, 2007
Messages
201
I have a trigger that adds random items to shops, but I was wondering if there way a way to set the chance an action has to fire. For example, every 180 seconds, pick all marketplaces, and do:

50% chance of Add Random Level 1 Item to Shop
30% Chance of Add Random Level 2 Item to Shop
20% Chance of Add Random Level 3 Item to Shop
10% Chance of Add Random Level 4 Item to Shop

Is there a way to make a trigger fire a percent of the time?
 
  • Shop Assistance
  • Events
    • Time - Every 180.00 seconds of game-time
  • Conditions
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Random integer number between 1 and 100) Less than or equal to 50
      • Then - Actions
        • Neutral Building - Add (Random level 1 item-type) to all marketplaces with 1 in stock and a max stock of 1
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Random integer number between 1 and 100) Less than or equal to 30
          • Then - Actions
            • Neutral Building - Add (Random level 2 item-type) to all marketplaces with 1 in stock and a max stock of 1
          • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Random integer number between 1 and 100) Less than or equal to 20
              • Then - Actions
                • Neutral Building - Add (Random level 3 item-type) to all marketplaces with 1 in stock and a max stock of 1
              • Else - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Random integer number between 1 and 100) Less than or equal to 10
                  • Then - Actions
                    • Neutral Building - Add (Random level 4 item-type) to all marketplaces with 1 in stock and a max stock of 1
                  • Else - Actions
Your unit-buildings must be Marketplaces in order for this trigger to work!
 
Level 6
Joined
Aug 12, 2007
Messages
201
Thanks everyone, this is a good start to base everything off of. All I have to do is figure out how to remove all of the marketplace's existing items, since there is no item group variable that you can pick from to removed picked.
 
Status
Not open for further replies.
Top