• 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.

Item related question

Status
Not open for further replies.
Level 2
Joined
Aug 22, 2014
Messages
7
Hi people! I need help with deleting items from map every X sec or min in condition if number of this items or items of type are more or equal to X?
Please tell me how to do it using trigger system.

And one more thing how to use triggers with chat for ex. i need to give hero item/stats/xp and take some gold/wood/item per command/entered chat string.
How can i make it work?
Thanks for your time...
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
For items
  • items
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Item - Pick every item in (Playable map area) and do (Actions)
        • Loop - Actions
          • Set Item_Counter = (Item_Counter + 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Item_Counter Greater than or equal to 30 (30 is 30 Items)
            • Then - Actions
              • Item - Remove (Picked item)
            • Else - Actions
For the chat thingy, what chat command string you want to use ? How do you want it to work ?
 
Level 2
Joined
Aug 22, 2014
Messages
7
Thanks for item ting.
What I need for chat is something like each player can buy for picked hero/unit entering string like "Buy Exp" or "Buy Item" or just item/exp... So that wood/gold/item was taken for entering this string if no resources/item it not worked....
 
Last edited:
Level 15
Joined
Oct 29, 2012
Messages
1,474
Hmm for Xprience Points/HP/Mana/Agi/Str/Int, it would be like this
  • Buy
    • Events
      • Player - Player 1 (Red) types a chat message containing -buyexp as A substring
    • Conditions
    • Actions
      • Set ExpDemanded = (Integer((Substring((Entered chat string), 9, (Length of (Entered chat string))))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering player) Current gold) Greater than or equal to ExpDemanded
        • Then - Actions
          • Hero - Add ExpDemanded experience to HeroOfPlayer[(Player number of (Triggering player))], Show level-up graphics
          • Player - Add (-1 x (ExpDemanded) ) to (Triggering player) Current Gold
        • Else - Actions
          • Game - Display to (Player group((Triggering player))) the text: Your gold isn't enough


To Buy Item by Lumber for example :
  • Buy
    • Events
      • Player - Player 1 (Red) types a chat message containing -buyitem as A substring
    • Conditions
    • Actions
      • Set ItemName = (Substring((Entered chat string), 10, (Length of (Entered chat string))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ItemName Equal to Gloves of Haste
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Player 1 (Red) Current lumber) Greater than or equal to 500
            • Then - Actions
              • Item - Create Gloves of Haste at (Position of HeroOfPlayer[(Player number of (Triggering player))])
              • Hero - Give (Last created item) to HeroOfPlayer[(Player number of (Triggering player))]
              • Player - Add -500 to (Triggering player) Current lumber
            • Else - Actions
              • Game - Display to (Player group((Triggering player))) the text: Your gold isn't eno...
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ItemName Equal to Claws of Attack +15
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Player 1 (Red) Current lumber) Greater than or equal to 450
            • Then - Actions
              • Item - Create Claws of Attack +15 at (Position of HeroOfPlayer[(Player number of (Triggering player))])
              • Hero - Give (Last created item) to HeroOfPlayer[(Player number of (Triggering player))]
              • Player - Add -450 to (Triggering player) Current lumber
            • Else - Actions
              • Game - Display to (Player group((Triggering player))) the text: Your gold isn't eno...
        • Else - Actions
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
The triggers above leak. Also anything used twice or more should be stored in a variable and the variable should be used. Example: triggering player.

The above also only allows specific items to be bought. If you want all items to be buyable by typing in -buyitem then you need something like the item name or an id for that item.

I forgot to include a note that it does leak
Also no player would type -buyitem 24FK , lel , that's not interactive. It would be easy for the player , but tough for the maker
 
Level 2
Joined
Aug 22, 2014
Messages
7
I did what you explained with exp but trigger takes gold and not giving exp. What I've done wrong? And do I need to make the same for all players or I need only one for all?
 
Last edited:
Status
Not open for further replies.
Top