• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Prohibition of purchase of items

Level 8
Joined
Apr 16, 2025
Messages
160
When buying an experience book for a unit that has a hero slot, the game crashes. How to avoid this? How to track the purchase of an item before using it?

Or how to prohibit a shop from selling items to units but not heroes? I tried to set allowed targets for "select hero", but it didn't work.
 
Last edited:
I think the ideal solution is to trigger things yourself:
  • Custom Tome of Experience
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Tome of Experience NEW
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Hero - Add 100 experience to (Triggering unit), Show level-up graphics
So you copy and paste an existing Tome (Item), change it's Ability to something that doesn't crash the game - I used "Item Permanent Life Gain" with the bonus set to 0 since all Units in the game have Life, and trigger the effects yourself.

Now you're in full control of what happens when the Tome is consumed. You can create your own effects with this as well, ie: Adding bonus experience to an underleveled hero or scaling the experience gain based on the hero level. You could even have an alternate effect if the unit isn't a Hero, making the tome useful to everyone.
 

Attachments

Last edited:
When buying an experience book for a unit that has a hero slot, the game crashes.
Crashing happens because you buy an item that gives attrihutes for a hero but the buying unit is not a hero

how to prohibit a shop from selling items to units but not heroes
1.the shop can have the ability [select hero] or [select unit]
2. If a unit does not have [inventory] ability then it cannot buy

if you want the unit to carry the item but not use it then it must have [unit inventory] ability not [hero inventory]
 
Last edited:
I think the ideal solution is to trigger things yourself:
  • Custom Tome of Experience
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Tome of Experience NEW
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Hero - Add 100 experience to (Triggering unit), Show level-up graphics
So you copy and paste an existing Tome (Item), change it's Ability to something that doesn't crash the game - I used "Item Permanent Life Gain" with the bonus set to 0 since all Units in the game have Life, then you trigger the effects yourself.

Now you're in full control of what happens when the Tome is consumed. You can create your own interesting effects with this as well, ie: Adding bonus experience to an underleveled hero or scaling the experience gain based on the hero level. You could even have an alternate effect if the unit isn't a Hero, making the tome useful to everyone.
You are right as always))

Crashing happens because you buy an item that gives attrihutes for a hero but the buying unit is not a hero


1.the shop can have the ability [select hero] or [select unit]
2. If a unit does not have [inventory] ability then it cannot buy

if you want the unit to carry the item but not use it then it must have [unit inventory] ability not [hero inventory]
Alas, my unit is like a bear in Dota. Heroic slots.
 
Yes, items should give him protection, regeneration, etc. But at the same time he should not have the ability to receive exp, otherwise he will share it with the hero, which is not good.In short, the issue has already been resolved - triggered gaining of exp.
So you were looking to disable specific hero to gain experience from items (and probably kills). I misunderstood your post.
 
Back
Top