• 🏆 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 get AI Hero Units to Not Drop Items???

Status
Not open for further replies.
Level 18
Joined
Mar 16, 2008
Messages
721
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.
 
Level 18
Joined
Mar 16, 2008
Messages
721
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:
Level 10
Joined
Dec 11, 2009
Messages
234
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.
Top