ibkfly
New Member
- Joined
- Jan 1, 2010
- Messages
- 69
- Reaction score
- 4
Hey, so ive made an NPC that trades 1000 cyan crystal fragments for an Armor set, i.e. Paladin Set, Knight Set or Mage Set.
I don't get any errors when running tfs or anything but the NPC just doesn't appear on the map after i put him there on RME. Ive tried several places to place him but he just isnt there.
Ill post the xml and lua so you guys can see if there is any error.
barzo.xml:
cyancrystalmerchant.lua:
I hope someone will be able to help me
I don't get any errors when running tfs or anything but the NPC just doesn't appear on the map after i put him there on RME. Ive tried several places to place him but he just isnt there.
Ill post the xml and lua so you guys can see if there is any error.
barzo.xml:
XML:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="[Cyan Crystal Merchant]Barzo" script="data/npc/scripts/cyancrystalmerchant.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="145" addons="3" head="67" body="34" legs="67" feet="34" corpse="2317"/>
<parameters>
<parameter key="message_greet" value="Hello, I'm trading your cyan fragments for vocation armor sets, Do you want to trade?"/>
</parameters>
</npc>
cyancrystalmerchant.lua:
LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'paladin set')) then
selfSay('Do you want to give me 1000 cyan fragments for an abyss armor set for paladins?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(getPlayerItemCount(cid, 18419) >= 1000) then
if(doPlayerRemoveItem(cid, 18419, 1000)) then
doPlayerAddItem(cid, 11301, 1)
doPlayerAddItem(cid, 11302, 1)
doPlayerAddItem(cid, 11303, 1)
doPlayerAddItem(cid, 11304, 1)
selfSay('Here you are.', cid)
else
selfSay('Sorry, you don\'t have enough cyan fragments.', cid)
end
else
selfSay('Sorry, you don\'t have cyan fragments.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
end
if(msgcontains(msg, 'mage set')) then
selfSay('Do you want to give me 1000 cyan fragments for an abyss armor set for magicians?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(getPlayerItemCount(cid, 18419) >= 1000) then
if(doPlayerRemoveItem(cid, 18419, 1000)) then
doPlayerAddItem(cid, 7902, 1)
doPlayerAddItem(cid, 7892, 1)
doPlayerAddItem(cid, 7896, 1)
doPlayerAddItem(cid, 7897, 1)
selfSay('Here you are.', cid)
else
selfSay('Sorry, you don\'t have enough cyan fragments.', cid)
end
else
selfSay('Sorry, you don\'t have cyan fragments.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
end
return true
end
if(msgcontains(msg, 'knight set')) then
selfSay('Do you want to give me 1000 cyan fragments for an abyss armor set for knights?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(getPlayerItemCount(cid, 18419) >= 1000) then
if(doPlayerRemoveItem(cid, 18419, 1000)) then
doPlayerAddItem(cid, 2342, 1)
doPlayerAddItem(cid, 9776, 1)
doPlayerAddItem(cid, 9777, 1)
doPlayerAddItem(cid, 12646, 1)
selfSay('Here you are.', cid)
else
selfSay('Sorry, you don\'t have enough cyan fragments.', cid)
end
else
selfSay('Sorry, you don\'t have cyan fragments.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
end
return true
end
I hope someone will be able to help me