highclick
New Member
- Joined
- Mar 21, 2011
- Messages
- 80
- Reaction score
- 4
Hi guys, I'll try too describe as good as possible.
I have an XML NPC:
And then i have a .lua script:
Okay so, when you've finished her quest and type "hi" then "help" you get the response "Thanks again for the feathers"
I want you too get the "thanks again for the feathers response as soon as you say "hi". You shouldn't have too say "hi" and then "help" too get that response. And also if you haven't done the quest, the NPC should directly ask you for help..
Basicly I'm asking for the NPC too greet you depending on your storagevalue.
Thanks alot.
I have an XML NPC:
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Theresa The Druid" script="TheresaQuest.lua" walkinterval="0" floorchange="0">
<health now="100" max="100"/>
<look type="158" head="119" body="39" legs="114" feet="119" addons="0"/>
<parameters>
<parameter key="message_greet" value="Silence! You are disturbing the ritual. Either {help} me or be gone!"/>
</parameters>
</npc>
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) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
local storage = 5000
function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, "help") then
if getPlayerStorageValue(cid, storage) == -1 then
selfSay("I need some chicken feathers too complete the ritual.Will you get some for me!?", cid)
talkState[talkUser] = 1
elseif getPlayerStorageValue(cid, storage) == 1 then
selfSay("Did you get me the feathers?", cid)
talkState[talkUser] = 1
else
selfSay("Thanks again for the feathers.", cid)
end
elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
if getPlayerStorageValue(cid, storage) == -1 then
selfSay("You can find some chicken south of temple", cid)
setPlayerStorageValue(cid, storage, 1)
else
if doPlayerRemoveItem(cid, 5890, 5) then
selfSay("These will do just fine!", cid)
doPlayerAddItem(cid, 2148, 99)
doPlayerAddExp(cid, 5000)
setPlayerStorageValue(cid, storage, 2)
else
selfSay("Where are my feathers!?", cid)
end
end
talkState[talkUser] = 0
elseif msgcontains(msg, "no") and talkState[talkUser] == 1 then
selfSay("Ok then.", cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Okay so, when you've finished her quest and type "hi" then "help" you get the response "Thanks again for the feathers"
I want you too get the "thanks again for the feathers response as soon as you say "hi". You shouldn't have too say "hi" and then "help" too get that response. And also if you haven't done the quest, the NPC should directly ask you for help..
Basicly I'm asking for the NPC too greet you depending on your storagevalue.
Thanks alot.
Last edited: