Hello Otland. I've found a bp rune seller npc in my npc directory.
Which means that this npc will sell backpack of runes or manas etc. This is a 7.6 xml real map, and those scripts are kinda rare here since the newer scripts wont work on the older xml servers. The problem is that when you say for example:
Sture Den Lure: Buy bp sds.
Xodet: Do you want to buy a backpack of Sudden Death runes for 6000 gold pieces?
Sture Den Lure: Yes
And nothing happens, he wont answer you with: "Here You Go!". you wont loose your money tho, and you wont get any bp runes in your backpack.
Can someone please help me get this npc working?
Here is the Data/npc/Bp_runes.xml
Here is Data/Npc/Scripts/Bp_runes.lua
Please. If anyone can solve this problem, would you be too kind and post it here?
Kind Regards
Your's
Challe92
Which means that this npc will sell backpack of runes or manas etc. This is a 7.6 xml real map, and those scripts are kinda rare here since the newer scripts wont work on the older xml servers. The problem is that when you say for example:
Sture Den Lure: Buy bp sds.
Xodet: Do you want to buy a backpack of Sudden Death runes for 6000 gold pieces?
Sture Den Lure: Yes
And nothing happens, he wont answer you with: "Here You Go!". you wont loose your money tho, and you wont get any bp runes in your backpack.
Can someone please help me get this npc working?
Here is the Data/npc/Bp_runes.xml
Code:
<?xml version="1.0"?>
<npc name="Xodet" script="data/npc/scripts/bp_runes.lua" access="3" pushable="0" dir="1">
<health now="1000" max="1000"/>
<look type="128" head="78" body="71" legs="82" feet="114" corpse="3128"/>
</npc>
Here is Data/Npc/Scripts/Bp_runes.lua
Code:
-- Scripts by TLM TEAM
-- Modified by HoTS
target = 0
following = false
attacking = false
focus = 0
itemid = 0
count = 0
payback = 0
talkcount = 0
talk_start = 0
function selfLook(cid)
if cid ~= 0 then
x, y, z = creatureGetPosition(focus)
myx, myy, myz = selfGetPosition()
if ((myy-y==0) and (myx-x<=0 and myx-x>=-4)) then
selfTurn(0)
end
if ((myy-y==0) and (myx-x>=0 and myx-x<=4)) then
selfTurn(2)
end
if ((myx-x==0) and (myy-y<=0 and myy-y>=-4)) then
selfTurn(1)
end
if ((myx-x==0) and (myy-y>=0 and myy-y<=4)) then
selfTurn(3)
end
if ((myy-y==-2) and (myx-x>=-1 and myx-x<=1)) then
selfTurn(1)
end
if ((myy-y==2) and (myx-x>=-1 and myx-x<=1)) then
selfTurn(3)
end
if ((myx-x==2) and (myy-y>=-1 and myy-y<=1)) then
selfTurn(2)
end
if ((myx-x==-2) and (myy-y>=-1 and myy-y<=1)) then
selfTurn(0)
end
if ((myy-y==-3) and (myx-x>=-2 and myx-x<=2)) then
selfTurn(1)
end
if ((myy-y==3) and (myx-x>=-2 and myx-x<=2)) then
selfTurn(3)
end
if ((myx-x==3) and (myy-y>=-2 and myy-y<=2)) then
selfTurn(2)
end
if ((myx-x==-3) and (myy-y>=-2 and myy-y<=2)) then
selfTurn(0)
end
if ((myy-y==-4) and (myx-x>=-3 and myx-x<=3)) then
selfTurn(1)
end
if ((myy-y==4) and (myx-x>=-3 and myx-x<=3)) then
selfTurn(3)
end
if ((myx-x==4) and (myy-y>=-3 and myy-y<=3)) then
selfTurn(2)
end
if ((myx-x==-4) and (myy-y>=-3 and myy-y<=3)) then
selfTurn(0)
end
end
end
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(id)
if id == target then
target = 0
attacking = false
selfAttackCreature(0)
following = false
--Stop--Speaking()
end
focus = 0
itemid = 0
end
function onCreatureTurn(creature)
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
dist = getDistanceToCreature(cid)
if dist >= 4 then
return
end
talk_start = os.clock()
if string.find(msg, '(%a*)offer(%a*)') then
selfSay('The runes are: Bp SD - 3x (6500gp), Bp UH - 5x (3500gp), Bp GFB - 3x (3600gp), Bp Hmm - 5x (2500gp), Bp Explosion - 5x (5000), Bp Ih - 10x (1900gp) Bp Mana Fluid - 1x (1000gp).')
end
if string.find(msg, '(%a*)yes(%a*)') and cid == focus and talkcount == 2 then
talkcount = 0
SellItem(focus,itemid,count,cost)
end
-- Some More Commands To Shopping
if string.find(msg, '(%a*)rune(%a*)') and cid == focus then
selfSay('A blank rune costs 10 gold pieces, do you want to buy one?')
talk_start = os.clock()
itemid = 2260
count = 1
cost = 10*20
talkcount = 1
return
end
if string.find(msg, '(%a*)sd(%a*)') and cid == focus then
selfSay('do you want to buy one?')
talk_start = os.clock()
itemid = 2268
count = 1
cost = 325*20
talkcount = 1
return
end
if string.find(msg, '(%a*)ih(%a*)') and cid == focus then
selfSay('do you want to buy one?')
talk_start = os.clock()
itemid = 2265
count = 1
cost = 95*20
talkcount = 1
return
end
if string.find(msg, '(%a*)uh(%a*)') and cid == focus then
selfSay('do you want to buy one?')
talk_start = os.clock()
itemid = 2273
count = 1
cost = 175*20
talkcount = 1
return
end
if string.find(msg, '(%a*)gfb(%a*)') and cid == focus then
selfSay('do you want to buy one?')
talk_start = os.clock()
itemid = 2304
count = 3
cost = 180*20
talkcount = 1
return
end
if string.find(msg, '(%a*)explosion(%a*)') and cid == focus then
selfSay('do you want to buy one?')
talk_start = os.clock()
itemid = 2313
count = 3
cost = 250*20
talkcount = 1
return
end
if string.find(msg, '(%a*)hmm(%a*)') and cid == focus then
selfSay('do you want to buy one?')
talk_start = os.clock()
itemid = 2311
count = 5
cost = 125*20
talkcount = 1
return
end
if string.find(msg, '(%a*)mana fluid(%a*)') and cid == focus then
selfSay('do you want to buy one?')
talk_start = os.clock()
itemid = 2006
count = 20
cost = 50*20
talkcount = 1
return
end
-- End of Shopping
if string.find(msg, '(%a*)no(%a*)') and cid == focus and talkcount == 1 then
selfSay('Ok, is there something else you want? If so tell me.')
itemid = 0
count = 0
cost = 0
talkcount = 0
end
if string.find(msg, '(%a*)yes(%a*)') and cid == focus and talkcount == 1 then
talkcount = 0
buycontainer(focus,itemid,count,cost)
end
if string.find(msg, '(%a*)hi(%a*)') and string.len(msg) == 2 then
if focus == cid then
selfSay('I am already talking to you!')
else if focus > 0 then
selfSay('' .. creatureGetName(cid) .. ', please wait until it is your turn!')
end
end
if(focus == 0) then
selfSay('Hello, ' .. creatureGetName(cid) .. ', welcome to my tools shop!')
focus = cid
--TurnToPlayer(focus)
--Speaking()
end
talk_start = os.clock()
end
if string.find(msg, '(%a*)hello(%a*)') and string.len(msg) == 5 then
if focus == cid then
selfSay('I am already talking to you!')
else if focus > 0 then
selfSay('' .. creatureGetName(cid) .. ', please wait until it is your turn!')
end
end
if(focus == 0) then
selfSay('Hello, ' .. creatureGetName(cid) .. ', welcome to my tools shop!')
focus = cid
--TurnToPlayer(focus)
--Speaking()
end
talk_start = os.clock()
end
if string.find(msg, '(%a*)hey(%a*)') and string.len(msg) == 3 then
if focus == cid then
selfSay('I am already talking to you!')
else if focus > 0 then
selfSay('' .. creatureGetName(cid) .. ', please wait until it is your turn!')
end
end
if(focus == 0) then
selfSay('Hello, ' .. creatureGetName(cid) .. ', welcome to my tools shop!')
focus = cid
--TurnToPlayer(focus)
--Speaking()
end
talk_start = os.clock()
end
if string.find(msg, '(%a*)bye(%a*)') and cid == focus then
selfSay('Farewell, ' .. creatureGetName(cid) .. '!')
focus = 0
itemid = 0
talk_start = 0
talkcount = 0
--Stop--Speaking()
end
if string.find(msg, '(%a*)farewell(%a*)') and cid == focus then
selfSay('Farewell, ' .. creatureGetName(cid) .. '!')
focus = 0
itemid = 0
talk_start = 0
talkcount = 0
--Stop--Speaking()
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 40 then
if focus > 0 then
selfSay('Next please!')
talkcount = 0
--Stop--Speaking()
end
focus = 0
itemid = 0
talk_start = 0
end
end
Please. If anyone can solve this problem, would you be too kind and post it here?
Kind Regards
Your's
Challe92
Last edited: