So...
My Friend made a NPC Script but thats wont work right...
Also the NPC take 10 Chicken Feather and 10 Wofl Paws and u get a access to open a magic door...ActionID 1001..^^
So but something is Wrong..Plx HelP?
My Friend made a NPC Script but thats wont work right...
Also the NPC take 10 Chicken Feather and 10 Wofl Paws and u get a access to open a magic door...ActionID 1001..^^
So but something is Wrong..Plx HelP?
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
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(callback)
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) .. '! What brings you to my place?.')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk with you in one minute.')
-- The Door Access
elseif msgcontains(msg, 'secret') then
selfSay('oooooohhhh.. so you know about that... hmm.. well now that you know its not my secret anymore, if you bring me 10 wolf paw and 10 chicken feathers i will let you have it!')
talk_state = 1
talk_start = os.clock()
elseif talk_state == 1 and msgcontains(msg, 'yes') then
if getPlayerItemCount(cid,5878) >= 10 then
if doPlayerRemoveItem(cid,5878,10) then
selfSay('Ok pal! now you can access to the locked door on temple you will discover lot of things there !')
setPlayerStorageValue(cid,4780) >= 1
end
else
selfSay('Sorry, you dont have what i want!')
end
end