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

Few issues I need help with on fresh TFS

TuxStorm

New Member
Joined
Oct 18, 2015
Messages
9
Reaction score
2
I haven't played Tibia in many years, and I've never played on an Open Tibia server before this project. Last week I thought it might be fun to play again now that my kids are older and I also thought it's be cool to run our own server so we can just do our own thing. I set out to learn how to install my own server. That was easier said than done. I really never found a good single 'modern' howto. But I pieced together bits from many tutorials and after a few hours I successfully downloaded forgottenserver master (believe this to be referred to as 1.2?) from github, and compiled it on my Linux host. Then I installed ZNote AAC (is that considered the best??? Seems to not have any updates for a while but mostly works).

With the server compiled, schema.sql imported, and config.lua edited, I was able to start up the server with no errors reported.

Via ZNote, I created an account and a player without issue.

Installed the ipchanger and client 10.77, and I was successfully able to log in to the game. I felt pretty good about my progress.

Now on to the issues I need assistance with. I've done plenty of searching on these issues and found nothing yet that has helped. I successfully installed the server this past Friday, and spent Saturday and Sunday working on it on my own and trying to figure out issues before choosing to ask for help.

1 (and the most important): The game has no NPCs. The server displays no errors on start up, and there are files in the data/npc folder. Am I simply missing a configuration option somewhere to turn them on?

2: Are there still banks in Tibia? There were when I used to play. I could not find the bank in TFS or any reference to banks in data files. Maybe they don't exist anymore or are not needed??

3: Houses. The houses table in mysql had no data in it, so ZNote gave an error when trying to look at houses. I found out about the !buyhouse command and tried it and it worked, but if I stopped the server the house was no longer owned when the server was restarted. I then started manually adding data to the house table using info from the forgotten-house.xml file. Houses now started showing in ZNote along with owner. And the owner was being retained after a server restart.
My questions:
- Manually populating that table, is that correct??
- How do you pay rent without a bank? Or are houses simply owned?
- If I try use the bid feature on ZNote, it says I don't have enough coins to buy (when the player has more than enough).
- I thought dropped items in the house are safe if the server shuts down (like the depot), but if I drop items and restart the server, items are gone. Is that a bug or me just misunderstanding the houses? I remember it was cool to decorate your house with items acquired from gameplay.

Thank you in advance for any assistance helping this OT noob. And I'd be happy provide any additional details needed to help with questions.

And up to this point, I've documented all my steps so I can have a modern, complete howto to give back to the community and hopefully help others from my learnings.
 
1. Are you sure the NPCs are added in the map with a map editor?
Can you summon a NPC with a GM/GOD character using the command /s npcName?

2. Yes banks still exists in Tibia.
You can use this NPC as Bank:
https://github.com/orts/server/blob...1814d406d4cb7dcc2bf/data/npc/scripts/Naji.lua

3. When you save/close your server once the houses will be imported to the database.
(You could buy a house and save/close the server to be sure).

You can set the type of rent period in the config:
https://github.com/otland/forgottenserver/blob/master/config.lua#L41
Use never for no rent at all.

To place a bid with ZnoteAAC you need to have money on your bank account.

Do you save your server before you close it or do you just kill the process?
Do you own the house you put items in?
 
1. Are you sure the NPCs are added in the map with a map editor? [This I'm unsure of. Don't know anything about map editing yet. Need to find a tutorial about it]
Can you summon a NPC with a GM/GOD character using the command /s npcName? [Tried with GM account, nothing happened (/s npc Alice <-Correct phrasing??)]

2. Yes banks still exists in Tibia.
You can use this NPC as Bank:
https://github.com/orts/server/blob/c9ecc5319d2f394902b931814d406d4cb7dcc2bf/data/npc/scripts/Naji.lua [Thanks I will investigate this option]

3. When you save/close your server once the houses will be imported to the database. [How do you 'save' server? I am simply killing process]
(You could buy a house and save/close the server to be sure).

You can set the type of rent period in the config:
https://github.com/otland/forgottenserver/blob/master/config.lua#L41
Use never for no rent at all. [Thanks]

To place a bid with ZnoteAAC you need to have money on your bank account. [Bank related, hopefully will resolve itself when I figure out the banks thing. Thanks]

Do you save your server before you close it or do you just kill the process? [Not sure how to 'save' server. I've been terminating the process]
Do you own the house you put items in? [Yes, player is listed as owner]
 
1. Are you sure the NPCs are added in the map with a map editor? [This I'm unsure of. Don't know anything about map editing yet. Need to find a tutorial about it]
Can you summon a NPC with a GM/GOD character using the command /s npcName? [Tried with GM account, nothing happened (/s npc Alice <-Correct phrasing??)]

2. Yes banks still exists in Tibia.
You can use this NPC as Bank:
https://github.com/orts/server/blob/c9ecc5319d2f394902b931814d406d4cb7dcc2bf/data/npc/scripts/Naji.lua [Thanks I will investigate this option]

3. When you save/close your server once the houses will be imported to the database. [How do you 'save' server? I am simply killing process]
(You could buy a house and save/close the server to be sure).

You can set the type of rent period in the config:
https://github.com/otland/forgottenserver/blob/master/config.lua#L41
Use never for no rent at all. [Thanks]

To place a bid with ZnoteAAC you need to have money on your bank account. [Bank related, hopefully will resolve itself when I figure out the banks thing. Thanks]

Do you save your server before you close it or do you just kill the process? [Not sure how to 'save' server. I've been terminating the process]
Do you own the house you put items in? [Yes, player is listed as owner]
1.
You use it like this "/s Alice"
 
1. Are you sure the NPCs are added in the map with a map editor? [This I'm unsure of. Don't know anything about map editing yet. Need to find a tutorial about it]
Can you summon a NPC with a GM/GOD character using the command /s npcName? [Tried with GM account, nothing happened (/s npc Alice <-Correct phrasing??)]
The command should look like this:
Code:
/s Alice

3. When you save/close your server once the houses will be imported to the database. [How do you 'save' server? I am simply killing process]
(You could buy a house and save/close the server to be sure).
This command kicks all players and saves the server correctly before shutting down, killing the process isn't a way to go since that just kills everything.
Code:
/closeserver shutdown


You could also add a new script/talkaction like /save to save everything.
Edit the talkactions.xml inside talkactions and add this:
Code:
<talkaction words="/save" script="save.lua" />

Create a file called save.lua with this code inside talkactions/scripts.
Code:
local savingEvent = 0

function onSay(player, words, param)
    if player:getGroup():getAccess() then
        if isNumber(param) then
            stopEvent(savingEvent)
            save(tonumber(param) * 60 * 1000)
        else
            saveServer()
        end
    end
end

function save(delay)
    saveServer()
    if delay > 0 then
        savingEvent = addEvent(save, delay, delay)
    end
end


Do you save your server before you close it or do you just kill the process? [Not sure how to 'save' server. I've been terminating the process]
Do you own the house you put items in? [Yes, player is listed as owner]
Test the save command I posted futher up in my post and it should work just fine!
 
The command should look like this:
Code:
/s Alice
This didn't seem to do anything. (Issued by a player that has GM powers, right?)

This command kicks all players and saves the server correctly before shutting down, killing the process isn't a way to go since that just kills everything.
Code:
/closeserver shutdown
I tried this command from my GM player and nothing happened. No message was broadcast, server stayed online.

You could also add a new script/talkaction like /save to save everything.
Edit the talkactions.xml inside talkactions and add this:
Code:
<talkaction words="/save" script="save.lua" />

Create a file called save.lua with this code inside talkactions/scripts.
Code:
local savingEvent = 0

function onSay(player, words, param)
    if player:getGroup():getAccess() then
        if isNumber(param) then
            stopEvent(savingEvent)
            save(tonumber(param) * 60 * 1000)
        else
            saveServer()
        end
    end
end

function save(delay)
    saveServer()
    if delay > 0 then
        savingEvent = addEvent(save, delay, delay)
    end
end



Test the save command I posted futher up in my post and it should work just fine!

Created this and used with GM player and nothing seemed to happen.
 
Sounds like your character and/or account does not have the appropriate privileges. Look in your database and see if your account has 'type' 6 and that the character has 'group_id' 3.
The website creates the accounts and characters without administrative privileges and you have to manually change it to give yourself access.
 
Sounds like your character and/or account does not have the appropriate privileges. Look in your database and see if your account has 'type' 6 and that the character has 'group_id' 3.
The website creates the accounts and characters without administrative privileges and you have to manually change it to give yourself access.
Thanks! Some progress being made now. Didn't know about the Type entry for the account. I changed it to 6 and then the player is set to group id 3.

Now I when I type /s Alice, an NPC appears. And when I issued /closeserver shutdown, it kicked me out the game. The /save didn't do anything and produced this error at the console:
Code:
Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/save.lua:onSay
data/talkactions/scripts/save.lua:5: attempt to call global 'isNumber' (a nil value)
stack traceback:
  [C]: in function 'isNumber'
  data/talkactions/scripts/save.lua:5: in function <data/talkactions/scripts/save.lua:3>
 
You can replace
if isNumber(param) then
with
if tonumber(param) ~= nil then

Or add this in data/global.lua:
Code:
function isNumber(str)
    return tonumber(str) ~= nil
end
 
You can replace
if isNumber(param) then
with
if tonumber(param) ~= nil then

Or add this in data/global.lua:
Code:
function isNumber(str)
    return tonumber(str) ~= nil
end

That worked! Thank you
Code:
tibiaadmin@ot:~/tfs$ GM has logged in.
Saving server...
> Saved house items in: 0.011 s
 
2. Yes banks still exists in Tibia.
You can use this NPC as Bank:
https://github.com/orts/server/blob...1814d406d4cb7dcc2bf/data/npc/scripts/Naji.lua

I've added Naji NPC but when I try to call it with my GM
Code:
/s Naji
I get a message on the screen that says "There is not enough room"

Also, this is displayed on the console:
Code:
Lua Script Error: [Npc interface]
data/npc/scripts/Naji.lua
data/npc/scripts/Naji.lua:14: attempt to index global 'VoiceModule' (a nil value)
stack traceback:
  [C]: in function '__index'
  data/npc/scripts/Naji.lua:14: in main chunk
  [C]: in function 'createNpc'
  data/talkactions/scripts/place_npc.lua:11: in function <data/talkactions/scripts/place_npc.lua:1>
[Warning - NpcScript::NpcScript] Can not load script: Naji.lua
 
Last edited:
I've added Naji NPC but when I try to call it with my GM
Code:
/s Naji
I get a message on the screen that says "There is not enough room"

Also, this is displayed on the console:
Code:
Lua Script Error: [Npc interface]
data/npc/scripts/Naji.lua
data/npc/scripts/Naji.lua:14: attempt to index global 'VoiceModule' (a nil value)
stack traceback:
  [C]: in function '__index'
  data/npc/scripts/Naji.lua:14: in main chunk
  [C]: in function 'createNpc'
  data/talkactions/scripts/place_npc.lua:11: in function <data/talkactions/scripts/place_npc.lua:1>
[Warning - NpcScript::NpcScript] Can not load script: Naji.lua
Either remove this lines from Naji:
Code:
local voices = { {text = 'It\'s a wise idea to store your money in your bank account.'} }
npcHandler:addModule(VoiceModule:new(voices))

Create a new file and name it ex; custom.lua and place it in npc/lib/npcsystem and add this:
Code:
-- VoiceModule
VoiceModule = {
    voices = nil,
    voiceCount = 0,
    lastVoice = 0,
    timeout = nil,
    chance = nil,
    npcHandler = nil
}

-- Creates a new instance of VoiceModule
function VoiceModule:new(voices, timeout, chance)
    local obj = {}
    setmetatable(obj, self)
    self.__index = self

    obj.voices = voices
    for i = 1, #obj.voices do
        local voice = obj.voices[i]
        if voice.yell then
            voice.yell = nil
            voice.talktype = TALKTYPE_YELL
        else
            voice.talktype = TALKTYPE_SAY
        end
    end

    obj.voiceCount = #voices
    obj.timeout = timeout or 10
    obj.chance = chance or 25
    return obj
end

function VoiceModule:init(handler)
    return true
end

function VoiceModule:callbackOnThink()
    if self.lastVoice < os.time() then
        self.lastVoice = os.time() + self.timeout
        if math.random(100) < self.chance  then
            local voice = self.voices[math.random(self.voiceCount)]
            Npc():say(voice.text, voice.talktype)
        end
    end
    return true
end

Open the file npc.lua inside npc/lib and add this line under the first dofile line at the top of the file:
Code:
dofile('data/npc/lib/npcsystem/custom.lua')
 
These are the same errors I have been getting. Even after trying HalfAway's method above, I still get the same errors. It almost seems like there is an issue within the Voice Module script. If I remove that script, the NPCs will spawn, and they WILL trade, but they will not talk to the player in Default or NPC windows.

When I talk to the NPCs I get the console error that : attempt to call global 'getTibianTime' a nil vaule
 
Just thought I'd post quick update on where I stand with my issues.

First, thank you to forgee, HalfAway, Tarek1337 and Codex NG for help and assistance!

I'm happy with progress made and my server is in better shape thanks to above help.

While NPC's still aren't on map by when server starts, I can bring them in game with GM. (bandaid for now)

Got Naji working, but here's what I did (maybe wrong thing to do?). I renamed my current data folder, which came from here https://github.com/otland/forgottenserver and instead used the data folder from this source https://github.com/orts/server

I am still using the world folder from the original install (forgotten.otbm).

My current challenge is figuring the map editing stuff. Seems to be difficult to find right version of rme map editor to use with my map. Every one I've downloaded so far gives errors when opening the map file, but I will keep trying.
 

Similar threads

Back
Top