Page 1 of 1

Check if Mob was Beastman on Death

Posted: Thu Jun 02, 2016 12:10 pm
by Avatarati
I want to have certain items drop from beastmen only in various regions. But first, I need to differentiate between beastman and non-beastman. How would I do this through mobs.lua?

Since mob is passed into the onMobDeathEx function, I thought I'd use this as a test at the end of the mobs.lua file. No matter the type of mob, it always reverts to else (not beastman). Is 'BEASTMEN' an invalid argument for isMobType()? Oddly when I change it to 'BEASTMAN' the client crashes, indicating to me that 'BEASTMEN' is a valid input.

Code: Select all

if (mob:isMobType(BEASTMEN) == true) then
    player:PrintToPlayer("Beastman!", 0xD)
else
    player:PrintToPlayer("Not beastman", 0xD)
end

Re: Check if Mob was Beastman on Death

Posted: Thu Jun 02, 2016 6:50 pm
by whasf
Where is "BEASTMEN" defined? If it isn't defined, then it's nil and your logic fails.

Re: Check if Mob was Beastman on Death

Posted: Thu Jun 02, 2016 7:01 pm
by demolish
Avatarati wrote:I want to have certain items drop from beastmen only in various regions. But first, I need to differentiate between beastman and non-beastman. How would I do this through mobs.lua?

Since mob is passed into the onMobDeathEx function, I thought I'd use this as a test at the end of the mobs.lua file. No matter the type of mob, it always reverts to else (not beastman). Is 'BEASTMEN' an invalid argument for isMobType()? Oddly when I change it to 'BEASTMAN' the client crashes, indicating to me that 'BEASTMEN' is a valid input.

Code: Select all

if (mob:isMobType(BEASTMEN) == true) then
    player:PrintToPlayer("Beastman!", 0xD)
else
    player:PrintToPlayer("Not beastman", 0xD)
end
player:PrintToPlayer(string.format("Beastman! %u, 0xD));

Re: Check if Mob was Beastman on Death

Posted: Thu Jun 02, 2016 10:53 pm
by Avatarati
Found I needed to use mob:getSystem() instead. Wanted the m_ecosystem (7 for beastmen).