[General] Detecting which creeps drop items

Status
Not open for further replies.
Level 18
Joined
Jun 15, 2012
Messages
498
Hello;
I'd want the pre-placed creeps that drop items to have some sort of visual clue (either special effects attached to them or an image at their location), but I don't know how to detect them.
Wonder if it' also possible to detect their loot table, type/level at least.
Is there a way to single them out/place them in ugs?
Can it be done in gui custom scripts or does it require jass/lua?
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
For detecting whether or not the creeps drop items you could change their ownership to an unused player.

For example, make all of the creeps that drop items be owned by Neutral Extra.

Then create a trigger that runs during Map Initialization which Picks every Neutral Extra unit in the game.
From there you can create your effect/image on the (Picked unit). Then change the (Picked units)'s ownership back to Neutral Hostile.

And like Pyro said, detecting the loot table is most likely not possible. Their unit-type/unit-level is possible though.
 
Last edited:
when you map is in Lua mode the special effect can be done that way: You hook function
CreateAllUnits, while CreateAllUnits runs you hook TriggerRegisterUnitEvent.

Inside TriggerRegisterUnitEvent check for EVENT_UNIT_DEATH and give the unit the wanted special effect, also could add a new action to the death trigger to make it destroy the effect. After CreateAllUnits is done you remove the TriggerRegisterUnitEvent hook again.
 
Level 18
Joined
Jun 15, 2012
Messages
498
For detecting whether or not the creeps drop items you could change their ownership to an unused player.

For example, make all of the creeps that drop items be owned by Neutral Extra.

Then create a trigger that runs during Map Initialization which Picks every Neutral Extra unit in the game.
From there you can create your effect/image on the (Picked unit). Then change the (Picked units)'s ownership back to Neutral Hostile.

And like Pyro said, detecting the loot table is most likely not possible. Their unit-type/unit-level is possible though.
ye for manually setting it I had my solutions, though this might be more convenient ty.
I do not believe there is any way to learn a unit’s drop table. You would probably have to build this database yourself or use ItemPools to make your own drop tables that you can control and query.
I see, I though it was maybe possible to get the table through the war3map.j
when you map is in Lua mode the special effect can be done that way: You hook function
CreateAllUnits, while CreateAllUnits runs you hook TriggerRegisterUnitEvent.

Inside TriggerRegisterUnitEvent check for EVENT_UNIT_DEATH and give the unit the wanted special effect, also could add a new action to the death trigger to make it destroy the effect. After CreateAllUnits is done you remove the TriggerRegisterUnitEvent hook again.
does this hook to the war3map.lua thing?
 
does this hook to the war3map.lua thing?
It means you overwrite the function with a custom function in your map script (can be done in Trigger Editor). That is done by giving it the same Name. When the game would normally call CreateAllUnits your overwrite runs, which gives you the perfect time to now catch the units for which death events are created (that trigger using the Events will drop the items). Your custom functions would need to run the overwritten to maintain the default behaviour.
Or use that resource from Bribe, I think it was built for this hooking: [Lua] - Hook v5.0.1

Works only in Lua mode.
 
Status
Not open for further replies.
Top