Okay, I've found a way how to make a mob do something on a certain % with LUA.
Many people said that we need C++ for that, but that FALSE!
Here's the script!
This will make a mob speak at 75%.
You have to change the red words in it.
Looks a bit difficult? Let me help.Code:buffer = 0 function testmob_phase(unit) local percento = unit:GetHealthPct() if buffer == 0 then if (percento <= 75) then buffer = 1 unit:SendChatMessage(12, 0, "Speak something") --You can insert random other commands here, such as Castspell and etc, what you want your mob to do. end end end function testmob_entercombat(unit) buffer = 0 unit:RegisterEvent("testmob_phase",3000, 0) end function testmob_LeaveCombat(unit) buffer = 0 end RegisterUnitEvent(12345, 1, "testmob_entercombat") RegisterUnitEvent(12345, 2, "testmob_leavecombat")
testmob = the name of the function, name it whatever you want, but name it on every place.
75 = the precent of when the mob should do the action.
Speak something = The text you want the mob to say.
3000 = Important! This is the delay of checking if his hp is below the current precent or not. Don't change it, I will explain this further.
=====FAQ=====
Q: Please tell me how is this working!
A: This checks the mob's hp's precent within a delay, which is now for 3000 example
Q: Why can't we use AI_Tick?
A: I couldn't get that work, besides this would not lag the server that much since it's not trying to check it continously.
Q: What does "buffer" mean?
A: The function is being checked every 3000 (=3 sec), and let's say you're doing the boss, it gets below the HP and it would trigger the function always, meaning it would continously do the function (Speak for example).
"buffer" variable makes that it will trigger only one time, and resetting it if the mob gets out of combat/gets in combat.
I know this full thing is a bit hard-to-understand, so if you have any problem, post it in this section, I will help.
You can change the 3000 to something lower, like 1000 (so the delay would be 1sec) if you're killing a low hp mob or whatsoever, it's up to you