Phoenix Decion
New Member
- Joined
- Jul 28, 2008
- Messages
- 30
- Reaction score
- 0
I'm here again -.-' :/
but i need yours help!!
today i was making an npc called lugri, in tibia global he gives a wizard addon!!
i want make this too, but i find an dificulty!!
My npc:
I need put this things in npc:
My problem is when i say yes twice he returns a same msgm!
but i need yours help!!
today i was making an npc called lugri, in tibia global he gives a wizard addon!!
i want make this too, but i find an dificulty!!
My npc:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() end
npcHandler:setMessage(MESSAGE_GREET, "What do you want, |PLAYERNAME|?")
function playerBuyAddonNPC(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if (parameters.confirm ~= true) and (parameters.decline ~= true) then
if(getPlayerPremiumDays(cid) == 0) and (parameters.premium == true) then
npcHandler:say('Sorry, but this addon is only for premium players!', cid)
npcHandler:resetNpc()
return true
end
if (getPlayerStorageValue(cid, parameters.storageID) ~= -1) then
npcHandler:say('You already have this addon!', cid)
npcHandler:resetNpc()
return true
end
local itemsTable = parameters.items
local items_list = ''
if table.maxn(itemsTable) > 0 then
for i = 1, table.maxn(itemsTable) do
local item = itemsTable
items_list = items_list .. item[2] .. ' ' .. getItemNameById(item[1])
if i ~= table.maxn(itemsTable) then
items_list = items_list .. ', '
end
end
end
local text = ''
if (parameters.cost > 0) and table.maxn(parameters.items) then
text = items_list .. ' and ' .. parameters.cost .. ' gp'
elseif (parameters.cost > 0) then
text = parameters.cost .. ' gp'
elseif table.maxn(parameters.items) then
text = items_list
end
npcHandler:say('Did you bring me ' .. text .. ' for ' .. keywords[1] .. '?', cid)
return true
elseif (parameters.confirm == true) then
local addonNode = node:getParent()
local addoninfo = addonNode:getParameters()
local items_number = 0
if table.maxn(addoninfo.items) > 0 then
for i = 1, table.maxn(addoninfo.items) do
local item = addoninfo.items
if (getPlayerItemCount(cid,item[1]) >= item[2]) then
items_number = items_number + 1
end
end
end
if(getPlayerMoney(cid) >= addoninfo.cost) and (items_number == table.maxn(addoninfo.items)) then
doPlayerRemoveMoney(cid, addoninfo.cost)
if table.maxn(addoninfo.items) > 0 then
for i = 1, table.maxn(addoninfo.items) do
local item = addoninfo.items
doPlayerRemoveItem(cid,item[1],item[2])
end
end
doPlayerAddOutfit(cid, addoninfo.outfit_male, addoninfo.addon)
doPlayerAddOutfit(cid, addoninfo.outfit_female, addoninfo.addon)
setPlayerStorageValue(cid,addoninfo.storageID,1)
npcHandler:say('Here you are.', cid)
else
npcHandler:say('Good. I accept your sacrifice. You have proven that you are a true follower of Zathroth and do not hesitate to sacrificeworldly goods. Thus, I will reward you with this headgear. !', cid)
end
npcHandler:resetNpc()
return true
elseif (parameters.decline == true) then
npcHandler:say('Not interested? Maybe other addon?', cid)
npcHandler:resetNpc()
return true
end
return false
end
local noNode = KeywordNode:new({'no'}, playerBuyAddonNPC, {decline = true})
local yesNode = KeywordNode:new({'yes'}, playerBuyAddonNPC, {confirm = true})
local outfit_node = keywordHandler:addKeyword({'skull mask'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{2536,1}, {2492,1}, {2488,1}, {2123,1}}, outfit_female = 149, outfit_male = 145, addon = 2, storageID = 10023})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
local outfit_node = keywordHandler:addKeyword({'second wizard addon'}, playerBuyAddonNPC, {premium = true, cost = 0, items = {{5922,50}}, outfit_female = 149, outfit_male = 145, addon = 1, storageID = 10022})
outfit_node:addChildKeywordNode(yesNode)
outfit_node:addChildKeywordNode(noNode)
keywordHandler:addKeyword({'outfit'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'This skull shows that you are a true follower of Zathroth and the glorious gods of darkness. Are you willing to prove your loyalty?.'})
keywordHandler:addKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'It will be a hard task which requires many sacrifices. Do you still want to proceed?.'})
keywordHandler:addKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Good decision, |PLAYERNAME|. Your first sacrifice will be a medusa shield. Bring it to me and do give it happily.'})
npcHandler:addModule(FocusModule:new())
I need put this things in npc:
player: Hi
Lugri: What do you want, player?
player: Outfit
Lugri: This skull shows that you are a true follower of Zathroth and the glorious gods of darkness. Are you willing to prove your loyalty?
player: Yes
Lugri: It will be a hard task which requires many sacrifices. Do you still want to proceed?
'player: Yes
Lugri: Good decision, <name>. Your first sacrifice will be a medusa shield. Bring it to me and do give it happily.
player: Medusa shield
Lugri: Is it your true wish to sacrifice a medusa shield to Zathroth?
player: Yes
Lugri: Good. I accept your sacrifice. The second sacrifice I require from you is a dragon scale mail. Bring it to me and do give it happily.
player: Hi
Lugri: What do you want, player?
player: Dragon Scale Mail
Lugri: Is it your true wish to sacrifice a dragon scale mail to Zathroth?
player: Yes
Lugri: Good. I accept your sacrifice. The third sacrifice I require from you are crown legs. Bring them to me and do give them happily.
player: Hi
Lugri: What do you want, player?
player: Crown Legs
Lugri: Is it your true wish to sacrifice crown legs to Zathroth?
player: Yes
Lugri: Good. I accept your sacrifice. The last sacrifice I require from you is a ring of the sky. Bring it to me and do give it happily.
player: Hi
Lugri: What do you want, player?
player: Ring of the Sky
Lugri: Is it your true wish to sacrifice a ring of the sky to Zathroth?
player: Yes
Lugri: Good. I accept your sacrifice. You have proven that you are a true follower of Zathroth and do not hesitate to sacrificeworldly goods. Thus, I will reward you with this headgear.
My problem is when i say yes twice he returns a same msgm!
Last edited: