Hello OTlanders, who knew how to turn a this script?
script looks like this:
and I wants to after writing "Brings" npc once stated that I have already done the task like this (unless of course I have already done the task):
Code of this script:
and:
and if you could add that in addition to experience npc give items and money
Thanks in advance!
script looks like this:
12:16 Naomi Smithson: Hello GOD Adi,welcome to my home! What brings you to me?
12:16 GOD Adi [200]: brings
12:16 Naomi Smithson: Ok, you can started your mission? Just say it.
12:16 GOD Adi [200]: mission
12:16 Naomi Smithson: Please bring me 50 blueberries, and tell me when you had them.
12:16 GOD Adi [200]: blueberries
12:16 Naomi Smithson: You already did it for me. I dont need more berries at the moment
and I wants to after writing "Brings" npc once stated that I have already done the task like this (unless of course I have already done the task):
12:16 Naomi Smithson: Hello GOD Adi,welcome to my home! What brings you to me?
12:16 GOD Adi [200]: brings
12:16 Naomi Smithson: You already did it for me. I dont need more berries at the moment
Code of this script:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() 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
if(msgcontains(msg, 'bring')) then
selfSay('Ok, you can started your {mission}? Just say it.', cid)
end
---------------------------------------------------------
if(msgcontains(msg, 'mission')) then
selfSay('Please bring me 50 {blueberries}, and tell me when you had them.', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'blueberries') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,100) > 0) then
selfSay('You already did it for me. I dont need more berries at the moment', cid)
else
if(doPlayerRemoveItem(cid, 2677, 50) == TRUE) then
setPlayerStorageValue(cid,100,1)
doPlayerAddExperience(cid,150)
doCreatureSay(cid, "You have earned +150 experience, right now.", TALKTYPE_ORANGE_1, cid)
selfSay('A very nice thank you! You are new here and I have liked you very much rigt now!', cid)
else
selfSay('You must have more items', cid)
end
end
return true
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
and:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Naomi Smithson" script="data/npc/scripts/mission.lua" walkinterval="2000" floorchange="0" access="5" level="1" maglevel="1">
<health now="100" max="100"/>
<look type="136" head="59" body="76" legs="0" feet="38" addons="0"/>
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|,welcome to my home! What {brings} you to me?"/>
</parameters>
</npc>
and if you could add that in addition to experience npc give items and money
Thanks in advance!