• 🏆 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!

How to make an item only usable once?

Status
Not open for further replies.
Level 6
Joined
Dec 9, 2014
Messages
176
Some of the items in my game are extremely rare. I'd like them to only be usable once and afterwards if you manage to find another and try to use it, it will instead give you a message saying that you already have it. I have a pet system that is very nearly complete save adding more pets and where you can find them. I just need to make it so you can't summon more if you already have one pet. I'll include the map so you can take a look at the system. After the naming and gender choosing parts, you'll find 2 items in front of your character. I need it so that if you already have the pet, you cannot summon it again. My pet menu system is working great, I just need the items to work as well. Thanks so much for any help!
 

Attachments

  • WoE - MC 0.1.w3x
    270.3 KB · Views: 35
Level 25
Joined
Sep 26, 2009
Messages
2,378
when you use item, you actually also fire the "Unit begins casting an ability" event, because your unit casts the ability that's in the item.

So all you need to do is actually make for example a unit group that is empty at the start of your map.
Now when any hero uses the rare item, check if he's in the unit group.
If he:
1) isn't in the unit group, then just add him in it. This will make him use the item.
2) is in the unit group, order the hero to stop (= Unit - issue order with no target).

So basically the unit group would contain all heroes who are forbidden to cast the ability again.
Also, don't destroy the group ever. If you were to destroy it, all your heroes would be able to use those rare items again.
 
Status
Not open for further replies.
Top