• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Need help with item "hero class requirement"

Status
Not open for further replies.
Level 5
Joined
Nov 2, 2008
Messages
48
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.

+rep for that one that solves the problem for me ;D
 
Level 11
Joined
Feb 14, 2009
Messages
884
There is no way to do that. What you can do though, is to check a unit's class every time it picks up an item. If it is eligible of holding it, no problem. Else, make it drop the item, refund the cost etc...
 
Level 14
Joined
Sep 27, 2009
Messages
1,547
Yeah, you can make trigger like:
Events:
unit acruides an item
Conditions:
(Item being manipulated) is equal to Paladin's thing
(Hero manipulating item) is equal to Pit Lord
Actions:
order (hero manipulating item) to drop (item being manipulated)

Or just something like that, it was just example.
 
Last edited:
Level 7
Joined
Jul 29, 2009
Messages
276
yeah, what nuclear patato said.
but there is no simple way to not allow people to buy an item...
you can make an array of all the items and an array of all item costs, and thats the only way to find out the cost so you can repay the gold.
 
Level 6
Joined
May 1, 2009
Messages
215
Mmm, I do believe you can restrict items based on research requirements (or at least, tiers), I also believe you can restrict the effects of items by giving the item abilities research dependencies. Then, upon becoming a certain class, certain researches are researched for a player automatically - this means the player cannot change their class however.

How does that sound? It doesn't force the player to drop the item since the effects will be disabled, although a player mistakenly buying a non-class item will not be refunded, it's probably a little easier to do, especially if you're unfamilar with arrays, though the aforementioned ways of doing it are guaranteed to work.
 
Level 5
Joined
Nov 2, 2008
Messages
48
Well, i tried with that when the hero acquires an item. The hero must be a specific class to get it. I mean, if it is a paladin and he buys the hammer he will hold it. But if ex the pit lord tryes to buy the item it is removed from his inventory and he gets the gold back.

Ok, thats almost what i want. Here is the problem, when the pit lord pick the item from the ground the item is destroyed and the pit lord gets the gold the item was sold for. I just want that he cant pick it up ^^


  • Hammer
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (item type of (item being manipulated)) Equal to Hammer
    • Actions
      • if(all conditions are true) then do (Then actions) else do (Else actions)
        • If - conditions
          • (Unit type of (hero manipulating item)) equal to Paladin
      • Then - Actions
        • Do nothing
      • 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
Here does i have one. But the problem is, well.. The item is being "sold" when you pick it up. If you dont are paladin =)

Can i solve it in some way?
 
Well, i tried with that when the hero acquires an item. The hero must be a specific class to get it. I mean, if it is a paladin and he buys the hammer he will hold it. But if ex the pit lord tryes to buy the item it is removed from his inventory and he gets the gold back.

Ok, thats almost what i want. Here is the problem, when the pit lord pick the item from the ground the item is destroyed and the pit lord gets the gold the item was sold for. I just want that he cant pick it up ^^


  • Hammer
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (item type of (item being manipulated)) Equal to Hammer
    • Actions
      • if(all conditions are true) then do (Then actions) else do (Else actions)
        • If - conditions
          • (Unit type of (hero manipulating item)) equal to Paladin
      • Then - Actions
        • Do nothing
      • 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
Here does i have one. But the problem is, well.. The item is being "sold" when you pick it up. If you dont are paladin =)

Can i solve it in some way?

change the part
  • 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
to

  • Quest - Display to (Player group((owner of (hero manipulating item)))) the Quest update message: Bla bla bla bla
  • Item - Drop (Item being manipulated) from (Triggering Unit)
I'm sure it works because I use it for my map.... You can also just place the condition for the class in the Conditions tab.... and you wont need that Do nothing... because that does nothing helpful it just adds an extra line of code....

Also if you have many class specific items then just place all the item conditions into an Or-Multiple Conditions

-I hope you understood what I said, if anything is not clear just PM me...

If you dont want other classes to buy an item not for them you can just write in the item description what class they are for.. I dont think there is someone stupid to buy an item not for them.....

@Handycombinder: when does items started to leak???
 
Status
Not open for further replies.
Top