Ayuda con el npc King Tibianus version 8.60 Tfs 0.3.6

Xanadu123

Member
Messages
22
Points
133
Hola, tengo un problema con el npc king Tibianus, solo me da promotion, pero me gustaría añadirle para que me dé premium. ¿Cómo puedo hacerlo? ¿Alguien podría ayudarme con este problema, por favor? Es para TFS 0.3.6 versión 8.60.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="King Tibianus" script="data/npc/scripts/King Tibianus.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="332" head="21" body="87" legs="107" feet="95" addons="0"/>
<parameters>
       <parameter key="message_greet" value="I greet thee, my loyal subject |PLAYERNAME|."/>
        <parameter key="message_farewell" value="Good bye, |PLAYERNAME|"/>
        <parameter key="message_walkaway" value="Good bye, |PLAYERNAME|" />
        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="job;king;" />
        <parameter key="keyword_reply1" value="I am your sovereign, King Tibianus III, and it's my duty to uphold justice and provide guidance for my subjects." />
         <parameter key="keyword_reply2" value="I am the king, so watch what you say!" />
    </parameters>

</npc>

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

local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to be promoted in your vocation for 20000 gold?'})
    node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20, promotion = 1, text = 'Congratulations! You are now promoted.'})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})
--[[
local node2 = keywordHandler:addKeyword({'epic'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can epicize you for 200000 gold coins. Do you want me to epicize you?'})
    node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 200000, level = 120, promotion = 2, text = 'Congratulations! You are now epicized.'})
    node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})
]]--

npcHandler:addModule(FocusModule:new())
 
Solution
me sale error en la consola bro

View attachment 5478
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, t, msg) npcHandler:onCreatureSay(cid, t, msg) end
function onThink()                  npcHandler:onThink()                  end

local PREMIUM_PRICES = {
  [30] = 60000,
  [60] = 110000
}

local function sayPrice(cid, message, keywords, parameters, node)
  local days = parameters.days
  local price = PREMIUM_PRICES[days]
  npcHandler:say(days .. " days cost " .. price .. "...
Hola, tengo un problema con el npc king Tibianus, solo me da promotion, pero me gustaría añadirle para que me dé premium. ¿Cómo puedo hacerlo? ¿Alguien podría ayudarme con este problema, por favor? Es para TFS 0.3.6 versión 8.60.

Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="King Tibianus" script="data/npc/scripts/King Tibianus.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="332" head="21" body="87" legs="107" feet="95" addons="0"/>
<parameters>
       <parameter key="message_greet" value="I greet thee, my loyal subject |PLAYERNAME|."/>
        <parameter key="message_farewell" value="Good bye, |PLAYERNAME|"/>
        <parameter key="message_walkaway" value="Good bye, |PLAYERNAME|" />
        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="job;king;" />
        <parameter key="keyword_reply1" value="I am your sovereign, King Tibianus III, and it's my duty to uphold justice and provide guidance for my subjects." />
         <parameter key="keyword_reply2" value="I am the king, so watch what you say!" />
    </parameters>

</npc>

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

local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to be promoted in your vocation for 20000 gold?'})
    node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20, promotion = 1, text = 'Congratulations! You are now promoted.'})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})
--[[
local node2 = keywordHandler:addKeyword({'epic'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can epicize you for 200000 gold coins. Do you want me to epicize you?'})
    node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 200000, level = 120, promotion = 2, text = 'Congratulations! You are now epicized.'})
    node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})
]]--

npcHandler:addModule(FocusModule:new())

Hola, creo que en las viejas se utiliza doPlayerAddPremiumDays, a verificar, no me acuerdo bien, se que en las nuevas usamos player:addPremium por ejemplo pero en caso, utiliza o busca esa palabra en tu servidor para ver si la usas.
Dile premium y haber si funciona

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, t, msg) npcHandler:onCreatureSay(cid, t, msg) end
function onThink()                  npcHandler:onThink()                  end

--- Dias / Precio
local PREMIUM_PRICES = {
  [30] = 60000,
  [60] = 110000,
}

-- Agregar premium utilizando doPlayerAddPremium
local function addPremiumAction(cid, message, keywords, parameters, node)
  local days = parameters.days
  local price = PREMIUM_PRICES[days]
  if not price then
    npcHandler:say("Something went wrong with the selected duration.", cid)
    return true
  end

  if not doPlayerRemoveMoney(cid, price) then
    npcHandler:say("You don't have enough gold. You need ".. price .." gold coins.", cid)
    return true
  end

  doPlayerAddPremiumDays(cid, days)  -- TFS 0.3.6 API
  npcHandler:say("Done! I've added ".. days .." premium days to your account.", cid)
  return true
end

local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to be promoted in your vocation for 20000 gold?'})
node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20, promotion = 1, text = 'Congratulations! You are now promoted.'})
node1:addChildKeyword({'no'},  StdModule.say,          {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})

--- Preguntar por premmy
local premiumRoot = keywordHandler:addKeyword({'premium'}, StdModule.say, {
  npcHandler = npcHandler,
  onlyFocus = true,
  text = "I can add premium days. Do you want {30} or {60} days?"
})

-- 30 Dias
local prem30 = premiumRoot:addChildKeyword({'30'}, StdModule.say, {
  npcHandler = npcHandler,
  onlyFocus = true,
  text = function(cid)
    return "30 days cost ".. PREMIUM_PRICES[30] .." gold coins. Do you want it?"
  end
})
prem30:addChildKeyword({'yes'}, addPremiumAction, {npcHandler = npcHandler, days = 30})
prem30:addChildKeyword({'no'},  StdModule.say,    {npcHandler = npcHandler, onlyFocus = true, text = "Alright, maybe next time.", reset = true})

-- 60 Dias
local prem60 = premiumRoot:addChildKeyword({'60'}, StdModule.say, {
  npcHandler = npcHandler,
  onlyFocus = true,
  text = function(cid)
    return "60 days cost ".. PREMIUM_PRICES[60] .." gold coins. Do you want it?"
  end
})
prem60:addChildKeyword({'yes'}, addPremiumAction, {npcHandler = npcHandler, days = 60})
prem60:addChildKeyword({'no'},  StdModule.say,    {npcHandler = npcHandler, onlyFocus = true, text = "Alright, maybe next time.", reset = true})

npcHandler:addModule(FocusModule:new())



Y luego para facilitar puedes agregar un texto, para que sepan que hace el npc:
Code:
<parameter key="message_greet" value="I greet thee, my loyal subject |PLAYERNAME|. Do you want a {promotion} or {premium} ?"/>
 
me sale error en la consola bro

View attachment 5478
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, t, msg) npcHandler:onCreatureSay(cid, t, msg) end
function onThink()                  npcHandler:onThink()                  end

local PREMIUM_PRICES = {
  [30] = 60000,
  [60] = 110000
}

local function sayPrice(cid, message, keywords, parameters, node)
  local days = parameters.days
  local price = PREMIUM_PRICES[days]
  npcHandler:say(days .. " days cost " .. price .. " gold coins. Do you want it?", cid)
  return true
end

local function addPremiumAction(cid, message, keywords, parameters, node)
  local days  = parameters.days
  local price = PREMIUM_PRICES[days]
  if not price then
    npcHandler:say("Something went wrong with the selected duration.", cid)
    return true
  end

  if not doPlayerRemoveMoney(cid, price) then
    npcHandler:say("You don't have enough gold. You need " .. price .. " gold coins.", cid)
    return true
  end

  doPlayerAddPremiumDays(cid, days)
  npcHandler:say("Done! I've added " .. days .. " premium days to your account.", cid)
  return true
end

local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to be promoted in your vocation for 20000 gold?'})
node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20, promotion = 1, text = 'Congratulations! You are now promoted.'})
node1:addChildKeyword({'no'},  StdModule.say,          {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})

local premiumRoot = keywordHandler:addKeyword({'premium'}, StdModule.say, {
  npcHandler = npcHandler,
  onlyFocus = true,
  text = "I can add premium days. Do you want {30} or {60} days?"
})

local prem30 = premiumRoot:addChildKeyword({'30'}, sayPrice, {npcHandler = npcHandler, days = 30})
prem30:addChildKeyword({'yes'}, addPremiumAction, {npcHandler = npcHandler, days = 30})
prem30:addChildKeyword({'no'},  StdModule.say,    {npcHandler = npcHandler, onlyFocus = true, text = "Alright, maybe next time.", reset = true})

local prem60 = premiumRoot:addChildKeyword({'60'}, sayPrice, {npcHandler = npcHandler, days = 60})
prem60:addChildKeyword({'yes'}, addPremiumAction, {npcHandler = npcHandler, days = 60})
prem60:addChildKeyword({'no'},  StdModule.say,    {npcHandler = npcHandler, onlyFocus = true, text = "Alright, maybe next time.", reset = true})

npcHandler:addModule(FocusModule:new())
 
Solution
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, t, msg) npcHandler:onCreatureSay(cid, t, msg) end
function onThink()                  npcHandler:onThink()                  end

local PREMIUM_PRICES = {
  [30] = 60000,
  [60] = 110000
}

local function sayPrice(cid, message, keywords, parameters, node)
  local days = parameters.days
  local price = PREMIUM_PRICES[days]
  npcHandler:say(days .. " days cost " .. price .. " gold coins. Do you want it?", cid)
  return true
end

local function addPremiumAction(cid, message, keywords, parameters, node)
  local days  = parameters.days
  local price = PREMIUM_PRICES[days]
  if not price then
    npcHandler:say("Something went wrong with the selected duration.", cid)
    return true
  end

  if not doPlayerRemoveMoney(cid, price) then
    npcHandler:say("You don't have enough gold. You need " .. price .. " gold coins.", cid)
    return true
  end

  doPlayerAddPremiumDays(cid, days)
  npcHandler:say("Done! I've added " .. days .. " premium days to your account.", cid)
  return true
end

local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to be promoted in your vocation for 20000 gold?'})
node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20, promotion = 1, text = 'Congratulations! You are now promoted.'})
node1:addChildKeyword({'no'},  StdModule.say,          {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})

local premiumRoot = keywordHandler:addKeyword({'premium'}, StdModule.say, {
  npcHandler = npcHandler,
  onlyFocus = true,
  text = "I can add premium days. Do you want {30} or {60} days?"
})

local prem30 = premiumRoot:addChildKeyword({'30'}, sayPrice, {npcHandler = npcHandler, days = 30})
prem30:addChildKeyword({'yes'}, addPremiumAction, {npcHandler = npcHandler, days = 30})
prem30:addChildKeyword({'no'},  StdModule.say,    {npcHandler = npcHandler, onlyFocus = true, text = "Alright, maybe next time.", reset = true})

local prem60 = premiumRoot:addChildKeyword({'60'}, sayPrice, {npcHandler = npcHandler, days = 60})
prem60:addChildKeyword({'yes'}, addPremiumAction, {npcHandler = npcHandler, days = 60})
prem60:addChildKeyword({'no'},  StdModule.say,    {npcHandler = npcHandler, onlyFocus = true, text = "Alright, maybe next time.", reset = true})

npcHandler:addModule(FocusModule:new())
ahora si me funciona al 100% lo probé gracias por todo un saludo :D
 

Tibia Server Lists

#1 FEATURED US Ultron OT 1,514 / 5,000 EXPStages PROTO8.6 ENGINEUltron OT RANK PTS6.6 -9% VOTES0 #2 FEATURED US Nefera 221 / 0 EXPx1 PROTO15.20 ENGINECrystal Server RANK PTS5.9 +26% VOTES0 #3 FEATURED CL ZHYRAVEX 10 / 500 EXPx5 PROTO10.98 ENGINETFS 1.4.2 RANK PTS4.6 +100% VOTES0 #4 FEATURED ES Deixis 0 / 0 EXPStages PROTO1098 ENGINETFS RANK PTS4.1 -59% VOTES1 #5 DE DBU Online 216 / 400 EXP11 PROTO8.6 ENGINETFS 1.0 RANK PTS6.1 +1,000% VOTES0 #6 BR Exordion Legacy 65 / 2,000 EXPx2 PROTO7.72 ENGINEExordion RANK PTS5.6 +3% VOTES0 #7 MX Marlboro War 26 / 300 EXP999 PROTO8.6 ENGINETFS 0.3.7 RANK PTS5.5 -28% VOTES0 #8 BR Tibinha YurOts 30 / 150 EXPStages PROTO7.4 ENGINEYurOTS 1.5 RANK PTS5.5 +0% VOTES0 #9 ES JustRL FreeTC 1530 33 / 250 EXPx2 PROTO15.30 ENGINECrystal Server RANK PTS5.0 +21% VOTES0 #10 US Wiki Ots 54 / 1,000 EXPx9999 PROTOcustom client ENGINETFS 1.4.2 RANK PTS5.0 +100% VOTES0 #11 PL Lubelski 13 / 1,000 EXP200 PROTO7.6 ENGINELubelskiOTS 2.56.0 RANK PTS4.9 -19% VOTES0 #12 BR Turion Server 0 / 2,000 EXPx1 PROTO7.4 ENGINETurion 7.7 Project RANK PTS4.8 +100% VOTES0 #13 PL ReWar 0 / 2,000 EXPcustom PROTO8.6 ENGINEOther RANK PTS4.6 +100% VOTES0 #14 US Halera 0 / 0 EXPStages PROTO10.98 ENGINETFS 1.4.2 RANK PTS4.4 -77% VOTES0 #15 PL Velesta 0 / 1,000 EXP20 PROTO8.0 ENGINETFS 1.4.2 RANK PTS4.4 -100% VOTES0 #16 US BerethaOnline 0 / 2,000 EXPStages PROTO15.0 ENGINETFS RANK PTS4.3 -71% VOTES0 #17 ES Farlia Global 2026 0 / 333 EXPx5 PROTO15.25 ENGINEFarliaServ 1.525 RANK PTS4.0 -100% VOTES0 #18 SE MortalisOT Custom 0 / 500 EXP100x -1.2x PROTO10.98 ENGINEMortalisOT V1 RANK PTS4.0 -100% VOTES0 #19 RU Oldavia | 8.60 0 / 0 EXPx9999 PROTO8.6 ENGINETFS 1.3 RANK PTS3.8 +100% VOTES0 #20 US Rommania 0 / 3,000 EXPstages, x10 PROTO7.4 ENGINETFS 0.4 RANK PTS3.6 -93% VOTES0 #21 MX Maeli 2 / 150 EXPx10 PROTO10.98 ENGINETFS 1.4.2 RANK PTS3.5 -33% VOTES0 #22 ES DarkDragon EXPx10 PROTO8.6 ENGINECanary RANK PTS0.0 0% VOTES0
Top