Code:
local focus = 0
local talk_start = 0
local target = 0
local days = 0
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
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 onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Hello ' .. getCreatureName(cid) .. '! I need some help.')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'help') or msgcontains(msg, 'quest') then
if getPlayerStorageValue(cid,50088) == -1 then
selfSay('Do you want to help me?')
talk_state = 1
else
selfSay('I already sent you on my quest.')
talk_state = 0
end
elseif msgcontains(msg, 'sheet') or msgcontains(msg, 'music') then
if getPlayerStorageValue(cid,50088) == 1 then
selfSay('Do you have the music sheets?')
talk_state = 2
else
selfSay('You already did my quest')
talk_state = 0
end
elseif talk_state == 1 then
if msgcontains(msg, 'yes') then
setPlayerStorageValue(cid,50088, 1)
selfSay('Get the 3 different music sheets from 3 different kings')
selfSay('They are in the human dimension')
else
selfSay('Then not.')
end
end
talk_state = 0
elseif talk_state == 3 then
sheet1 = getPlayerItemCount(cid,6087)
sheet2 = getPlayerItemCount(cid,6088)
sheet3 =getPlayerItemCount(cid,6089)
if msgcontains(msg, 'yes') then
if sheet1 >= 1 and sheet2 >= 1 and sheet3 >=1 then
doPlayerRemoveItem (cid,6087,1)
doPlayerRemoveItem (cid,6088,1)
doPlayerRemoveItem (cid,6089,1)
doPlayerAddItem (cid,2127,1)
selfSay('Here is your reward!')
selfSay('Youll have to figure the secret out yourself.')
focus = 0
else
selfSay('Fool, You dont have all the sheets!')
selfSay('Get outta here')
focus = 0
end
end
talk_state = 0
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
doNpcSetCreatureFocus(focus)
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end
Whats wrong:
Code:
[COLOR="blue"]19:54 GOD Wiggle Jiggle [105]: hi
19:54 Crazy Old Man: Hello GOD Wiggle Jiggle! I need some help.
19:55 GOD Wiggle Jiggle [105]: help
19:55 Crazy Old Man: Do you want to help me?
19:55 GOD Wiggle Jiggle [105]: yes
19:55 GOD Wiggle Jiggle [105]: .....
19:55 Crazy Old Man: Next Please...[/COLOR]
[COLOR="Red"]20:03 GOD Wiggle Jiggle [105]: hi
20:03 Crazy Old Man: Hello GOD Wiggle Jiggle! I need some help.
20:03 GOD Wiggle Jiggle [105]: music sheets
20:03 Crazy Old Man: You already did my quest[/COLOR]
after yes it doesnt say what it is supposed to say...
it also does NOT give errors
can someone help me?
PS

Last edited: