ziggy46802
Active Member
- Joined
- Aug 19, 2012
- Messages
- 418
- Reaction score
- 27
Here is the script
When I say sword or fletcher to him, he says "here you go" but does not mark my map, but all of the other map marks work fine and axes and clubs work perfectly fine, its just those last 2, what is wrong in the script?
Solved it: Had wrong talk states in the bottom 2 since I copied and pasted them.
Code:
-- City Guide, adding mapmarks to locations by Limos
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 config = {
amulets = {x=950,y=1000,z=7},
general = {x=949,y=1001,z=6},
magic = {x=955,y=978,z=6},
food = {x=929,y=974,z=6},
boots = {x=992,y=970,z=5},
shields = {x=992,y=972,z=6},
legs = {x=1004,y=972,z=6},
armors = {x=1000,y=977,z=6},
helmets = {x=988,y=977,z=6},
clubs = {x=990,y=979,z=7},
axes = {x=1002,y=979,z=7},
swords = {x=990,y=970,z=7},
fletcher = {x=1002,y=970,z=7}
}
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'shovel') or msgcontains(msg, 'rope') or msgcontains(msg, 'backpack') or msgcontains(msg, 'general') or msgcontains(msg, 'ontheis')) then
selfSay('Do you want me to add a mapmark where the general shop is at?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
doPlayerAddMapMark(cid,config.general,MAPMARK_TICK,"Ontheis, General Shop")
npcHandler:say('Here you are.', cid)
elseif(msgcontains(msg, 'wand') or msgcontains(msg, 'rod') or msgcontains(msg, 'potions') or msgcontains(msg, 'runes') or msgcontains(msg, 'magic') or msgcontains(msg, 'sticiaroid')) then
selfSay('Do you want me to add a mapmark where the magic shop is at?', cid)
talkState[talkUser] = 2
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then
doPlayerAddMapMark(cid, config.magic,MAPMARK_TICK,"Sticiaroid, Magic Shop")
npcHandler:say('Here you are.', cid)
elseif(msgcontains(msg, 'amulet') or msgcontains(msg, 'ring')) then
selfSay('Do you want me to add a mapmark where the amulet shop is at?', cid)
talkState[talkUser] = 9
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 9) then
doPlayerAddMapMark(cid, config.amulets,MAPMARK_TICK,"Jodo, Amulet Shop")
npcHandler:say('Here you are.', cid)
elseif(msgcontains(msg, 'food') or msgcontains(msg, 'eat') or msgcontains(msg, 'regen')) then
selfSay('Do you want me to add a mapmark where the food shop is at?', cid)
talkState[talkUser] = 11
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 11) then
doPlayerAddMapMark(cid, config.food,MAPMARK_TICK,"Arylymb, Food Shop")
npcHandler:say('Here you are.', cid)
elseif(msgcontains(msg, 'boot')) then
selfSay('Do you want me to add a mapmark where the boots shop is at?', cid)
talkState[talkUser] = 15
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 15) then
doPlayerAddMapMark(cid, config.boots,MAPMARK_TICK,"Emesthus, Boots Shop")
npcHandler:say('Here you are.', cid)
elseif(msgcontains(msg, 'shield')) then
selfSay('Do you want me to add a mapmark where the shield shop is at?', cid)
talkState[talkUser] = 16
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 16) then
doPlayerAddMapMark(cid, config.shields,MAPMARK_TICK,"Neutu, Shield Shop")
npcHandler:say('Here you are.', cid)
elseif(msgcontains(msg, 'leg') or msgcontains(msg, 'heros')) then
selfSay('Do you want me to add a mapmark where the legs shop is at?', cid)
talkState[talkUser] = 17
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 17) then
doPlayerAddMapMark(cid, config.legs,MAPMARK_TICK,"Clapoc, legs Shop")
npcHandler:say('Here you are.', cid)
elseif(msgcontains(msg, 'armor')) then
selfSay('Do you want me to add a mapmark where the armor shop is at?', cid)
talkState[talkUser] = 18
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 18) then
doPlayerAddMapMark(cid, config.armors,MAPMARK_TICK,"Agriampi, Armor Shop")
npcHandler:say('Here you are.', cid)
elseif(msgcontains(msg, 'helmet')) then
selfSay('Do you want me to add a mapmark where the helmet shop is at?', cid)
talkState[talkUser] = 19
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 19) then
doPlayerAddMapMark(cid, config.helmets,MAPMARK_TICK,"Faicaea, Helmet Shop")
npcHandler:say('Here you are.', cid)
elseif(msgcontains(msg, 'club')) then
selfSay('Do you want me to add a mapmark where the club shop is at?', cid)
talkState[talkUser] = 20
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 20) then
doPlayerAddMapMark(cid, config.clubs,MAPMARK_TICK,"Fabesusi, Club Shop")
npcHandler:say('Here you are.', cid)
elseif(msgcontains(msg, 'sword')) then
selfSay('Do you want me to add a mapmark where the sword shop is at?', cid)
talkState[talkUser] = 20
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 20) then
doPlayerAddMapMark(cid, config.swords,MAPMARK_TICK,"Rochus, Sword Shop")
npcHandler:say('Here you are.', cid)
elseif(msgcontains(msg, 'axe')) then
selfSay('Do you want me to add a mapmark where the axe shop is at?', cid)
talkState[talkUser] = 21
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 21) then
doPlayerAddMapMark(cid, config.axes,MAPMARK_TICK,"Cinusane, Axe Shop")
npcHandler:say('Here you are.', cid)
elseif(msgcontains(msg, 'paladin') or msgcontains(msg, 'fletcher') or msgcontains(msg, 'bow') or msgcontains(msg, 'arrow') or msgcontains(msg, 'spear')) then
selfSay('Do you want me to add a mapmark where the fletcher is at?', cid)
talkState[talkUser] = 20
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 20) then
doPlayerAddMapMark(cid, config.fletcher,MAPMARK_TICK,"Ustegonuse, Fletcher")
npcHandler:say('Here you are.', cid)
elseif(msgcontains(msg, 'no') and talkState[talkUser] >= 1) then
selfSay('Well then, if you cant\'t find it after awhile just ask me and I\'ll show you where it is at.', cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
When I say sword or fletcher to him, he says "here you go" but does not mark my map, but all of the other map marks work fine and axes and clubs work perfectly fine, its just those last 2, what is wrong in the script?
Solved it: Had wrong talk states in the bottom 2 since I copied and pasted them.
Last edited: