HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Max 1 of 1 item

01-29-2004, 06:33 PM#1
Arohk
heh i never tried that out before but, i need a trigger that automatical drops a item from a hero if the hero allready have 1 of the same item

well, the integer i wanted to use dont exist :bgrun: (Count Items of Type carried by hero)
there is only (Count Items carried by hero) emote_confused
i can do it whit Integer arrays but then i need 1 varriable and 2 triggers for every item

plz i need a simple way for this
01-29-2004, 07:47 PM#2
Extrarius
There is a boolean test 'Unit has Item Of Type'. Since you only want to allow one, that should be what you need.
01-29-2004, 08:04 PM#3
Arohk
i already tried that out, it dont work whit the event
Generic unit event-Unit acquire an item

that automatical drops the item from the hero , no matter what he have in the inventory.
arent there any way to count items of typ in inventory?
01-29-2004, 08:11 PM#4
Biflspud
Keep in mind that items have hitpoints - is there some way you can combine your triggers, i.e., check to see if they already have an item that has 482 hitpoints? You could give all weapon items that hitpoint total, and do an OR conditional to see if any of the 6 item slots has an item with 482 hp; if so, drop the new item.
01-29-2004, 09:00 PM#5
Shadow_Strike
biflespud, i dont think thatll work... lets just say this

1. 5+5=10

lets say 5 is a potion.
on number 1, you have 2 pots that are the same, it equals 10 so one drops.

on this one...

2. 4+6=10
4 is an herb and 6 is a key, it equals 10 so one must be dropped...

Edit: oo my bad... musta read ur post wrong...
01-29-2004, 09:47 PM#6
Darimus
set itemcount = 0

for each int a from 1 to 6 do if unit has item of type (item being manipulated) in slot int A, then set itemcount = itemcount + 1

if itemcount > 1 then drop item being manipulated
01-29-2004, 09:55 PM#7
weaaddar
for the more or less lazy there is the very awesome DT4a (found in the link of my sig) which can not only limit to one of one item, but one of one developer set item classification as well...
01-29-2004, 10:33 PM#8
Arohk
Quote:
Originally posted by Darimus
set itemcount = 0

for each int a from 1 to 6 do if unit has item of type (item being manipulated) in slot int A, then set itemcount = itemcount + 1

if itemcount > 1 then drop item being manipulated


verry nice try Darimus but it dont work emote_confused

see if i use this event
Generic unit event-Unit acquire an item
my hero get 1 item in the inventory before the trigger starts and the variable you told me count +1 and the item drops again

here i used this action, was it right?
-If ((Item carried by (Hero manipulating item) in slot (Integer A)) equal (Item being manipulated)) then do (Set itemcounter = (itemcounter + 1)) else do (Do nothing)
-If (itemcounter Gleich 1) then do (Held - Drop (Item being manipulated) from (Hero manipulating item)) else do (Do nothing)
-If (itemcounter Gleich 1) then do (Set itemcounter = 0) else do (Do nothing)
01-30-2004, 12:22 AM#9
Mink
The way I did it was pretty simple=

E-Unit acquires item
C-Item equal to (whatever you want to limit)
A- If herohasitem[player number of owner of hero manipulating item]=true then drop item being manipulated from hero manipulating item else set herohasitem[player number of owner of hero manipulating item]=true

This requires a second trigger though that says:

E- Unit loses an item
C-Item equal to (whatever)
A- set herohas item[player number of owner of her manipulating item]= False
01-30-2004, 08:07 AM#10
Krakou
Quote:
Originally posted by Arohk
verry nice try Darimus but it dont work emote_confused

see if i use this event
Generic unit event-Unit acquire an item
my hero get 1 item in the inventory before the trigger starts and the variable you told me count +1 and the item drops again

here i used this action, was it right?
-If ((Item carried by (Hero manipulating item) in slot (Integer A)) equal (Item being manipulated)) then do (Set itemcounter = (itemcounter + 1)) else do (Do nothing)
-If (itemcounter Gleich 1) then do (Held - Drop (Item being manipulated) from (Hero manipulating item)) else do (Do nothing)
-If (itemcounter Gleich 1) then do (Set itemcounter = 0) else do (Do nothing)


You have used Gleich (equal) that's the problem, use grater than.
01-30-2004, 09:42 AM#11
Bloodlust
Yea, I know I am sexy. Here we go:


1. Restrict Items to 1 Item of every Itemgroup (i.e. 1 Armor, 1 Helm, 1 Weapon, ...)

Code:
ItemRestriction
    Events
        Unit - A unit Acquires an item
    Conditions
    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
                        Or - Any (Conditions) are true
                            Conditions
                                And - All (Conditions) are true
                                    Conditions
                                        (Item-class of (Item being manipulated)) Equal to Purchasable
                                        (Item-class of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Purchasable
                                        (Item carried by (Triggering unit) in slot (Integer A)) Not equal to (Item being manipulated)
                                And - All (Conditions) are true
                                    Conditions
                                        (Item-class of (Item being manipulated)) Equal to Campaign
                                        (Item-class of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Campaign
                                        (Item carried by (Triggering unit) in slot (Integer A)) Not equal to (Item being manipulated)
                                And - All (Conditions) are true
                                    Conditions
                                        (Item-class of (Item being manipulated)) Equal to Artifact
                                        (Item-class of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Artifact
                                        (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
                        Do nothing

This check does NOT work with "Misc" Items. But those 3 up there work for sure. Didnt test the other yet.


1. Restrict Items to 1 Item of every Item (i.e. Only 1 Mask of Death, only 1 Claw +12000, only 1 Ring of Protection +5

Take stuff above and change it from Item Class to Item Type.


Have fun!
01-30-2004, 02:15 PM#12
Vexorian
HE isn't asking about item classes, he is asking about making it impossible to carry more than 1 item of the same type

Well the unit acquires an item event is odd because when it triggers the unit already has the item.

I would do this


Events:
A unit acquires an item

Conditions:

Actions:
for each integer a from 1 to 6 do (multiple actions)
- If (conditions)
--- (item carried by (triggering unit) in slot (integer a) not equal to (item being manipulated)
-- Item type of (item carried by (triggering unit) in slot (integer a) equal to item type of (item being manipulated)
- Then Actions:
--- Unit Drop (item being manipulated from (triggering unit)
--- skip remaining actions

BTW: Check my Item Classification System
01-30-2004, 03:01 PM#13
Bloodlust
vexorian, somehow the second part of my posting says exactly this.
01-30-2004, 03:25 PM#14
Vexorian
Quote:
Originally posted by Bloodlust
1. Restrict Items to 1 Item of every Item (i.e. Only 1 Mask of Death, only 1 Claw +12000, only 1 Ring of Protection +5

Take stuff above and change it from Item Class to Item Type.


Have fun!


I would say check my trigger and change item type with class, you would save some space and execution time.
01-30-2004, 05:45 PM#15
Arohk
Quote:
Originally posted by Lord Vexorian
HE isn't asking about item classes, he is asking about making it impossible to carry more than 1 item of the same type

Well the unit acquires an item event is odd because when it triggers the unit already has the item.

I would do this


Events:
A unit acquires an item

Conditions:

Actions:
for each integer a from 1 to 6 do (multiple actions)
- If (conditions)
--- (item carried by (triggering unit) in slot (integer a) not equal to (item being manipulated)
-- Item type of (item carried by (triggering unit) in slot (integer a) equal to item type of (item being manipulated)
- Then Actions:
--- Unit Drop (item being manipulated from (triggering unit)
--- skip remaining actions

BTW: Check my Item Classification System


WOHOO, THATS GREAT!, i needed some tries to make this trigger but that works perfect

THX VEX :hammer: