HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Limiting Item Classes

08-30-2006, 01:11 AM#1
illidan92
Okay so i'm trying to limit each hero to only 1 item if they belong to these classes: Permanent, Artifact, and campaign. My trigger is:

Trigger:
Collapse Events
Unit - A unit Acquires an item
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-class of (Item being manipulated)) Equal to (Item-class of (Item carried by (Hero manipulating item) in slot (Integer A)))
(Item-class of (Item being manipulated)) Not equal to Purchasable
(Item-class of (Item being manipulated)) Not equal to Powerup
Collapse Then - Actions
Hero - Drop (Item being manipulated) from (Hero manipulating item)
Collapse Else - Actions
Do nothing
I think the problem lies in the integer A part. What happens is when I try to pickup a weapon with an empty inventory it drops, but when I have a potion in my inventory the trigger doesn't do what it's supposed to do!
08-30-2006, 02:42 AM#2
SentryIII
You have to use a For Integer A action to loop through 1-6 so that you can check the slots properly. Simply using Integer A by itself will simply use the value it was set to last in a previous For Integer A iteration.
08-30-2006, 04:19 AM#3
illidan92
So what do I change?
08-30-2006, 07:13 AM#4
SentryIII
Put your actions in a For Integer A action and set it to loop through 1-6.
08-30-2006, 08:49 PM#5
illidan92
Thanks sentryIII ur da bomb :D

Anyways while I was in bed I did a rem cycle and figured out the loop while trying to fall asleep, but now I know for sure.
Side Note: Do you think "better" and harder when you're trying to fall asleep?

Okay now it drops the item even if he has an empty inventory slot, I think because when the item is picked up it detects that picked up item. Heres the new trigger:
Trigger:
Collapse Events
Unit - A unit Acquires an item
Conditions
Collapse Actions
Collapse For each (Integer A) from 1 to 6, do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Item-class of (Item being manipulated)) Equal to (Item-class of (Item carried by (Hero manipulating item) in slot (Integer A)))
(Item-class of (Item being manipulated)) Not equal to Purchasable
(Item-class of (Item being manipulated)) Not equal to Powerup
Collapse Then - Actions
Hero - Drop (Item being manipulated) from (Hero manipulating item)
Collapse Else - Actions
Do nothing
09-01-2006, 12:30 AM#6
Lucavixp
How strange. I have just been researching sleep as I have found that I have a disorder. I say yes to the thinking thing!
On your first condition, I think removing the "item being manipulated" might help. It looks like you're checking the class of the item being picked up, which is then added to the inventory, and the you check the item in the inventory, which returns true. So in any case, the item will be dropped.
09-01-2006, 12:40 AM#7
martix
Offtopic:
Lol, I got a lot of my best ideas just when trying to go to sleep! Guess its common.
09-01-2006, 04:39 AM#8
illidan92
What can I do to make the trigger work? The damn GUI doesn't let me check the number if item classes in an inventory, I think.
09-01-2006, 09:18 PM#9
martix
This may be crap, but try reversing this:
(Item-class of (Item being manipulated)) Equal to (Item-class of (Item carried by (Hero manipulating item) in slot (Integer A)))