esta dando o seguinte erro
[09/04/2018 09:04:58] [Error - CreatureScript Interface]
[09/04/2018 09:04:58] data/creaturescripts/scripts/player/statsChange.lua:onStatsChange
[09/04/2018 09:04:59] Description:
[09/04/2018 09:04:59] data/creaturescripts/scripts/player/statsChange.lua:112: attempt to index a number value
[09/04/2018 09:04:59] stack traceback:
[09/04/2018 09:04:59] data/creaturescripts/scripts/player/statsChange.lua:112: in function <data/creaturescripts/scripts/player/statsChange.lua:6>
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Rulfs" script="Rulfs.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="594" head="17" body="54" legs="114" feet="0" addons="2"/>
</npc>
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function onPlayerEndTrade(cid) npcHandler:onPlayerEndTrade(cid) end
function onPlayerCloseChannel(cid) npcHandler:onPlayerCloseChannel(cid) end
local nome = "Rulfs" -- nome do monstro que vai parecer
local function greetCallback(cid)
local msg = 'Olá '.. getCreatureName(cid) ..", vem me desafiar a um duelo?"
npcHandler:say(msg,cid)
npcHandler:addFocus(cid)
return false
end
function creatureSayCallback(cid, type, msg)
if string.lower(msg) == 'bye' or string.lower(msg) == 'xau' then
npcHandler:resetNpc(cid)
return false
end
if(not npcHandler:isFocused(cid)) then
return false
end
if (msgcontains(msg, 'sim') or msgcontains(msg, 'yes')) then
local pos = getCreaturePosition(getNpcId())
selfSay('Então venha.',cid)
doCreatureSay(getNpcId(), "MuHuashAUhashSHUuSA", TALKTYPE_MONSTER_YELL)
npcHandler:resetNpc(cid)
doRemoveCreature(getNpcId())
doCreateMonster(nome, pos)
end
if (msgcontains(msg, 'nao') or msgcontains(msg, 'no') or msgcontains(msg, 'não')) then
selfSay('Então tchau.', cid)
npcHandler:resetNpc(cid)
return false
end
return true
end
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Rulfs" nameDescription="a rulfs" race="blood" experience="900" speed="220" manacost="0">
<health now="1000" max="1000"/>
<look type="569" head="17" body="54" legs="114" feet="0" addons="2" corpse="6080"/>
<targetchange interval="5000" chance="8"/>
<strategy attack="100" defense="0"/>
<flags>
<flag summonable="0"/>
<flag attackable="1"/>
<flag hostile="1"/>
<flag illusionable="0"/>
<flag convinceable="0"/>
<flag pushable="0"/>
<flag canpushitems="1"/>
<flag canpushcreatures="1"/>
<flag targetdistance="1"/>
<flag staticattack="90"/>
<flag runonhealth="500"/>
</flags>
<attacks>
<attack name="melee" interval="2000" skill="30" attack="50" poison="150"/>
<attack name="speed" interval="1000" chance="10" range="7" speedchange="-600" duration="20000">
<attribute key="areaEffect" value="redshimmer"/>
</attack>
<attack name="lifedrain" interval="1000" chance="40" radius="4" target="0" min="-120" max="-250">
<attribute key="areaEffect" value="rednote"/>
</attack>
</attacks>
<defenses armor="15" defense="20">
<defense name="healing" interval="1000" chance="25" min="113" max="187">
<attribute key="areaEffect" value="blueshimmer"/>
</defense>
</defenses>
<elements>
<element firePercent="100"/>
<element deathPercent="100"/>
<element earthPercent="100"/>
<element holyPercent="-20"/>
</elements>
<immunities>
<immunity lifedrain="1"/>
<immunity paralyze="1"/>
<immunity invisible="1"/>
</immunities>
<voices interval="5000" chance="10">
<voice sentence="HAHAHAHAHA"/>
</voices>
<loot>
<item id="2148" countmax="60" chance="11250"/><!-- gold coin -->
<item id="2148" countmax="40" chance="11250"/><!-- gold coin -->
<item id="2144" chance="2000"/><!-- black pearl -->
<item id="2656" chance="650"/><!-- blue robe -->
<item id="2047" chance="70000"/><!-- candle stick -->
<item id="2237" chance="19000"/><!-- dirty cape -->
<item id="2177" chance="50"/><!-- life crystal -->
<item id="2071" chance="1333"/><!-- lyre -->
<item id="2560" chance="7250"/><!-- mirror -->
<item id="2411" chance="1600"/><!-- poison dagger -->
<item id="2655" chance="800"/><!-- red robe -->
<item id="2214" chance="860"/><!-- ring of healing -->
<item id="2170" chance="8300"/><!-- silver amulet -->
<item id="2134" chance="1750"/><!-- silver brooch -->
<item id="2657" chance="60000"/><!-- simple dress -->
<item id="2197" chance="1100"/><!-- stone skin amulet -->
<item id="7589" chance="650"/><!-- strong mana potion -->
<item id="2175" chance="900"/><!-- spellbook -->
<item id="2143" chance="410"/><!-- white pearl -->
<item id="7884" chance="240"/><!-- terra mantle -->
<item id="2121" chance="410"/><!-- wedding ring -->
<item id="2124" chance="100"/><!-- crystal ring -->
</loot>
</monster>