Zorenia
Hoster of Zorenia
Hello people..
The NPC system I'm using (NEW TFS 8.62 client) got default greetings..
If I say hi it says: 22:52 Xaviron: Welcome, Zorenia! I have been expecting you.
but it stays in the Default channel.. and I want to change a couple of things:
*When I say "hi" the npc must answer back into the 'NPCs' channel, because I can't use blue words when the npc speak in default channel, and the script is for a Mission NPC and people don't know what they have to say to continue the conversational when I don't use blue words.
*I want to change the replay.. now the npc got a default replay.. "I've been expecting you.."
Also do anybody knows, how the npc can write a story.. when players enter the server the npc will tell a story about the server. what's the best way to do this?? I need the code
like: (if(msgcontains(msg, 'hiho')) then
selfSay('Please bring me 20 "ham"', cid) <-- but that isn't the best option I guess?
Xaviron XML
Xaviron script:
I'll hope anyone can help me soon as possible!
Thanks. yours,
Zorenia.
The NPC system I'm using (NEW TFS 8.62 client) got default greetings..
If I say hi it says: 22:52 Xaviron: Welcome, Zorenia! I have been expecting you.
but it stays in the Default channel.. and I want to change a couple of things:
*When I say "hi" the npc must answer back into the 'NPCs' channel, because I can't use blue words when the npc speak in default channel, and the script is for a Mission NPC and people don't know what they have to say to continue the conversational when I don't use blue words.
*I want to change the replay.. now the npc got a default replay.. "I've been expecting you.."
Also do anybody knows, how the npc can write a story.. when players enter the server the npc will tell a story about the server. what's the best way to do this?? I need the code
like: (if(msgcontains(msg, 'hiho')) then
selfSay('Please bring me 20 "ham"', cid) <-- but that isn't the best option I guess?
Xaviron XML
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Xaviron" script="data/npc/scripts/missions/beggar.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="153" head="57" body="20" legs="114" feet="116" addons="3"/>
</npc>
Xaviron 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) npcHandler:onCreatureSay(cid, type, msg) 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
if(msgcontains(msg, 'quest')) then
selfSay('Ok, you can started {first mission}?', cid)
end
---------------------------------------------------------
if(msgcontains(msg, 'hiho')) then
selfSay('Please bring me 20 "ham"', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'ham') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,102) > 0) then
selfSay('You finished this mission.', cid)
else
if(doPlayerRemoveItem(cid, 2671, 20) == TRUE) then
setPlayerStorageValue(cid,102,1)
doPlayerAddExperience(cid,1000)
selfSay('Thank you! You finished all missions. (you received 1000 points of experience)', cid)
else
selfSay('You must have more items', cid)
end
end
return true
end
---------------------------------------------------------
if(msgcontains(msg, 'first mission')) then
selfSay('Please bring me 10 "meat"', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'meat') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,100) > 0) then
selfSay('You finished this mission.', cid)
else
if(doPlayerRemoveItem(cid, 2666, 10) == TRUE) then
setPlayerStorageValue(cid,100,1)
doPlayerAddExperience(cid,1000)
selfSay('Thank you! You can started "second mission".. (you received 1000 points of experience)', cid)
else
selfSay('You must have more items', cid)
end
end
return true
end
---------------------------------------------------------
if(msgcontains(msg, 'second mission')) then
selfSay('Please bring me 10 "ham"', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'ham') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,101) > 0) then
selfSay('You finished this mission.', cid)
else
if(doPlayerRemoveItem(cid, 2671, 10) == TRUE) then
setPlayerStorageValue(cid,101,1)
doPlayerAddExperience(cid,1000)
selfSay('Thank you! You can started "third mission".. (you received 1000 points of experience)', cid)
else
selfSay('You must have more items', cid)
end
end
return true
end
---------------------------------------------------------
if(msgcontains(msg, 'third mission')) then
selfSay('Please bring me 20 "ham"', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'ham') and talkState[talkUser] == 1) then
if (getPlayerStorageValue(cid,102) > 0) then
selfSay('You finished this mission.', cid)
else
if(doPlayerRemoveItem(cid, 2671, 20) == TRUE) then
setPlayerStorageValue(cid,102,1)
doPlayerAddExperience(cid,1000)
selfSay('Thank you! You finished all missions. (you received 1000 points of experience)', 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())
I'll hope anyone can help me soon as possible!
Thanks. yours,
Zorenia.
Last edited: