Check if Mob was Beastman on Death

Post Reply
Avatarati
Posts: 53
Joined: Mon Jun 30, 2014 2:51 pm

Check if Mob was Beastman on Death

Post by Avatarati » Thu Jun 02, 2016 12:10 pm

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

User avatar
whasf
Site Admin
Posts: 1312
Joined: Thu Jul 19, 2012 9:11 pm

Re: Check if Mob was Beastman on Death

Post by whasf » Thu Jun 02, 2016 6:50 pm

Where is "BEASTMEN" defined? If it isn't defined, then it's nil and your logic fails.
-- Whasf

User avatar
demolish
Developer
Posts: 262
Joined: Thu Jul 26, 2012 7:12 am

Re: Check if Mob was Beastman on Death

Post by demolish » Thu Jun 02, 2016 7:01 pm

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));
<Giblet[NewBrain]> kj with this first step would be fine on my shit
Click here for a guide on scripting missions.

Avatarati
Posts: 53
Joined: Mon Jun 30, 2014 2:51 pm

Re: Check if Mob was Beastman on Death

Post by Avatarati » Thu Jun 02, 2016 10:53 pm

Found I needed to use mob:getSystem() instead. Wanted the m_ecosystem (7 for beastmen).

Post Reply