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

Loot Table

Status
Not open for further replies.
Level 16
Joined
Mar 26, 2004
Messages
569
Is there possible to make a loot table using triggers?

Example:
If a unit owned by a certain player (player 12 (brown)) dies, i want an item based on the dying unit's level to be created at the dying unit's position. It should also have a random integer so that items are randomly selected.

Like:
Item - Create random item from LootTable[Level 1]
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
itempool variable type.

This example uses vJass to declare the global (The "Variable Editor" does not support itempools)

JASS:
globals
    itempool table1 = CreateItemPool()
endglobals

//to drop an item from the table
call PlaceRandomItem(table1,someX,someY)

//to add a new item to the table
call ItemPoolAddItemType(table1,<item id>,<weight - chance to drop relative to other chances>)

//to remove an item
call ItemPoolRemoveItemType(table1,<item id>)

//to destroy the pool
call DestroyItemPool(table1)

There are also UnitPools which are exactly the same but for units instead of items (basically replace the item ids with unit ids, and replace Item with Unit in all the names)
 
Status
Not open for further replies.
Top