Using entity_death event to prevent mobs dropping items on death does not work in all cases
LadyCailinBot opened this issue ยท 4 comments
CMDHELPER-2678 - Reported by dddeeefff
Repost of issue that seemed to get lost with redmine:
I recently designed a script that would spawn mobs for a player to fight. One of the things I deiced to do was equip mobs with armour using set_mob_equipment. So far, I've managed to pick up some drops from these mobs.
I think the mechanism that is causing this is vanilla's rare equipment drops. To support this, all I can really say is that the items come out well worn and my instinct suggests it's occurring with the same probability that vanilla minecraft drops items on equipped mobs
The script itself which spawns mobs is quite complex, with a lot random generation of mobs - for example, a mob has a certain chance to get each piece of armour, and each piece of armour has a probability of being leather, iron or gold. I am unable to say at the moment whether it is possible that the drops have come from mobs that don't have any armour equipped.
Here is a copy of the event I've been using with added annotations:
bind(entity_death, null, null, @event,
# Check whether the death was inside a mobarena region (mob arena regions begin with "mobarena'". I use "'" as a separator in region names for CH scripts)
assign(@regions, sk_regions_at(@event['location']))
foreach(@regions, @region,
if(equals(@region[0..8], 'mobarena\''),
# remove drops and XP:
modify_event('drops', array())
modify_event('xp', 0)
assign(@region, @region[9..])
# Include a script for the specific region which will give mob deaths specific rules (This is not in use atm)
try(include('specialrules/' . @region))
)
)
)
This bug has been around a long while and it's getting in the way of me making a mob arena.
Comment by dddeeefff
This may have been fixed but I'm too busy with a server move to test it out. As soon as I'm not busy so much (a few weeks) I'll get to testing it
Comment by jb_aero
if set_equipment_droprates doesn't work, try cancelling item_spawn
Comment by dddeeefff
This issue no longer affects me because I can stop mobs from picking up players' items when they are spawned in certain WG regions, conveniently meeting my use case.
I guess this issue can be closed if a note is added to the docs that set_equipment_droprates()-type drops are not affected by the @event's drops array key.
There is a use case outside what I need, and that's detecting which items were given to a mob by a player. There appears to be no event that meets this need, but I think that is outside the scope of this bug report