hello
i have a npc Sebastian and all npcs on my ots talks on NPCs Channel but this npc talk on default. How i can change this ?
There is a script
i have a npc Sebastian and all npcs on my ots talks on NPCs Channel but this npc talk on default. How i can change this ?
There is a script
Code:
local focus = 0
local talk_start = 0
local nargor = {x=31987, y=32882, z=6, price = 60}
local libertybay = {x=32285, y=32892, z=6, price = 60}
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Hmm...')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function sail(cid, destination)
if doPlayerRemoveMoney(cid, destination.price) == TRUE then
doTeleportThing(cid, destination)
focus = 0
talk_start = 0
else
selfSay(getCreatureName(cid).. '... You don\'t have enough money.')
end
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Hello, Sir '.. getCreatureName(cid))
focus = cid
talk_start = os.clock()
talk_state = 0
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay(getCreatureName(cid) ..', please wait for your turn.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'liberty bay') then
selfSay('Do you want to sail to Liberty Bay for 60 gold coins?')
talk_state = 1
elseif msgcontains(msg, 'nargor') and getPlayerStorageValue(cid, 527983) == 7 then
selfSay('Do you want to sail to Nargor for 60 gold coins?')
talk_state = 2
elseif msgcontains(msg, 'yes') then
if talk_state == 1 then
sail(cid, libertybay)
elseif talk_state == 2 then
if getPlayerStorageValue(cid, 527983) == 7 then sail(cid, nargor) end
end
elseif msgcontains(msg, 'no') then
selfSay('Then stay here!')
talk_state = 0
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('See you.')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if focus > 0 then
if (os.clock() - talk_start) > 30 then
selfSay('Bye.')
focus = 0
elseif getDistanceToCreature(focus) > 3 then
selfSay('Bye.')
focus = 0
end
end
end
Last edited by a moderator: