item trouble

dannyboydude

Ultra Cool Member
Reaction score
33
How can i make it so you can only have 1 of a specific item at a time

e,g, im using like id cards in my map and you can only have 1 at a certain time

How would i stop people from buying 2 at the shop or getting 2 from creep drops?
 

shinami

Redirect your complaints to the nearest wall
Reaction score
47
Not sure if this will work, but i think you shuold make a trigger that would set some ItemInteger to +1 every time you buy that specific item, and when the integer is equal to 2 remove it.
 

meehael

New Member
Reaction score
6
Try this:
Code:
Trigger 001
    Events
        Unit - A unit Acquires an item
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Hero manipulating item) has an item of type [B][I]YourItem[/I][/B]) Equal to True
            Then - Actions
                Hero - Drop (Item being manipulated) from (Hero manipulating item)
            Else - Actions
 

Builder Bob

Live free or don't
Reaction score
249
when a unit picks up an item, check all item slots except the one you just picked up. If you find an item with the same itemId, just drop the newly acquired item.

Edit: or do as meehael said. I didn't realize there was a condition like that.
 

Exide

I am amazingly focused right now!
Reaction score
448

meehael

New Member
Reaction score
6
Yes, Exide, you're right.
Try this, Danny:

Code:
Untitled Trigger 006
    Events
        Unit - A unit Acquires an item
    Conditions
        (Item-type of (Item being manipulated)) Equal to [B][I]YourItem[/I][/B]
    Actions
        Set [B][I]YourCounter[/I][/B] = 0
        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 (Hero manipulating item) in slot (Integer A))) Equal to [B][I]YourItem[/I][/B]
                    Then - Actions
                        Set [B][I]YourCounter[/I][/B] = ([B][I]YourCounter[/I][/B] + 1)
                    Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                [B][I]YourCounter[/I][/B] Greater than 1
            Then - Actions
                Hero - Drop (Item carried by (Hero manipulating item) of type [B][I]YourItem[/I][/B]) from (Hero manipulating item)
            Else - Actions
 

Dameon

"All the power in the world resides in the eyes"
Reaction score
127
Try this:
Code:
Trigger 001
    Events
        Unit - A unit Acquires an item
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Hero manipulating item) has an item of type [B][I]YourItem[/I][/B]) Equal to True
            Then - Actions
                Hero - Drop (Item being manipulated) from (Hero manipulating item)
            Else - Actions


Close but no, this trigger will drop the item no matter what cause of course your going to have the item you just got.

Just put all your key cards in the same folder and set the first condition to that.
Code:
Untitled Trigger 001
    Events
        Unit - A unit Acquires an item
    Conditions
        (Item-class of (Item being manipulated)) Equal to Permanent
    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 (Hero manipulating item) in slot (Integer A))) Equal to (Item-type of (Item being manipulated))
                        (Item carried by (Hero manipulating item) in slot (Integer A)) Not equal to (Item being manipulated)
                    Then - Actions
                        Hero - Drop (Item being manipulated) from (Hero manipulating item)
                    Else - Actions

Edit, I realy need to start reading all the way down.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top