• 🏆 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 problem?

Status
Not open for further replies.
Level 6
Joined
Feb 16, 2014
Messages
193
I made this trigger but its not working the way i wanted it to :ogre_rage:
  • Untitled Trigger 002 Copy
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Barrett M82
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item carried by (Hero manipulating item) in slot 1)) Equal to Barrett M82
          • (Item-type of (Item carried by (Hero manipulating item) in slot 2)) Equal to Barrett M82
          • (Item-type of (Item carried by (Hero manipulating item) in slot 3)) Equal to Barrett M82
          • (Item-type of (Item carried by (Hero manipulating item) in slot 4)) Equal to Barrett M82
          • (Item-type of (Item carried by (Hero manipulating item) in slot 5)) Equal to Barrett M82
          • (Item-type of (Item carried by (Hero manipulating item) in slot 6)) Equal to Barrett M82
    • Actions
      • Hero - Drop (Item being manipulated) from (Hero manipulating item)
I wanted it to be like this:
A unit picks up a Barrett M82 gun,then when that unit tries to pick up another Barrett M82 it will drop that item,or in other words,how to make a unit NOT have the same item in its inventory more than twice.(like u cant have 2 Barrett M82s but u can pick up other weapons,but it must not be that same weapon(item) u have.
But instead this is what happens:
A unit attempts to pick up a Barrett M82 but it always drops it(but the inventory is empty,there is no other Barrett M82 in any slot of the inventory)
Please help me to fix that trigger. :ogre_rage:
 
The problem is that the or-condition is always true in your case.

To fix it, simply compare if "Item carried by (Hero manipulating item) in slot x" equals Item being manipulated. If not, check if the item type is equal to Barrett M82. If it is, drop Item being manipulated.


  • (Item-type of (Item carried by (Hero manipulating item) in slot x)) Equal to Barrett M82 AND (Item carried by (Hero manipulating item) in slot x) Not equal to (Item being manipulated)
 
Level 6
Joined
Feb 16, 2014
Messages
193
Maybe im doing it wrong? because it didnt work :(
  • Untitled Trigger 002 Copy
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Barrett M82
          • Or - Any (Conditions) are true
            • Conditions
              • (Item-type of (Item carried by (Hero manipulating item) in slot 1)) Equal to Barrett M82
              • (Item-type of (Item carried by (Hero manipulating item) in slot 2)) Equal to Barrett M82
              • (Item-type of (Item carried by (Hero manipulating item) in slot 3)) Equal to Barrett M82
              • (Item-type of (Item carried by (Hero manipulating item) in slot 4)) Equal to Barrett M82
              • (Item-type of (Item carried by (Hero manipulating item) in slot 5)) Equal to Barrett M82
              • (Item-type of (Item carried by (Hero manipulating item) in slot 6)) Equal to Barrett M82
        • Then - Actions
          • Hero - Drop (Item being manipulated) from (Hero manipulating item)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Barrett M82
          • Or - Any (Conditions) are true
            • Conditions
              • (Item-type of (Item carried by (Hero manipulating item) in slot 1)) Not equal to Barrett M82
              • (Item-type of (Item carried by (Hero manipulating item) in slot 2)) Not equal to Barrett M82
              • (Item-type of (Item carried by (Hero manipulating item) in slot 3)) Not equal to Barrett M82
              • (Item-type of (Item carried by (Hero manipulating item) in slot 4)) Not equal to Barrett M82
              • (Item-type of (Item carried by (Hero manipulating item) in slot 5)) Not equal to Barrett M82
              • (Item-type of (Item carried by (Hero manipulating item) in slot 6)) Not equal to Barrett M82
        • Then - Actions
          • Do nothing
        • Else - Actions
Can u plz give an example so i can understand it better
 
Last edited:
Ah, no, that wasn't what I meant.


  • Untitled Trigger 002 Copy
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Barrett M82
          • Or - Any (Conditions) are true
            • Conditions
              • (Item-type of (Item carried by (Hero manipulating item) in slot 1)) Equal to Barrett M82 AND (Item carried by (Hero manipulating item) in slot 1) Not equal to (Item being manipulated)
              • (Item-type of (Item carried by (Hero manipulating item) in slot 2)) Equal to Barrett M82 AND (Item carried by (Hero manipulating item) in slot 2) Not equal to (Item being manipulated)
              • (Item-type of (Item carried by (Hero manipulating item) in slot 3)) Equal to Barrett M82 AND (Item carried by (Hero manipulating item) in slot 3) Not equal to (Item being manipulated)
              • (Item-type of (Item carried by (Hero manipulating item) in slot 4)) Equal to Barrett M82 AND (Item carried by (Hero manipulating item) in slot 4) Not equal to (Item being manipulated)
              • (Item-type of (Item carried by (Hero manipulating item) in slot 5)) Equal to Barrett M82 AND (Item carried by (Hero manipulating item) in slot 5) Not equal to (Item being manipulated)
              • (Item-type of (Item carried by (Hero manipulating item) in slot 6)) Equal to Barrett M82 AND (Item carried by (Hero manipulating item) in slot 6) Not equal to (Item being manipulated)
        • Then - Actions
          • Hero - Drop (Item being manipulated) from (Hero manipulating item)
 
Level 6
Joined
Feb 16, 2014
Messages
193
Thank you very much it worked,But how about if its in shop,like if u have already a Barrett M82 in your inventory then u try to buy another Barrett M82 in the shop then that item will automatically be dropped.I tried this but its not working properly :/
  • Untitled Trigger 002
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Sold Item)) Equal to Barrett M82
          • Or - Any (Conditions) are true
            • Conditions
              • ((Item-type of (Item carried by (Buying unit) in slot 1)) Equal to Barrett M82) and ((Item carried by (Buying unit) in slot 1) Not equal to (Sold Item))
              • ((Item-type of (Item carried by (Buying unit) in slot 2)) Equal to Barrett M82) and ((Item carried by (Buying unit) in slot 2) Not equal to (Sold Item))
              • ((Item-type of (Item carried by (Buying unit) in slot 3)) Equal to Barrett M82) and ((Item carried by (Buying unit) in slot 3) Not equal to (Sold Item))
              • ((Item-type of (Item carried by (Buying unit) in slot 4)) Equal to Barrett M82) and ((Item carried by (Buying unit) in slot 4) Not equal to (Sold Item))
              • ((Item-type of (Item carried by (Buying unit) in slot 5)) Equal to Barrett M82) and ((Item carried by (Buying unit) in slot 5) Not equal to (Sold Item))
              • ((Item-type of (Item carried by (Buying unit) in slot 6)) Equal to Barrett M82) and ((Item carried by (Buying unit) in slot 6) Not equal to (Sold Item))
        • Then - Actions
          • Hero - Drop (Sold Item) from (Buying unit)
        • Else - Actions
 
Level 6
Joined
Feb 16, 2014
Messages
193
Do you have any other triggers that might drop an item?

After some testing it was all good after all,when i buy the item in the shop it drops on the ground,but i can still pick the item up if my inventory doesnt have the same item.Its all good :goblin_good_job: ,but how do i do that when a unit drops an item then other player's units cant pick it up?
 
This requires some changes in triggers; you basicly assign an "owner index" to each item. You can do that by using the item's custom value. If a unit picks up an item, assign the number of said player to the item via custom value.

Then, in the acquire item trigger, add a condition if custom value is either 0 or the player number of the player picking up.
 
Level 6
Joined
Feb 16, 2014
Messages
193
Um,like this.
  • Untitled Trigger 001
    • Events
      • Unit - A unit Loses an item
    • Conditions
    • Actions
      • Item - Set the custom value of (Item being manipulated) to 1
 
Level 12
Joined
Oct 16, 2010
Messages
680
no. set the value to the player id ( Player ->1<- , Player ->2<- ...)

+ a pick up event

unit aquires item

condition custom value of item equals to player id

else
drop

also implement these in your existing triggers don't make new ones (unless you want this to work for every single item in game)
 
Level 6
Joined
Feb 16, 2014
Messages
193
no. set the value to the player id ( Player ->1<- , Player ->2<- ...)

+ a pick up event

unit aquires item

condition custom value of item equals to player id

else
drop

also implement these in your existing triggers don't make new ones (unless you want this to work for every single item in game)
So i make a player variable and set a value to it?
 
Status
Not open for further replies.
Top