• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

tfs 1.0 Npc repair

zxzxzx

New Member
Joined
Mar 12, 2011
Messages
334
Reaction score
3
Hello I need repair my old npc scripts, this scripts not working on new tfs 1.0 (10.31)


First script is the ring repair not for gold but for some itm
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local config = {
    token = {2258, 1},
    reward = {7697, 100}
}

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 creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    elseif msgcontains(msg, "physical ring") then
        selfSay("Czy chcesz naprawic zuzyty Physical Ring?", cid)
        talkState[cid] = 1
    elseif talkState[cid] == 1 and msgcontains(msg, "yes") then
        if doPlayerRemoveItem(cid, unpack(config.token)) then
            selfSay("Prosze oto twoj nowy pierscien!.", cid)
            doPlayerAddItem(cid, unpack(config.reward))
        else
            selfSay("Nie masz potrzebnych czesci!...", cid)
        end
        talkState[cid] = nil
    end
    return true
end

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


Next script is the promotion script (player gets promotion when paid 2cc)
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 onPlayerEndTrade(cid)                npcHandler:onPlayerEndTrade(cid)            end
function onPlayerCloseChannel(cid)            npcHandler:onPlayerCloseChannel(cid)        end

local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you for 20000 gold coins. Do you want me to promote you?'})
    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())


if someone is a would like help I will be grateful to him rep+
 
1 npc:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

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 creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    local player = Player(cid)

    if msgcontains(msg, "physical ring") then
        npcHandler:say("Czy chcesz naprawic zuzyty Physical Ring?", cid)
        talkState[talkUser] = 1
    elseif talkState[talkUser] == 1 and msgcontains(msg, "yes") then
        if player:removeItem(2258, 1) then
            npcHandler:say("Prosze oto twoj nowy pierscien!.", cid)
            player:addItem(7697, 100)
        else
            npcHandler:say("Nie masz potrzebnych czesci!...", cid)
        end
        talkState[talkUser] = nil
    end

    return true
end

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

What is wrong with this 2 npc?
 
Last edited:
Back
Top