Item Problem; Hero can only have 1 kind of same item?

DoomedDude

New Member
Reaction score
1
I've been trying to make a hero drop item if it's trying to take one that it already has... It always a) Doesn't work or b)drops the first item picked
And I'm trying to make it so that I don't have to make it for every item because my map has like 20items.
Starting with
[Unit - A Unit acquires an item]
And action / Condition [hero manipulating item] and [item being manipulated]
Anyone can help me out?
 

Grymlax

Probably not around
Reaction score
138
here are 2 triggers that i think will be of assistance to you. I have also included these 2 triggers in a little demo map at the bottom of this post.

trigger 1: this trigger will drop the picked up item if you have another one of it's type in your inventory.
Code:
acquire the same item
    Events
        Unit - A unit Acquires an item
    Conditions
    Actions
        [B]For each (Integer A) from 1 to 6, do (Actions)[/B] [COLOR="SeaGreen"]\\ this is a loop it runs 6 times[/COLOR]
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to (Item-type of ([B]Item being manipulated[/B]))[COLOR="SeaGreen"] \\ Item being manipulated is the Acquired Item[/COLOR]
                        (Item carried by (Triggering unit) in slot (Integer A)) Not equal to (Item being manipulated)
                    Then - Actions
                        Hero - Drop (Item being manipulated) from (Triggering unit)
                    Else - Actions


Trigger 2: this will make sure that you can't pick up an item that is laying on the ground if you already have one of its type in your inventory. this trigger some would say was unneccessary but i think it looks better with this since the item you pick up won't move wich it should do if you only had the first trigger.
Code:
order to pick up the same item
    Events
        Unit - A unit Is issued an order targeting an object
    Conditions
        (Issued order) Equal to (Order(smart))
        (Target item of issued order) Not equal to No item
    Actions
        For each (Integer A) from 1 to 6, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to (Item-type of (Target item of issued order))
                        (Item carried by (Triggering unit) in slot (Integer A)) Not equal to (Target item of issued order)
                    Then - Actions
                        Set TempPoint = (Position of (Target item of issued order))
                        Unit - Order (Triggering unit) to Move To TempPoint
                        [B]Custom script:   call RemoveLocation (udg_TempPoint)[/B] [COLOR="SeaGreen"]\\this is to remove leaks[/COLOR]
                    Else - Actions

just tell me if you have problem understanding any of that code. though i will probably not be online again until tomorrow
 

Attachments

  • only one item.w3x
    17.8 KB · Views: 113
I

illidans911

Guest
Just Wondering, can i change it from specific item to item classification so like i can make swords as perm and armors as charged
 
I

illidans911

Guest
Woops sry, diddnt see the triggering in that. Administer, you can remove these two posts(i cant find the icon)
 

dannyboydude

Ultra Cool Member
Reaction score
33
posts cant be deleted but edited
but even if uedit it and delete all the words it will look like ur a noob who doesnt no how to type
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top