• 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!

Lua I need an NPC (in TFS 1.4) who sell Soul Points for money.

Nyarl666

Member
Joined
Sep 25, 2022
Messages
63
Reaction score
8
Hi.
I need an NPC (in TFS 1.4) who sell Soul Points for money. 10 Soul Points for 500 gp.
Thank you.
 
Solution
Lua:
local talkState = {}
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 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 =...
Lua:
local talkState = {}
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 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, 'soul')) then
        if player:getMoney() > 500 then
            selfSay('do you want to buy 10 soul points for 500 gp?', cid)
            talkState[talkUser] = 1
        else
            selfSay('sorry you need atleast 500 gps.', cid)
            talkState[talkUser] = 0
        end
        elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
            if player:getMoney() > 500 then
                player:removeMoney(500)
                player:addSoul(soulChange)
                selfSay('You have bought 10 soul points.', cid)
                talkState[talkUser] = 0
            else
                selfSay('sorry you need atleast 500 gps.', cid)
            end
        end     
        return false
    end

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

how it works

hi
soul
yes

done
 
Solution
Lua:
local talkState = {}
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 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, 'soul')) then
        if player:getMoney() > 500 then
            selfSay('do you want to buy 10 soul points for 500 gp?', cid)
            talkState[talkUser] = 1
        else
            selfSay('sorry you need atleast 500 gps.', cid)
            talkState[talkUser] = 0
        end
        elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
            if player:getMoney() > 500 then
                player:removeMoney(500)
                player:addSoul(soulChange)
                selfSay('You have bought 10 soul points.', cid)
                talkState[talkUser] = 0
            else
                selfSay('sorry you need atleast 500 gps.', cid)
            end
        end    
        return false
    end

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

how it works

hi
soul
yes

done
Dont add soul points :( Take money but dont add... I till have 5.
 
player:addSoul(soulChange)

to

player:addSoul(10)
Works! Thank you very much :)
Post automatically merged:

player:addSoul(soulChange)

to

player:addSoul(10)
And I have one more question. What a command to buy premium points for money from game not for real money?
I try to make this same NPC but sell premium points and sell this points without premium account of course. Like in Gesior ACC but not for real money. And an example NPC that sells something for premium points, something, a ring, shields, indifferent. Thank you!
 
Last edited:
Back
Top