Jump to content
  • 0
Sign in to follow this  
lazarus

Scripting TFS 1.2 Npc Aldo

Question

lazarus

Antes de fazer a sua pergunta, tenha certeza de ter lido as regras da seção e o guia abaixo:

https://forums.otserv.com.br/index.php?/forums/topic/168583-regras-da-seção/

https://forums.otserv.com.br/index.php?/forums/topic/165121-como-fazer-uma-pergunta-ou-o-grande-guia-do-usuário-com-dúvidas/

Descreva em algumas palavras a base utilizada. (Nome do servidor / Nome do cliente / Nome do website / etc.).

 

Base:

The Forgotten Server 1.2, Versão: 10.98.

Qual é a sua pergunta?

Alguém sabe por que esse erro está acontecendo quando eu compro um item deste npc?

 

Você tem o código disponível? Se tiver poste-o na caixa de código que está dentro do spoiler abaixo:

Os aquivos são estes que uso.

Spoiler


<?xml version="1.0" encoding="UTF-8"?>
<npc name="Aldo" script="Aldo.lua" walkinterval="2000" floorchange="0">
    <health now="100" max="100" />
    <look type="128" head="40" body="37" legs="116" feet="95" addons="0" />
    <parameters>
        <parameter key="message_greet" value="Just great, another ... 'customer'. Hello, |PLAYERNAME|. If you want to trade, let's get it over with." />
        <parameter key="message_farewell" value="That's music in my ears." />
        <parameter key="message_walkaway" value="Yeah, get lost." />
        <parameter key="message_onsendtrade" value="Yeah, buy something." />
        <parameter key="module_shop" value="1" />
        <parameter key="shop_buyable" value="            Brass Helmet,2460,120;            Brass Legs,2478,195;            Chain Helmet,2458,52;            Chain Legs,2648,80;            Iron Helmet,2459,390;            Leather Boots,2643,10;            Leather Helmet,2461,12;            Leather Legs,2649,10;            Sandals,2642,2;            Soldier Helmet,2481,110;            Steel Helmet,2457,580;            Studded Helmet,2482,63;            Studded Legs,2468,50;            Viking Helmet,2473,265        " />
        <parameter key="shop_sellable" value="            Brass Helmet,2460,30;            Brass Legs,2478,49;            Chain Helmet,2458,17;            Chain Legs,2648,25;            Iron Helmet,2459,150;            Leather Boots,2643,2;            Leather Helmet,2461,4;            Leather Legs,2649,9;            Legion Helmet,2480,22;            Plate Legs,2647,115;            Small Axe,2559,5;            Soldier Helmet,2481,16;            Steel Helmet,2457,293;            Studded Helmet,2482,20;            Studded Legs,2468,15;            Viking Helmet,2473,66        " />
    </parameters>
</npc>

 

e este outro, 

 

 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 function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end
    local player = Player(cid)
    if isInArray({"soft boots", "repair", "soft", "boots"}, msg) then
        npcHandler:say("Do you want to repair your worn soft boots for 10000 gold coins?", cid)
        npcHandler.topic[cid] = 1
    elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
        npcHandler.topic[cid] = 0
        if player:getItemCount(10021) == 0 then
            npcHandler:say("Sorry, you don't have the item.", cid)
            return true
        end

        if not player:removeMoney(10000) then
            npcHandler:say("Sorry, you don't have enough gold.", cid)
            return true
        end

        player:removeItem(10021, 1)
        player:addItem(6132, 1)
        npcHandler:say("Here you are.", cid)
    elseif msgcontains(msg, 'no') and npcHandler.topic[cid] == 1 then
        npcHandler.topic[cid] = 0
        npcHandler:say("Ok then.", cid)
        
    
    end
    
    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, anexe-a dentro do spoiler abaixo:

Spoiler

Hidden Content

    Sign In here or Sign Up here to see this hidden content.
 

 

Edited by lazarus

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 1
Majesty

Em seu servidor, as funções descritas nos erros estão faltando.

Segue abaixo, as libs para npc do TFS 1.2:

Hidden Content

    Sign In here or Sign Up here to see this hidden content.

Hidden Content

    Sign In here or Sign Up here to see this hidden content.

Hidden Content

    Sign In here or Sign Up here to see this hidden content.

Hidden Content

    Sign In here or Sign Up here to see this hidden content.

Hidden Content

    Sign In here or Sign Up here to see this hidden content.

Consulte os arquivos, verifique e adicione as funções que faltam.

Share this post


Link to post
Share on other sites
  • 0
lazarus

Eu Tentei substituir todos esses aquivos porem deu o mesmo erro.

Percebi que tinha uma pasta com nome antigo na source do meu servidor. Peguei o substitui todos, deu uns erro de fechamento  de função mais consegui resolver.

Obrigado pela ajuda Majesty foi de grande avalia.

Rep+

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×