ruth
Veteran OT User
- Joined
- Aug 3, 2009
- Messages
- 670
- Solutions
- 2
- Reaction score
- 380
This script works 70% fine. That is, the when i say hi or random keyword he summon monsters but, he says random code like that 24573457. He should say "Arrrrgh! A dirty paleskin! To me my children! Kill them my guards!".
Console error:
Script:
Console error:
Code:
Lua Script Error: [Npc interface]
data/npc/scripts/orcking.lua:onCreatureSay
data/npc/scripts/orcking.lua:34: attempt to call method 'isFocused' (a nil value
)
stack traceback:
data/npc/scripts/orcking.lua:34: in function 'callback'
data/npc/scripts/lib/npcsystem/npchandler.lua:299: in function 'onCreatu
reSay'
data/npc/scripts/orcking.lua:15: in function <data/npc/scripts/orcking.l
ua:13>
Script:
Code:
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)
if(getPlayerStorageValue(cid, 40000) == 1) then
npcHandler:onCreatureSay(cid, type, msg)
else
selfSay('Arrrrgh! A dirty paleskin! To me my children! Kill them my guards!', cid)
doSummonCreature("Orc Warlord", {x = 32980, y = 31732, z = 9})
doSummonCreature("Orc Warlord", {x = 32983, y = 31732, z = 9})
doSummonCreature("Orc Leader", {x = 32983, y = 31730, z = 9})
doSummonCreature("Orc Leader", {x = 32985, y = 31730, z = 9})
doSummonCreature("Orc Leader", {x = 32980, y = 31730, z = 9})
doSummonCreature("Slime", {x = 32982, y = 31729, z = 9})
doSummonCreature("Slime", {x = 32985, y = 31729, z = 9})
doSummonCreature("Slime", {x = 32983, y = 31731, z = 9})
setPlayerStorageValue(cid, 40000, 1)
end
end
function onThink()
npcHandler:onThink()
end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
-- more your code here (:
return true
end
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I am Charkahn the Slayer! The immortal father of the orcs and master of this hive.'})
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I am Charkahn the Slayer! The immortal father of the orcs and master of this hive.'})
keywordHandler:addKeyword({'minion'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'The orcish horde of this hive is under my control. I sense their emotions and their needs and provide them with the leadership they need to focus their hate and rage.'})
keywordHandler:addKeyword({'equipment'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'First you should buy a machete. You will need it in the swamps. And better dont explore without a shovel and a rope.'})
keywordHandler:addKeyword({'hate'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Hate and rage are the true blessings of Blog, since they are powerful weapons. They give the hive strength. I provide them with direction and focus.'})
keywordHandler:addKeyword({'slime'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Pah! Dont mock me, mortal! This shape is a curse which the evil djinn bestowed upon me.'})
keywordHandler:addKeyword({'djinn'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I will not share anything more about that topic with you paleskins.'})
keywordHandler:addKeyword({'lamp'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'For Eons he was trapped in an enchanted lamp by some ancient race. Now he is free to roam the world again. Although he cheated me I appreciate what he and his brethren will do to this world, now it is the time of the Djinn again!'})
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())