Good morning,
I've tried writing a code, however could not make it work. My codding skills are below basic.
I need a script that makes the player say a specific sentence once the monster health hit a certain percentage.
For example, if a Juggernaut hits the 30% HP mark, the player will use a certain spell.
I wrote this code:
cycleEvent(function ()
if g_game.isOnline()
then local p = g_game.getMonsterInfo('MONSTER NAME')
if p:getHealth()/p:getMaxHealth() > 0.3 then
then g_game.talk('SENTENCE')
end end end end end, 500)
However, it's not working. I'm getting this message at the terminal:
ERROR: lua function callback failed: LUA ERROR:
[string "cycleEvent(function () if g_game.isOnline()..."]:1: attempt to call field 'getMonsterInfo' (a nil value)
stack traceback:
[C]: in function 'getMonsterInfo'
[string "cycleEvent(function () if g_game.isOnline()..."]:1: in function <[string "cycleEvent(function () if g_game.isOnline()..."]:1>
Thank you all in advance.
I've tried writing a code, however could not make it work. My codding skills are below basic.
I need a script that makes the player say a specific sentence once the monster health hit a certain percentage.
For example, if a Juggernaut hits the 30% HP mark, the player will use a certain spell.
I wrote this code:
cycleEvent(function ()
if g_game.isOnline()
then local p = g_game.getMonsterInfo('MONSTER NAME')
if p:getHealth()/p:getMaxHealth() > 0.3 then
then g_game.talk('SENTENCE')
end end end end end, 500)
However, it's not working. I'm getting this message at the terminal:
ERROR: lua function callback failed: LUA ERROR:
[string "cycleEvent(function () if g_game.isOnline()..."]:1: attempt to call field 'getMonsterInfo' (a nil value)
stack traceback:
[C]: in function 'getMonsterInfo'
[string "cycleEvent(function () if g_game.isOnline()..."]:1: in function <[string "cycleEvent(function () if g_game.isOnline()..."]:1>
Thank you all in advance.