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

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 29
Joined
Oct 24, 2012
Messages
6,543
Having an item removal of that sort is not a good idea. If someone drops an item they want at the wrong time or kills a boss at the wrong time it can remove a good item.

You should remove an item after a given time. So when an item is dropped wait 30 seconds or 1 minute. Then check if item was picked up and remove item if it was not.
 
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 29
Joined
Oct 24, 2012
Messages
6,543
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.
 
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