Sentil1806
New Member
- Joined
- Jun 27, 2008
- Messages
- 3
- Reaction score
- 0
Hello guys!
I need your help in linking two codes. I've got loot.lua script (NPC Soya from TFS 0.3.6) and I want to paste my piece of code on it. I was trying to do it myself but once NPC didn't answer, another time did everything (answer when asked about loot he's buying, quest etc) without buying items. Help, please ; )
Soya.xml:
Loot.lua code:
That was scripts from TFS 0.3.6. I want to paste this code:
Regards!
I need your help in linking two codes. I've got loot.lua script (NPC Soya from TFS 0.3.6) and I want to paste my piece of code on it. I was trying to do it myself but once NPC didn't answer, another time did everything (answer when asked about loot he's buying, quest etc) without buying items. Help, please ; )
Soya.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Soya" script="loot.lua" walkinterval="2000" floorchange="0">
<health now="150" max="150"/>
<look type="139" head="132" body="79" legs="97" feet="132" corpse="2212"/>
<parameters>
<parameter key="module_shop" value="1"/>
<parameter key="message_greet" value="Hello |PLAYERNAME|. I buy swords, clubs, axes, helmets, boots, legs, shields and armors."/>
<parameter key="shop_sellable" value="royal helmet,2498,40000;warrior helmet,2475,6000;crusader helmet,2497,9000;crown helmet,2491,5000;devil helmet,2462,4000;mystic turban,2663,500;chain helmet,2458,35;iron helmet,2459,30;steel boots,2645,400000;boots of haste,2195,40000;golden boots,2646,100000;magic plate armor,2472,100000;dragon scale mail,2492,60000;demon armor,2494,90000;golden armor,2466,30000;crown armor,2487,20000;knight armor,2476,5000;blue robe,2656,15000;lady armor,2500,2500;plate armor,2463,400;brass armor,2465,200;chain armor,2464,100;golden legs,2470,80000;crown legs,2488,15000;knight legs,2477,6000;plate legs,2647,500;brass legs,2487,100;mastermind shield,2514,80000;demon shield,2520,40000;blessed shield,2523,150000;great shield,2522,100000;vampire shield,2534,25000;medusa shield,2536,8000;amazon shield,2537,4000;crown shield,2519,5000;tower shield,2528,4000;guardian shield,2515,200;beholder shield,2518,1500;dwarven shield,2525,100;magic longsword,2390,150000;warlord sword,2408,100000;magic sword,2400,90000;giant sword,2393,10000;bright sword,2407,6000;ice rapier,2396,4000;fire sword,2392,3000;serpent sword,2409,1500;spike sword,2383,800;two handed sword,2377,400;broad sword,2413,70;short sword,2406,30;sword,2376,25;dragon lance,2414,10000;stonecutter axe,2431,90000;guardian halberd,2427,7500;fire axe,2432,10000;knight axe,2430,2000;double axe,2387,200;halberd,2381,200;battle axe,2378,100;hatchet,2388,20;war hammer,2391,6000;thunder hammer,2421,90000;skull staff,2436,1000;dragon hammer,2434,2000;clerical mace,2423,200;battle hammer,2417,60;mace,2398,30;"/>
</parameters>
</npc>
Loot.lua code:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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
-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
keywordHandler:addKeyword({'helmets'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I buy royal (40k), warrior (6k), crusader (9k), crown (5k), devil (4k), chain (35gp) and iron helmets (30gp), also mystic turbans (500gp).'})
keywordHandler:addKeyword({'boots'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I buy golden boots (100k), steel boots (40k) and boots of haste (40k).'})
keywordHandler:addKeyword({'armors'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I buy golden (30k), crown (20k), knight (5k), lady (7,5k), plate (400gp), brass (200gp) and chain armors (100gp), also mpa (100k), dsm (60k) and blue robes (15k).'})
keywordHandler:addKeyword({'legs'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I buy golden (80k), crown (15k), knight (6k), plate (500gp) and brass legs (100gp).'})
keywordHandler:addKeyword({'shields'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I buy blessed (150k), great (100k), demon (40k), vampire (25k), medusa (8k), amazon (4k), crown (5k), tower (4k), dragon (3k), guardian (2k), beholder (1k), and dwarven shields (100gp), also mms (80k).'})
keywordHandler:addKeyword({'swords'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I buy giant (10k), bright (6k), fire (3k) serpent (1.5k), spike (800gp) and two handed swords (400gp), also ice rapiers (4k), magic longswords (150k), magic swords (90k), warlord swords (100k) broad swords (70gp), short swords (30gp), sabres (25gp) and swords (25gp).'})
keywordHandler:addKeyword({'axes'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I buy fire (10k), guardian halberds (7,5k) knight (2k), double (200gp) and battle axes (100gp), also dragon lances (10k), stonecutters axes (90k), halberds (200gp) and hatchets (20gp).'})
keywordHandler:addKeyword({'clubs'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I buy thunder hammers (90k), war (6k), dragon (2k) and battle hammers (60gp), also skull staffs (10k) and clerical maces (200gp).'})
npcHandler:addModule(FocusModule:new())
That was scripts from TFS 0.3.6. I want to paste this code:
Code:
if msgcontains(msg, 'quest') then
if getPlayerStorageValue(cid, 10002) >= -1 and getPlayerStorageValue(cid, 10002) < 2 then
if getPlayerStorageValue(cid, 10001) < 2 then
selfSay('blablablabla', cid)
talkState[talkUser] = 1
else
selfSay('You have done this quest', cid)
return TRUE
end
else
selfSay('Im waiting you end mine mission.', cid)
return TRUE
end
elseif msgcontains(msg, 'fdgdfgdfgdfg') and talkState[talkUser] == 1 then
selfSay('fgdfgfgfg', cid)
talkState[talkUser] = 2
elseif msgcontains(msg, 'fgfgfgf') and talkState[talkUser] == 2 then
selfSay('dfgdfg', cid)
talkState[talkUser] = 3
elseif msgcontains(msg, 'dfgdfgs') and talkState[talkUser] == 3 then
selfSay('fhwdfsd', cid)
talkState[talkUser] = 4
elseif msgcontains(msg, 'vxefs') and talkState[talkUser] == 4 then
selfSay('fhrykf', cid)
talkState[talkUser] = 5
elseif msgcontains(msg, 'cvb') and talkState[talkUser] == 5 then
selfSay('qwerty', cid)
doPlayerSendTextMessage(cid, 22, "Check Quest Log!")
setPlayerStorageValue(cid, 10001, 1)
setPlayerStorageValue(cid, 10002, 2)
talkState[talkUser] = 0
elseif msgcontains(msg, 'nsf') and talkState[talkUser] == 5 then
selfSay('rwcvf', cid)
talkState[talkUser] = 0
end
Regards!