Page 1 of 1
mobs lua onMobInitialize functions not working
Posted: Sat Jul 13, 2013 5:43 am
by vergotear
I tried to script a few NM pops that weren't scripted.
Some of them are just copy paste from other mobs / npc lua files with just the mobid changed.
trade, spawning and starting enmity from qmx.lua works. OnEngage or Onfight functions like popping pets work, hiding pop spot after mob dead too.
But noticed that stuff in onMobInitialize didn't work, like
Code: Select all
-----------------------------------
-- onMobInitialize Action
-----------------------------------
function onMobInitialize( mob )
-- Add regen and gain effects..
mob:addStatusEffect( EFFECT_REGEN, 50, 3, 0 );
mob:addStatusEffect( EFFECT_REGAIN, 7, 3, 0 );
end
Then I went and fought NMs like Nidhogg with those kind of passive buffs and yes it didn't regen or tp regain, and it seems to be the case with all mob luas.
Currently using a build of rev 3707 on local test server. Using Visual Studio 2010 express to compile.
Edit: even with a clean download from SVN, build and sql tables, mobs aren't receiving the effects in onMobInitialize.
Re: mobs lua onMobInitialize functions not working
Posted: Sat Jul 13, 2013 12:35 pm
by lautan
I made some changes recently and status effects should not be added on mob initialize. You could add them on mob spawn but native status effects shouldn't be added in lua. These have to be added in the mob_pool_mods table. I have moved some of them myself but haven't moved them all.
Edit: I should clarify status effects are removed before a mob spawns. This is to prevent duplicate status effects from leaking in. Adding status effects in onMobSpawn will work fine.
Re: mobs lua onMobInitialize functions not working
Posted: Sat Jul 13, 2013 2:06 pm
by vergotear
Ok thanks for the clarification.
But looking at the mobs lua, there's quite a number of mobs that will need fixing or adding to the mob_pool_mods.
And now looking at the mob_pool_mods. The ModId which numbers or file should i use for reference, the same ones for items?
Re: mobs lua onMobInitialize functions not working
Posted: Sat Jul 13, 2013 3:42 pm
by kjLotus
lautan wrote:I made some changes recently and status effects should not be added on mob initialize. You could add them on mob spawn but native status effects shouldn't be added in lua. These have to be added in the mob_pool_mods table. I have moved some of them myself but haven't moved them all.
Edit: I should clarify status effects are removed before a mob spawns. This is to prevent duplicate status effects from leaking in. Adding status effects in onMobSpawn will work fine.
still want oninitialize to work, there are other things that can be useful for that
Re: mobs lua onMobInitialize functions not working
Posted: Mon Jul 15, 2013 1:03 pm
by atom0s
Spawning mobs should just call both onMobInitialize then onMobSpawn to rectify the issue. As it stands now onMobInitialize only happens once when zones are loaded, defeating the current purpose of the function. Most HNMs are currently using onMobInitialize to set Regen/Regain/etc. buffs and stuff that wont be reapplied on respawns.
Re: mobs lua onMobInitialize functions not working
Posted: Mon Jul 15, 2013 1:29 pm
by kjLotus
atom0s wrote:Spawning mobs should just call both onMobInitialize then onMobSpawn to rectify the issue. As it stands now onMobInitialize only happens once when zones are loaded, defeating the current purpose of the function.
that's exactly what initialize is for - applying things that should only be applied once, such as setting up links or setting up monster vars
Re: mobs lua onMobInitialize functions not working
Posted: Tue Jul 16, 2013 9:24 am
by atom0s
Sounds more like things don't save after the first death though.
Re: mobs lua onMobInitialize functions not working
Posted: Tue Jul 16, 2013 9:42 am
by kjLotus
atom0s wrote:Sounds more like things don't save after the first death though.
everything is saved unless it's a status effect or explicitly removed in the death script. in the case of the OP, i think someone just broke onMobInitialize or something