• Vote in September Mapping Competition to select a winner!
  • 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

Evil Puncker

its just a flu
TFS Developer
Joined
May 30, 2009
Messages
6,955
Best answers
119
Reaction score
2,558
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)




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!
 

Infernum

Support Team
Joined
Feb 14, 2015
Messages
5,582
Best answers
556
Reaction score
3,493
It's better practice to return true if what you're doing is successful, that way the NPC updates idle status.
 

MopdaAll

New Member
Joined
May 29, 2020
Messages
26
Best answers
0
Reaction score
1
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)




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?
 

FenX

Well-Known Member
Joined
Jul 8, 2019
Messages
267
Best answers
0
Reaction score
88
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
 
Top