xxgoosexx
GoosioOT
- Joined
- Jul 10, 2007
- Messages
- 298
- Reaction score
- 2
FIXED BUG
Noob setup but it works - teleports player into room so no one can mess with them, then player puts item on basin, and then says what they want engraved then the item is engraved and the player is tp'd back out.
could use alot of work but meh enjoy, comment, etc
http://img56.imageshack.us/img56/8049/npcsq1.png
Noob setup but it works - teleports player into room so no one can mess with them, then player puts item on basin, and then says what they want engraved then the item is engraved and the player is tp'd back out.
could use alot of work but meh enjoy, comment, etc
http://img56.imageshack.us/img56/8049/npcsq1.png
Code:
local focus = 0
local talk_start = 0
local target = 0
local days = 0
local msg = ''
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye.')
focus = 0
talk_start = 0
doNpcSetCreatureFocus(0)
end
end
function onCreatureTurn(creature)
end
function onCreatureSay(cid, type, msg)
if (msgcontains(msg, 'hi') or msgcontains(msg, 'hello')) and (focus == 0) and getDistanceToCreature(cid) < 4 then
doNpcSetCreatureFocus(cid)
selfSay('Hello ' .. getCreatureName(cid) .. '! Would you like an item "engraved"?')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. getCreatureName(cid) .. '! I\'ll talk to you in a moment.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'engrave') or msgcontains(msg, 'engraved') then
doTeleportThing(cid,{x=1047,y=1032,z=7})
doSendMagicEffect({x=1047,y=1032,z=7},10)
selfSay('Place the item you want engraved on the basin and let me know when you are "ready".')
talk_state = 1
end
if msgcontains(msg, 'ready') and talk_state == 1 then
basin = getThingfromPos({x=1048,y=1032,z=7, stackpos=255})
if basin.itemid ~= 0 then
selfSay('What do you wish to be engraved? It will cost 1,000 gp to do.')
doRemoveItem(basin.uid,1)
doSendMagicEffect({x=1048,y=1032,z=7},15)
talk_state = 2
local msg = ''
else
selfSay('You did not place an item on the basin. Please do and let me know when you are "ready".')
talk_state = 3
end
elseif talk_state == 2 and (msg ~= 'stop') then
if doPlayerRemoveMoney(cid,1000) == TRUE then
item = doPlayerAddItem(cid,basin.itemid,1)
doSetItemSpecialDescription(item,msg)
selfSay('Here you are. Please visit again soon.')
doTeleportThing(cid,{x=1048,y=1028,z=7})
doSendMagicEffect({x=1048,y=1028,z=7},10)
focus = 0
talk_start = 0
talk_state = 0
else
doPlayerAddItem(cid,basin.itemid,1)
selfSay('Come back when you have enough money.')
doTeleportThing(cid,{x=1048,y=1028,z=7})
doSendMagicEffect({x=1048,y=1028,z=7},31)
focus = 0
talk_start = 0
talk_state = 0
end
elseif talk_state == 3 then
basin = getThingfromPos({x=1048,y=1032,z=7, stackpos=255})
if basin.itemid ~= 0 then
selfSay('What do you wish to be engraved? It will cost 1,000 gp to do.')
doRemoveItem(basin.uid,1)
doSendMagicEffect({x=1048,y=1032,z=7},15)
talk_state = 2
local msg = ''
else
selfSay('Please come back when you have an item to be engraved.')
doTeleportThing(cid,{x=1048,y=1028,z=7})
doSendMagicEffect({x=1048,y=1028,z=7},31)
focus = 0
talk_start = 0
talk_state = 0
end
end
if msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye.')
focus = 0
talk_start = 0
talk_state = 0
end
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
Last edited: