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

[General] Automatically add droppable items to a unit

Status
Not open for further replies.
Level 9
Joined
Aug 18, 2015
Messages
198
Hey guys!

I'm working on a little project now where one of the main protagonists (a neutral enemy boss unit) actually revives itself at midnight if killed. Like, he revives *every* midnight if he dies. I was able to make it up to that part without a problem.

The thing is, I'd like him to keep looting his items everytime our heroes defeat him (a few custom items from a selection I made, the same as in his first 'life'). I thought I could simply add the item dropping list to his revived self but I can't figure out how. Can anyone tell me how to proceed? Thanks a lot for any piece of advice or clue! :)
 

Attachments

  • Anador.PNG
    Anador.PNG
    1.4 MB · Views: 94
The Item Table is basically converted into JASS code when you save your map. Unfortunately, the trigger responsible for dropping an item when a unit/destructible dies is then destroyed upon being executed, which means Blizzard didn't take heroes into account.

You'd be better off making your own trigger for that specific hero.

EDIT: Here's an example.
I used the very same logic Blizzard had used in order to add a new item type to form a list.

upload_2018-12-25_17-28-5.png

  • Item Table Archmage
    • Events
      • Unit - Archmage 0000 <gen> Dies
    • Conditions
    • Actions
      • -------- Reset list --------
      • Custom script: call RandomDistReset()
      • -------- Add a new item type to the list, and you'll also need to specify a "chance amount". --------
      • Set ItemType = Claws of Attack +15
      • Custom script: call RandomDistAddItem(udg_ItemType, 33)
      • -------- Add --------
      • Set ItemType = Crown of Kings +5
      • Custom script: call RandomDistAddItem(udg_ItemType, 33)
      • -------- Add --------
      • Set ItemType = Mask of Death
      • Custom script: call RandomDistAddItem(udg_ItemType, 33)
      • -------- Randomly gets a random item in the list mentioned above, and then create such item at dying unit's position --------
      • Set point = (Position of (Triggering unit))
      • Custom script: set udg_ItemType = RandomDistChoose()
      • Item - Create ItemType at point
      • Custom script: call RemoveLocation(udg_point)
Those custom script functions exist by default, and they are used for the same purpose.

Also, if your map makes use of the Market building, then replace
  • Set point = (Position of (Triggering unit))
  • Custom script: set udg_ItemType = RandomDistChoose()
  • Item - Create ItemType at point
  • Custom script: call RemoveLocation(udg_point)
with
  • Custom script: call UnitDropItem(GetTriggerUnit(), RandomDistChoose())
 

Attachments

Last edited:
Status
Not open for further replies.
Back
Top