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

NPC [TFS 1.3] TestServer Assistant

E

Evil Puncker

Guest
Hello everyone, just a small and simple NPC based on the idea from this thread, CIPSoft, and trying to help this thread.

Enjoy it while it breaks apart šŸ˜ (yeah the blessing part was removed since the check was never working and I don't know why)

gJiPdrC.gif



What the NPC does:
  • Give 10 crystal coins to player (unlimited)
  • Give 50.000.000 experience to player (until lvl 350 only)


Install:
/*/data/npc create
Testserver Assistant.xml and add:​
XML:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Testserver Assistant" script="Testserver Assistant.lua" walkinterval="0" floorchange="0" speechbubble="2">
    <health now="100" max="100" />
    <look type="134" head="127" body="103" legs="41" feet="89" addons="1" mount="0" />
</npc>

/*/data/npc/scripts create Testserver Assistant.lua and add:​
Lua:
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 player = Player(cid)

    if msgcontains(msg, "money") or msgcontains(msg, "gold") then
        selfSay("Enjoy your money.", cid)
        player:addItem(2160, 10)
        return
    end

    if msgcontains(msg, "exp") then
        if player:getLevel() >= 350 then
            selfSay("You can not take it anymore.", cid)
        else
            selfSay("Here you are.", cid)
            player:addExperience(50000000)
        end
        return
    end

    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_GREET, "Hey |PLAYERNAME|. I'm Testserver Assistant and I can give {money} and {experience} which will be useful for testing on " .. configManager.getString(configKeys.SERVER_NAME) .. " server.")

npcHandler:addModule(FocusModule:new())

If you have any issue or suggestion, feel free to say so!
 
It's better practice to return true if what you're doing is successful, that way the NPC updates idle status.
 
Hello everyone, just a small and simple NPC based on the idea from this thread, CIPSoft, and trying to help this thread.

Enjoy it while it breaks apart šŸ˜ (yeah the blessing part was removed since the check was never working and I don't know why)

gJiPdrC.gif



What the NPC does:
  • Give 10 crystal coins to player (unlimited)
  • Give 50.000.000 experience to player (until lvl 350 only)


Install:
/*/data/npc create
Testserver Assistant.xml and add:​
XML:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Testserver Assistant" script="Testserver Assistant.lua" walkinterval="0" floorchange="0" speechbubble="2">
    <health now="100" max="100" />
    <look type="134" head="127" body="103" legs="41" feet="89" addons="1" mount="0" />
</npc>

/*/data/npc/scripts create Testserver Assistant.lua and add:​
Lua:
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 player = Player(cid)

    if msgcontains(msg, "money") or msgcontains(msg, "gold") then
        selfSay("Enjoy your money.", cid)
        player:addItem(2160, 10)
        return
    end

    if msgcontains(msg, "exp") then
        if player:getLevel() >= 350 then
            selfSay("You can not take it anymore.", cid)
        else
            selfSay("Here you are.", cid)
            player:addExperience(50000000)
        end
        return
    end

    return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:setMessage(MESSAGE_GREET, "Hey |PLAYERNAME|. I'm Testserver Assistant and I can give {money} and {experience} which will be useful for testing on " .. configManager.getString(configKeys.SERVER_NAME) .. " server.")

npcHandler:addModule(FocusModule:new())

If you have any issue or suggestion, feel free to say so!
Is it possible to make this npc reset a char back to default stats of level 8?
 
Very nice stuff. I like it.

If you ever plan on improving it or adding on something like adding skill levels could also be cool or the npc can give you any item. Depends how far really someone would want to take a "testing" phase to.

But it's cool. I guess it would really help testing on a high rate server :p
 
Hello! Very good NPC.
How to make him get the money only once?
Here you can't take more if you have 10K with you. But if you throw it in, you can keep going.
I'm just learning and I can't do what I am asking :(

XML:
function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end

    local player = Player(cid)

    if msgcontains(msg, "yes") then
        if player:getMoney() >= 100000 then
        selfSay("You can not take it anymore.", cid)
        else
        selfSay("Enjoy game.", cid)
        player:addItem(2160, 10)
        end
        return
    end

    return true
end
 
Last edited:
Back
Top