• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

random item giving (giving a wisp a random item available in a shop)

Status
Not open for further replies.
Level 11
Joined
Nov 12, 2006
Messages
765
in my map their is a 1 minute countdown to pick your item. however some players don't pick an item (for some reason) and that really messes up the game. so i am looking for a trigger that after 1 minute any wisps remaining in a region will get a random AVAILABLE item from a shop.

this is because when u pick your item, its picking ur starting territory, and the wisp is removed right after.
 
Level 18
Joined
Sep 27, 2005
Messages
2,069
Firstly create a trigger that will tell you when someone picks up an item:
The item you must put to class purchasable okay? Don't use any purcahsable items and use this as purchasable

Unit aquires an item
item being manipulated = item type of purchasable
if owner of aquiring unit = p1
then
set p1boolean = true
else
if owner of aquiring unit = p2
then
set p2boolean = true

....

Then

Time elapsed is 60 seconds
if then else
if p1 boolean = true
then: do nothing
else
set x = random number betwen 1 and 6
if x = 1 create item2
else
if x= 2 create item 3

etc make this for all players
 
Level 11
Joined
Nov 12, 2006
Messages
765
thanks. but what should the variable for x be? and the "random number between 1 and 6" should it be between 1 and 11 because that's how many items in the shop their is

EDIT: also in the bottom half, will the "if x = 1 create item2" will that give the item to the wisp?
 
Level 11
Joined
Nov 12, 2006
Messages
765
okay but will this give the player an item that hasnt been picked yet?

edit: with the 2nd set of triggers, is their a shortcut so that i dont have to do this for 11 players? (yes i know i diddnt finish this trigger i just copy/pasted to show the work)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • p1boolean Equal to True
    • Then - Actions
      • Do nothing
    • Else - Actions
      • Set x = (Random integer number between 1 and 11)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • x Equal to 1
        • Then - Actions
          • Hero - Create Geonosis and give it to (Random unit from (Units in AAA <gen> matching ((Owner of (Picked unit)) Equal to Player 1 (Red))))
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • x Equal to 1
            • Then - Actions
              • Hero - Create Geonosis and give it to (Random unit from (Units in AAA <gen> matching ((Owner of (Picked unit)) Equal to Player 1 (Red))))
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • x Equal to 1
                • Then - Actions
                  • Hero - Create Geonosis and give it to (Random unit from (Units in AAA <gen> matching ((Owner of (Picked unit)) Equal to Player 1 (Red))))
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • x Equal to 1
                    • Then - Actions
                      • Hero - Create Geonosis and give it to (Random unit from (Units in AAA <gen> matching ((Owner of (Picked unit)) Equal to Player 1 (Red))))
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • x Equal to 1
                        • Then - Actions
                          • Hero - Create Geonosis and give it to (Random unit from (Units in AAA <gen> matching ((Owner of (Picked unit)) Equal to Player 1 (Red))))
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • x Equal to 1
                            • Then - Actions
                              • Hero - Create Geonosis and give it to (Random unit from (Units in AAA <gen> matching ((Owner of (Picked unit)) Equal to Player 1 (Red))))
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • x Equal to 1
                                • Then - Actions
                                  • Hero - Create Geonosis and give it to (Random unit from (Units in AAA <gen> matching ((Owner of (Picked unit)) Equal to Player 1 (Red))))
                                • Else - Actions
                                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    • If - Conditions
                                      • x Equal to 1
                                    • Then - Actions
                                      • Hero - Create Geonosis and give it to (Random unit from (Units in AAA <gen> matching ((Owner of (Picked unit)) Equal to Player 1 (Red))))
                                    • Else - Actions
                                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                        • If - Conditions
                                          • x Equal to 1
                                        • Then - Actions
                                          • Hero - Create Geonosis and give it to (Random unit from (Units in AAA <gen> matching ((Owner of (Picked unit)) Equal to Player 1 (Red))))
                                        • Else - Actions
                                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            • If - Conditions
                                              • x Equal to 1
                                            • Then - Actions
                                              • Hero - Create Geonosis and give it to (Random unit from (Units in AAA <gen> matching ((Owner of (Picked unit)) Equal to Player 1 (Red))))
                                            • Else - Actions
                                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                • If - Conditions
                                                  • x Equal to 1
                                                • Then - Actions
                                                  • Hero - Create Geonosis and give it to (Random unit from (Units in AAA <gen> matching ((Owner of (Picked unit)) Equal to Player 1 (Red))))
                                                • Else - Actions
 
Last edited:
Level 11
Joined
Nov 12, 2006
Messages
765
okay okay and how do i add items to the "Bought Item" group (once a player has bought the item), which i have the variable set as an item class.

as of right now the trigger looks like this. is their an easier way to do this for 11 items times 11 players?

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • p1boolean Equal to True
    • Then - Actions
      • Do nothing
    • Else - Actions
      • Set x = (Random integer number between 1 and 11)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • x Equal to 1
          • Geonosis Not equal to BoughtItem
        • Then - Actions
          • Hero - Create Geonosis and give it to (Random unit from (Units in AAA <gen> matching ((Owner of (Picked unit)) Equal to Player 1 (Red))))
        • Else - Actions
 
Level 9
Joined
Apr 3, 2008
Messages
700
Here is a mistake. You have no picked unit. Use matching unit.
  • Hero - Create Geonosis and give it to (Random unit from (Units in AAA <gen> matching ((Owner of (Picked unit)) Equal to Player 1 (Red))))
how do i add items to the "Bought Item" group?
Set BoughtItem[a+1]=item type of Sold Item
You need not item-class variable, but item-type variable.
 
Status
Not open for further replies.
Top