• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

How to get AI Hero Units to Not Drop Items???

Status
Not open for further replies.
Level 22
Joined
Mar 16, 2008
Messages
1,032
AI controlled heroes drop items from their inventory despite those items being set as un-droppable via trigger and Object Editor. The items are put into their inventory via Unit Properties window.

1641381286522.png


I tried various different trigger options, like make item of type and item in slot un-droppable. Nothing seems to work and they keep dropping the items from their inventory when they have an opportunity to pick up other items. Is this some new Reforged bug? I swear this was working as intended recently.

  • Item - Make (Item carried by Unit_Var in slot 1) Undroppable
  • Item - Make (Item carried by Unit_Var of type Black Knight's Enchanted Halberd) Undroppable
Is it possible to stop them from dropping these items?

Thank you for reading.
 
Ok I found a solution that I think is worth sharing and is actually missing from most articles about items.

Stats - Priority in Object Editor under Items changes the AI heroes item selection in a predictable way. Higher number = higher priority.

Edit: the below trigger doesn't seem to work either... :eek:

I changed the Stats - Priority of the item to be higher and the AI isn't dropping it anymore. Still needs more testing...

  • NPC Items
    • Events
      • Time - Elapsed game time is 16.00 seconds
    • Conditions
    • Actions
      • -------- Unit 1 --------
      • Item - Create Item at Point_Var
      • Item - Make (Last created item) Undroppable
      • Hero - Give (Last created item) to Unit_Var
 
Last edited:
If this is GUI AI script, then you need to manually find all calls to UnitDropItemPointLoc() and add extra condition:
JASS:
if BlzGetItemBooleanField(itm, ITEM_BF_CAN_BE_DROPPED) then
    call UnitDropItemPointLoc(...)
endif

I guess in GUI it would look like this:
  • Custom script: if BlzGetItemBooleanField(udg_tempItem, ITEM_BF_CAN_BE_DROPPED)
  • Unit - Order (...) to drop (...) at (...)
  • Custom script: endif
 
Status
Not open for further replies.
Back
Top