gameover99097
Banned User
- Joined
- Nov 19, 2010
- Messages
- 270
- Reaction score
- 4
Elo , bawię się i bawię i nie mogę tego ogarnąć ; d
Słabo znam lua więc tak chce zrobić npc Yaman (djin) ktory funkcjonuje jak na rl.
Npc nie odpowiada wgl nawet na "hi"
Słabo znam lua więc tak chce zrobić npc Yaman (djin) ktory funkcjonuje jak na rl.
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
function wing(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if getPlayerItemCount(cid, 2195) >= 1 then
doPlayerRemoveItem(cid, 2195, 1)
doPlayerAddItem(cid, 5891, 1)
selfSay('Here is your item!', cid)
return true
else
selfSay('You don\'t have all items or cash!', cid)
end
end
function flask(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if getPlayerItemCount(cid, 2475) >= 4 then
doPlayerRemoveItem(cid, 2475, 4)
doPlayerAddItem(cid, 5885, 1)
selfSay('Here is your item!', cid)
return true
else
selfSay('You don\'t have these items!', cid)
end
end
function sulphur(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if getPlayerItemCount(cid, 2392) >= 3 then
doPlayerRemoveItem(cid, 2392, 3)
doPlayerAddItem(cid, 5904, 1)
selfSay('Here is your item!', cid)
return true
else
selfSay('You don\'t have these items!', cid)
end
end
function spirit(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if getPlayerItemCount(cid, 2498) >= 2 then
doPlayerRemoveItem(cid, 2498, 2)
doPlayerAddItem(cid, 5884, 1)
selfSay('Here is your item!', cid)
return true
else
selfSay('You don\'t have these items!', cid)
end
end
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can make Warrior's Sweat, Magic Sulphur, Enchanted chicken wings and Fighting spirit!"})
local node1 = keywordHandler:addKeyword('sweat'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade 4x Warrior helmets for a Warrior\'s sweat?'})
node1:addChildKeyword({'yes'}, flask, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
local node2 = keywordHandler:addKeyword({'sulphur'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade 3x Fire swords for a Magic sulphur?'})
node2:addChildKeyword({'yes'}, sulphur, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
local node3 = keywordHandler:addKeyword({'wing'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade a Boots of haste for an Enchanted chicken wing?'})
node3:addChildKeyword({'yes'}, wing, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
local node4 = keywordHandler:addKeyword({'spirit'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to trade 2x Royal helmets for a Fighting spirit?'})
node4:addChildKeyword({'yes'}, spirit, {npcHandler = npcHandler, onlyFocus = true, reset = true})
node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the neccessary items.', reset = true})
npcHandler:addModule(FocusModule:new())
Npc nie odpowiada wgl nawet na "hi"