HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Need help with item "hero class requirement"

10-04-2009, 11:26 AM#1
keeday
Hi, i have a question. I just cant solve this by my self :(

I have a bundle of items that you can buy from shops. But there is one problem, i want that you must be a specific class to buy/pick up the item.

Ex, you need to be a paladin to pick up a hammer. So, if there is a hammer on the ground. You cant pick it up with ex Pit lord.

Well, we can say like this too. I want that you need to be a specific class to buy a specific item (You cant buy it). and you cant pick up a item if it not is for your class.

Like,if you buy a hammer the hammer is removed from your inventory and you gets all of your gold back. But when the Hammer is on the ground, you cant pick it up.

Im using this right now:
Trigger:
Hammer
Collapse Events
Unit - A unit Acquires an item
Collapse Conditions
(item type of (item being manipulated)) Equal to Hammer
Collapse Actions
Collapse if(all conditions are true) then do (Then actions) else do (Else actions)
Collapse If - conditions
(Unit type of (hero manipulating item)) equal to Paladin
Collapse Then - Actions
Do nothing
Collapse Else - Actions
Quest - Display to (Player group((owner of (hero manipulating item)))) the Quest update message: Bla bla bla bla
Item - Remove (Item being manipulated)
Player - Add 50 to (owner of (hero manipulating item)) current gold

But the problem here is that even when you pick the item up. The item is removed and you get gold. Just want that you cant pick it up and this trigger only works when you buy an item ;)

Hope i posted right
10-04-2009, 06:53 PM#2
Anopob
IIRC, "a unit sells an item" registers before acquires an item, so you can detect it from there. If not, you can use a combination of checking the unit under "buying unit" or "selling unit", see if it's null, and then react accordingly (eg. if selling unit == SHOP, then remove + give gold, otherwise, drop it on the ground).