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

[Trigger] Item System Not Working

Status
Not open for further replies.
Level 12
Joined
May 7, 2008
Messages
345
EDIT: Solved, Uncle found the solution as usual :p

I've been fiddling with this for about 6 hours before trying to post here, but sadly I'm not able to code this one out so I will need help with it.

Basically, I have a shop. The shop contains items, and if you gather 2 items of the same kind (eg. let's say Ring of Protection x2) then that prepares the trigger for the next step.



  • Enchanted Gaunlet Acquire
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
      • (Item-type of (Sold Item)) Equal to |cff800080Runed Gauntlets|r
    • Actions
      • For each (Integer A) from 1 to 6, do (If ((Item-type of (Item carried by (Buying unit) in slot (Integer A))) Equal to |cff800080Runed Gauntlets|r) then do (Set VariableSet ItemAmount = (ItemAmount + 1)) else do (Do nothing))
      • Game - Display to (All players) the text: 1


the above code works, however I'm not sure of the Integer Variable ''ItemAmount'' and does it apply to the hero manipulating item or does it apply in general? The map I'm working on has 6 players, so would the trigger above cause any bugs towards that end?

What I'm trying to say is that the code above needs slight tweaking in example below, unless the code I mentioned above is fine (I edited only the ''For each'' trigger:

  • Enchanted Gaunlet Acquire
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
      • (Item-type of (Sold Item)) Equal to |cff800080Runed Gauntlets|r
    • Actions
      • For each (Integer A) from 1 to 6, do (If ((Item-type of (Item carried by (Buying unit) in slot (Integer A))) Equal to |cff800080Runed Gauntlets|r) then do (Set VariableSet ItemAmount = (ItemAmount + 1 for [B](Owner of (Hero Manipulating Item)[/B])) else do (Do nothing))
      • Game - Display to (All players) the text: 1

Then, once that's settled, the player unit who has ''Item Amount'' number equal to 2 can buy the ''Legendary'' item from the other shop, and once he buys the item the ''Item Amount'' should reset back to 0, unabling him to acquire the item unless he has Item Amount equal to 2 again. So far I came up with this:

  • Enchanted Gaunlets Recipe
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Enchanted Gaunlets
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ItemAmount Equal to 2
        • Then - Actions
          • Hero - Drop (Item carried by (Hero manipulating item) of type |cff800080Runed Gauntlets|r) from (Hero manipulating item).
          • Item - Remove (Last dropped item)
          • Hero - Drop (Item carried by (Hero manipulating item) of type |cff800080Runed Gauntlets|r) from (Hero manipulating item).
          • Item - Remove (Last dropped item)
          • Hero - Create |cffd45e19Enchanted Gaunlets|r and give it to (Hero manipulating item)
          • Set VariableSet ItemAmount = 0
        • Else - Actions

Also tried this, in hopes that it somehow would work lol


  • Enchanted Gaunlets Recipe
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Enchanted Gaunlets
    • Actions
      • For each (Integer A) from 1 to 6, do (If ((Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to |cff800080Runed Gauntlets|r) then do (Item - Remove (Item carried by (Hero manipulating item) of type |cff800080Runed Gauntlets|r)) else do (Item - Remove (Item carrie
      • Hero - Create |cffd45e19Enchanted Gaunlets|r and give it to (Hero manipulating item)
      • For each (Integer A) from 1 to 6, do (If ((Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to |cffd45e19Enchanted Gaunlets|r) then do (Set VariableSet ItemAmount = 0) else do (Do nothing))

Sadly it doesn't work :(

Also the Legendary shop (last trigger) sells Tomes, so that I can give item to triggering units who have full 6 inventory slots.
 
Last edited by a moderator:

Uncle

Warcraft Moderator
Level 65
Joined
Aug 10, 2018
Messages
6,688
So you want a Shop that sells Item Recipes basically? For example, the shop has a Super Ring which requires 2x Normal Rings and an additional 100 gold to purchase. If you purchase it without having the 2x Normal Rings in your inventory then you're refunded your gold and nothing happens. Otherwise, your 2x Normal Rings are removed and replaced with a Super Ring. Is this correct?

If so, why do you use Tomes for the Legendary shop but not the others? Aren't they using the same system, why make one easier to manage than the other?

If I were you I would throw together a system using a Hashtable to automate this process. You should be able to have all of this run off of a single trigger.
 
Level 12
Joined
May 7, 2008
Messages
345
So you want a Shop that sells Item Recipes basically? For example, the shop has a Super Ring which requires 2x Normal Rings and an additional 100 gold to purchase. If you purchase it without having the 2x Normal Rings in your inventory then you're refunded your gold and nothing happens. Otherwise, your 2x Normal Rings are removed and replaced with a Super Ring. Is this correct?

If so, why do you use Tomes for the Legendary shop but not the others? Aren't they using the same system, why make one easier to manage than the other?

If I were you I would throw together a system using a Hashtable to automate this process. You should be able to have all of this run off of a single trigger.

That is correct Mr. Uncle,

however instead of gold I'd use lumber, since in the Legendary shop you can only purchase stuff with lumber D:


I don't know, at this point I thought it would be a good idea to use Tomes for the Legendaries and I already had other items as regular items in the normal shop so I was kind of lazy to not create the items in the regular shop as tomes.


And about throwing a system with hastable - saw few of them around here, but none of them so far combine the same items. Usually it's Ring + Helmet = Epic Axe or something like that, unless I'm mistaken of course.
 

Uncle

Warcraft Moderator
Level 65
Joined
Aug 10, 2018
Messages
6,688
I'd assume those systems would allow you to plug in the same item multiple times for that desired effect. If not, it's a fairly easy system to throw together once you know what you're doing. I can do it for you if you'd like, I'm pretty sure I have a working Recipe system lying around in a folder somewhere.

The only thing that makes it slightly annoying is the lack of consistency between using Tomes/not using Tomes. But maybe that could be accounted for.

Edit: Attached two maps.

Item Recipes Only Tomes is the more simplified version of the two but only works with Tome recipes. So you'd need to create Tome versions of every Item recipe.

The other map (Tomes or No Tomes) can do both Tome/Tomeless recipes but uses an Item Indexer system to manage this. The only reason this could be a problem is if you were using Custom Value of Items anywhere in your triggers since this system will change those values. That being said the Item Indexer is a great tool for replacing the need of doing that so you could adjust those triggers to take advantage of it instead.

Important rules for using the system:
  • Recipes must use the Power Up classification.
  • FOR THE Tomes Or No Tomes MAP - The Upgrade item must use the Power Up classification.
  • You must configure the IU System Setup trigger. This requires that you copy/paste or create your own "Null" item which is basically just a throwaway item that'll never be used outside of the system's triggers.
  • You must add your desired Item combinations to the system in the IU Items Setup trigger.
Technically you could edit the triggers so that the Power Up classification isn't used/needed. It's only used as the Condition for when a Unit acquires an item to help filter out unwanted item-types that aren't used by the system.
 

Attachments

  • Item Recipes Only Tomes.w3m
    23 KB · Views: 12
  • Item Recipes Tomes or No Tomes.w3m
    32.7 KB · Views: 14
Last edited:
Level 12
Joined
May 7, 2008
Messages
345
I'd assume those systems would allow you to plug in the same item multiple times for that desired effect. If not, it's a fairly easy system to throw together once you know what you're doing. I can do it for you if you'd like, I'm pretty sure I have a working Recipe system lying around in a folder somewhere.

The only thing that makes it slightly annoying is the lack of consistency between using Tomes/not using Tomes. But maybe that could be accounted for.

Edit: Attached two maps.

Item Recipes Only Tomes is the more simplified version of the two but only works with Tome recipes. So you'd need to create Tome versions of every Item recipe.

The other map (Tomes or No Tomes) can do both Tome/Tomeless recipes but uses an Item Indexer system to manage this. The only reason this could be a problem is if you were using Custom Value of Items anywhere in your triggers since this system will change those values. That being said the Item Indexer is a great tool for replacing the need of doing that so you could adjust those triggers to take advantage of it instead.

Important rules for using the system:
  • Recipes must use the Power Up classification.
  • FOR THE Tomes Or No Tomes MAP - The Upgrade item must use the Power Up classification.
  • You must configure the IU System Setup trigger. This requires that you copy/paste or create your own "Null" item which is basically just a throwaway item that'll never be used outside of the system's triggers.
  • You must add your desired Item combinations to the system in the IU Items Setup trigger.
Technically you could edit the triggers so that the Power Up classification isn't used/needed. It's only used as the Condition for when a Unit acquires an item to help filter out unwanted item-types that aren't used by the system.

Thank you, I will definitely check this out and edit this post once I start editing the system you attached here!
 
Status
Not open for further replies.
Top