YisusChrist
Banned User
- Joined
- Jul 9, 2013
- Messages
- 47
- Reaction score
- 0
All my npcs buy and sell items correctly but Xodet and Hanna do not buy Diamonds, black pearl etc... and empty flask ... It shows but it can't be sellable
script hanna xml and lua
same with xodet ,xml and lua
Any help will be great ,
PS: Just this 2 NPCs ( Xodet, Hanna) don't buy items correctly (THEY SELL) anyone else works perfectly, so i dont think it's on modules or npchandler?
Kind Regards,
YisusChrist
Solved!
script hanna xml and lua
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Hanna" script="data/npc/scripts/Hanna.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="136" head="113" body="65" legs="0" feet="96" addons="2"/>
<voices>
<voice text="I have gems and beautiful jewellery for you!" interval2="100" margin="1" yell="no"/>
</voices>
<parameters>
<parameter key="message_greet" value="Oh, please come in, |PLAYERNAME|. What do you need? Have a look at my wonderful offers in gems and jewellery."/>
<parameter key="message_farewell" value="Good bye."/>
<parameter key="module_keywords" value="1" />
<parameter key="keywords" value="job;" />
<parameter key="keyword_reply1" value="I am a jeweler. Maybe you want to have a look at my wonderful offers." />
<parameter key="module_shop" value="1"/>
<parameter key="shop_buyable" value="black pearl,2144,560;golden amulet,2130,6600;ruby necklace,2133,3560;small amethyst,2150,400;small diamond,2145,600;small sapphire,2146,500;wedding ring,2121,990;white pearl,2143,320;small ruby,2147,500;small emerald,2149,500;bronze goblet,5807,2000;golden goblet,5805,5000;silver goblet,5806,3000;" />
<parameter key="shop_sellable" value="white pearl,2143,160;black pearl,2144,280;small topaz,9970,200;small diamond,2145,300;small sapphire,2146,250;small rubies,2147,250;small emerald,2149,250;small amethyst,2150,200;gold ingot,9971,5000;wedding ring,2121,100;giant shimmering pearl,7633,3000;giant shimmering pearl,7632,3000" />
</parameters>
</npc>
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local hasItems = {}
local addonStatus = 12002 -- Storage key where addon status will be stored.
local items = {
-- [index (Don't even need this, but w/e)] = {id, count},
[1] = {5890, 100},
[2] = {5902, 50},
[3] = {2480, 1}
}
local wait = {
storage = 12003, -- Storage key where time status will be stored.
_time = 0 -- Time to wait to get your addon.
}
local outfit = {
types = {128, 136},
addon = 2
}
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 talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if(msgcontains(msg, 'addon') and getCreatureStorage(cid, addonStatus) <= 0) then
selfSay('Pretty, isn\'t it? My friend Amber taught me how to make it, but I could help you with one if you like. What do you say?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1 and getCreatureStorage(cid, addonStatus) <= 0) then
selfSay('Okay, here we go, listen closely! I need a few things... a basic hat of course, maybe a legion helmet would do. Then about 100 chicken feathers... and 50 honeycombs as glue. That\'s it, come back to me once you gathered it!', cid)
talkState[talkUser] = nil
doCreatureSetStorage(cid, addonStatus, 1)
elseif(msgcontains(msg, 'hat') and getCreatureStorage(cid, addonStatus) == 1) then
selfSay('Oh, you\'re back already? Did you bring a legion helmet, 100 chicken feathers and 50 honeycombs?', cid)
talkState[talkUser] = 3
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 3) and getPlayerItemCount(cid, 5890) >= 100 and getPlayerItemCount(cid, 5902) >= 50 and getPlayerItemCount(cid, 2480) >= 1 then
doPlayerRemoveItem(cid, 5890, 100)
doPlayerRemoveItem(cid, 5902, 50)
doPlayerRemoveItem(cid, 2480, 1)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
doCreatureSetStorage(cid, addonStatus, 3)
selfSay('Great job! That must have taken a lot of work. Okay, you put it like this... then glue like this... here!', cid)
if getPlayerSex(cid) == 1 then
doPlayerAddOutfit(cid, 128, 2)
elseif getPlayerSex(cid) == 0 then
doPlayerAddOutfit(cid, 136, 2)
Topic[talkUser] = 0
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
same with xodet ,xml and lua
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Xodet" script="data/npc/scripts/xodet.lua" walkinterval="1000" floorchange="0">
<health now="100" max="100"/>
<look type="130" head="19" body="86" legs="87" feet="95" addons="0"/>
<parameters>
<parameter key="message_greet" value="Oh, please come in, |PLAYERNAME|. If you need magical equipment such as runes or wands for backpack rune just say(BUY BP SD ETC, just ask me for a {trade}."/>
<parameter key="message_farewell" value="Good bye and come again."/>
<parameter key="module_keywords" value="1" />
<parameter key="keywords" value="job;" />
<parameter key="keyword_reply1" value="I'm sorcerer and trade with all kinds of magic items." />
<parameter key="module_shop" value="1"/>
<parameter key="shop_buyable" value="blank rune,2260,10;spellbook,6120,150;strong health potion,7588,100;strong mana potion,7589,80;great mana potion,7590,120;great health potion,7591,190;health potion,7618,45;mana potion,7620,50;great spirit potion,8472,190;ultimate health potion,8473,310;destroy field rune,2261,45;intense healing rune,2265,95;mana rune,2300,100;sudden death rune,2268,325;ultimate healing rune,2273,175;avalanche rune,2274,180;energy field rune,2277,115;energy wall rune,2279,340;poison field rune,2285,65;light magic missile rune,2287,40;poison wall rune,2289,210;convince creature rune,2290,80;chameleon rune,2291,210;stalagmite rune,2292,120;fire field rune,2301,85;fire wall rune,2303,245;great fireball rune,2304,180;fire bomb rune,2305,235;heavy magic missile rune,2311,120;explosion rune,2313,190;terra rod,2181,10000;snakebite rod,2182,500;necrotic rod,2185,5000;moonlight rod,2186,1000;wand of decay,2188,5000;wand of cosmic energy,2189,10000;wand of vortex,2190,500;wand of dragonbreath,2191,1000;" />
<parameter key="shop_sellable" value="empty potion flask,7634,5;empty potion flask,7635,5;empty potion flask,7636,5;vial,2006,5;" />
</parameters>
</npc>
PHP:
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
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
shopModule:addBuyableItem({'spellbook'}, 2175, 150, 'spellbook')
shopModule:addBuyableItem({'magic lightwand'}, 2163, 400, 'magic lightwand')
shopModule:addBuyableItem({'small health'}, 8704, 20, 1, 'small health potion')
shopModule:addBuyableItem({'health potion'}, 7618, 45, 1, 'health potion')
shopModule:addBuyableItem({'mana potion'}, 7620, 50, 1, 'mana potion')
shopModule:addBuyableItem({'strong health'}, 7588, 100, 1, 'strong health potion')
shopModule:addBuyableItem({'strong mana'}, 7589, 80, 1, 'strong mana potion')
shopModule:addBuyableItem({'great health'}, 7591, 190, 1, 'great health potion')
shopModule:addBuyableItem({'great mana'}, 7590, 120, 1, 'great mana potion')
shopModule:addBuyableItem({'great spirit'}, 8472, 190, 1, 'great spirit potion')
shopModule:addBuyableItem({'ultimate health'}, 8473, 310, 1, 'ultimate health potion')
shopModule:addBuyableItem({'antidote potion'}, 8474, 50, 1, 'antidote potion')
shopModule:addSellableItem({'normal potion flask', 'normal flask'}, 7636, 5, 'empty small potion flask')
shopModule:addSellableItem({'strong potion flask', 'strong flask'}, 7634, 10, 'empty strong potion flask')
shopModule:addSellableItem({'great potion flask', 'great flask'}, 7635, 15, 'empty great potion flask')
shopModule:addBuyableItem({'instense healing'}, 2265, 95, 15, 'intense healing rune')
shopModule:addBuyableItem({'ultimate healing'}, 2273, 175, 15, 'ultimate healing rune')
shopModule:addBuyableItem({'mana rune'}, 2300, 175, 15, 'mana rune')
shopModule:addBuyableItem({'magic wall'}, 2293, 350, 20, 'magic wall rune')
shopModule:addBuyableItem({'destroy field'}, 2261, 45, 50, 'destroy field rune')
shopModule:addBuyableItem({'light magic missile'}, 2287, 40, 50, 'light magic missile rune')
shopModule:addBuyableItem({'heavy magic missile'}, 2311, 120, 50, 'heavy magic missile rune')
shopModule:addBuyableItem({'great fireball'}, 2304, 180, 25, 'great fireball rune')
shopModule:addBuyableItem({'explosion'}, 2313, 250, 25, 'explosion rune')
shopModule:addBuyableItem({'sudden death'}, 2268, 350, 15, 'sudden death rune')
shopModule:addBuyableItem({'death arrow'}, 2263, 300, 15, 'death arrow rune')
shopModule:addBuyableItem({'paralyze'}, 2278, 700, 5, 'paralyze rune')
shopModule:addBuyableItem({'animate dead'}, 2316, 375, 15, 'animate dead rune')
shopModule:addBuyableItem({'convince creature'}, 2290, 80, 50, 'convince creature rune')
shopModule:addBuyableItem({'chameleon'}, 2291, 210, 50, 'chameleon rune')
shopModule:addBuyableItem({'desintegrate'}, 2310, 80, 50, 'desintegreate rune')
shopModule:addBuyableItemContainer({'bp slhp'}, 2000, 8704, 400, 1, 'backpack of small health potions')
shopModule:addBuyableItemContainer({'bp hp'}, 2000, 7618, 900, 1, 'backpack of health potions')
shopModule:addBuyableItemContainer({'bp mp'}, 2001, 7620, 1000, 1, 'backpack of mana potions')
shopModule:addBuyableItemContainer({'bp shp'}, 2000, 7588, 2000, 1, 'backpack of strong health potions')
shopModule:addBuyableItemContainer({'bp smp'}, 2001, 7589, 1600, 1, 'backpack of strong mana potions')
shopModule:addBuyableItemContainer({'bp ghp'}, 2000, 7591, 3800, 1, 'backpack of great health potions')
shopModule:addBuyableItemContainer({'bp gmp'}, 2001, 7590, 2400, 1, 'backpack of great mana potions')
shopModule:addBuyableItemContainer({'bp gsp'}, 1999, 8472, 3800, 1, 'backpack of great spirit potions')
shopModule:addBuyableItemContainer({'bp uhp'}, 2000, 8473, 6200, 1, 'backpack of ultimate health potions')
shopModule:addBuyableItemContainer({'bp ap'}, 2002, 8474, 2000, 1, 'backpack of antidote potions')
shopModule:addBuyableItemContainer({'bp sd'}, 2003, 2268, 6000, 20, 'backpack of suddean death runes')
shopModule:addBuyableItemContainer({'bp uh'}, 2002, 2273, 4000, 20, 'backpack of ultimate healing runes')
shopModule:addBuyableItem({'wand of vortex', 'vortex'}, 2190, 500, 'wand of vortex')
shopModule:addBuyableItem({'wand of dragonbreath', 'dragonbreath'}, 2191, 1000, 'wand of dragonbreath')
shopModule:addBuyableItem({'wand of decay', 'decay'}, 2188, 5000, 'wand of decay')
shopModule:addBuyableItem({'wand of draconia', 'draconia'}, 8921, 7500, 'wand of draconia')
shopModule:addBuyableItem({'wand of cosmic energy', 'cosmic energy'}, 2189, 10000, 'wand of cosmic energy')
shopModule:addBuyableItem({'wand of inferno', 'inferno'}, 2187, 15000, 'wand of inferno')
shopModule:addBuyableItem({'wand of starstorm', 'starstorm'}, 8920, 180000, 'wand of starstorm')
shopModule:addBuyableItem({'wand of voodoo', 'voodoo'}, 8922, 22000, 'wand of voodoo')
shopModule:addBuyableItem({'snakebite rod', 'snakebite'}, 2182, 500, 'snakebite rod')
shopModule:addBuyableItem({'moonlight rod', 'moonlight'}, 2186, 1000, 'moonlight rod')
shopModule:addBuyableItem({'necrotic rod', 'necrotic'}, 2185, 5000, 'necrotic rod')
shopModule:addBuyableItem({'northwind rod', 'northwind'}, 8911, 7500, 'northwind rod')
shopModule:addBuyableItem({'terra rod', 'terra'}, 2181, 10000, 'terra rod')
shopModule:addBuyableItem({'hailstorm rod', 'hailstorm'}, 2183, 15000, 'hailstorm rod')
shopModule:addBuyableItem({'springsprout rod', 'springsprout'}, 8912, 180000, 'springsprout rod')
shopModule:addBuyableItem({'underworld rod', 'underworld'}, 8910, 220000, 'underworld rod')
shopModule:addSellableItem({'wand of vortex', 'vortex'}, 2190, 250, 'wand of vortex')
shopModule:addSellableItem({'wand of dragonbreath', 'dragonbreath'}, 2191, 500, 'wand of dragonbreath')
shopModule:addSellableItem({'wand of decay', 'decay'}, 2188, 2500, 'wand of decay')
shopModule:addSellableItem({'wand of draconia', 'draconia'}, 8921, 3750, 'wand of draconia')
shopModule:addSellableItem({'wand of cosmic energy', 'cosmic energy'}, 2189, 5000, 'wand of cosmic energy')
shopModule:addSellableItem({'wand of inferno', 'inferno'},2187, 7500, 'wand of inferno')
shopModule:addSellableItem({'wand of starstorm', 'starstorm'}, 8920, 9000, 'wand of starstorm')
shopModule:addSellableItem({'wand of voodoo', 'voodoo'}, 8922, 11000, 'wand of voodoo')
shopModule:addSellableItem({'snakebite rod', 'snakebite'}, 2182, 250,'snakebite rod')
shopModule:addSellableItem({'moonlight rod', 'moonlight'}, 2186, 500, 'moonlight rod')
shopModule:addSellableItem({'necrotic rod', 'necrotic'}, 2185, 2500, 'necrotic rod')
shopModule:addSellableItem({'northwind rod', 'northwind'}, 8911, 3750, 'northwind rod')
shopModule:addSellableItem({'terra rod', 'terra'}, 2181, 5000, 'terra rod')
shopModule:addSellableItem({'hailstorm rod', 'hailstorm'}, 2183, 7500, 'hailstorm rod')
shopModule:addSellableItem({'springsprout rod', 'springsprout'}, 8912, 9000, 'springsprout rod')
shopModule:addSellableItem({'underworld rod', 'underworld'}, 8910, 11000, 'underworld rod')
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local items = {[1] = 2190, [2] = 2182, [5] = 2190, [6] = 2182}
if(msgcontains(msg, 'first rod') or msgcontains(msg, 'first wand')) then
if(isSorcerer(cid) or isDruid(cid)) then
if(getPlayerStorageValue(cid, 30002) == -1) then
selfSay('So you ask me for a {' .. getItemNameById(items[getPlayerVocation(cid)]) .. '} to begin your advanture?', cid)
talkState[talkUser] = 1
else
selfSay('What? I have already gave you one {' .. getItemNameById(items[getPlayerVocation(cid)]) .. '}!', cid)
end
else
selfSay('Sorry, you aren\'t a druid either a sorcerer.', cid)
end
elseif(msgcontains(msg, 'yes')) then
if(talkState[talkUser] == 1) then
doPlayerAddItem(cid, items[getPlayerVocation(cid)], 1)
selfSay('Here you are young adept, take care yourself.', cid)
setPlayerStorageValue(cid, 30002, 1)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then
selfSay('Ok then.', cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Any help will be great ,
PS: Just this 2 NPCs ( Xodet, Hanna) don't buy items correctly (THEY SELL) anyone else works perfectly, so i dont think it's on modules or npchandler?
Kind Regards,
YisusChrist
Solved!
Last edited: