• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 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!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

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

Status
Not open for further replies.
Level 17
Joined
Mar 16, 2008
Messages
635
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 17
Joined
Mar 16, 2008
Messages
635
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