Page 1 of 1
Detecting if a mob is spawned
Posted: Wed Jan 30, 2013 10:10 am
by Joe
Is there any way to detect whether a particular mob has been spawned? I've been trying to figure it out and am currently stumped... I would greatly appreciate any info to get me pointed in the right direction. Thanks.
Re: Detecting if a mob is spawned
Posted: Wed Jan 30, 2013 4:01 pm
by Joe
I'm no longer stuck on this as I figured out a way around my problem from earlier, but if anyone knows if detecting whether certain mobs are spawned via a Lua script is possible I'd still like to know how...
Thanks.
Re: Detecting if a mob is spawned
Posted: Wed Jan 30, 2013 4:49 pm
by kjLotus
all the commands that can be done to a baseentity (mobs included) are in lua_baseentity.h. if there isn't one, you'd have to make your own binding for it (which isn't really too hard: copy and paste something else related to mobs, add a line in .h and the lunar declares at the bottom of the .cpp, and then find a way to find if it's dead or not in the core. likely something to do with their current ACTION or animation)
sorry i don't have anything better to offer, i don't really deal much in the way of mobs in the scripts
Re: Detecting if a mob is spawned
Posted: Wed Jan 30, 2013 7:49 pm
by PrBlahBlahtson
GetMobAction(########) might work for you.
See the qm1 in Dragon's Aery for ways this can be used. If you need to check what's returned from a mob, I usually just modify Cure or something to print(GetMobAction(#)) and check my server log. There's names for the different states somewhere in the core. I believe they all start with ACTION_
Re: Detecting if a mob is spawned
Posted: Wed Jan 30, 2013 8:31 pm
by kjLotus
PrBlahBlahtson wrote: There's names for the different states somewhere in the core. I believe they all start with ACTION_
correct
ai_general.h line 37
Re: Detecting if a mob is spawned
Posted: Wed Jan 30, 2013 9:57 pm
by Joe
I really appreciate the responses, my earlier 'fix' didn't end up working out and I was back to detecting if the mobs had been spawned. Was planning on adding a new binding but noticed the other posts concerning GetMobAction... GetMobAction( mobid) == ACTION_NONE worked perfectly! Thanks!