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

Simple Guild Title Module [OTCV8] [TFS 1.4.2]

Klank

Althea ¤ A New World Developer
Joined
Feb 21, 2008
Messages
1,093
Reaction score
657
Location
Norway
Greetings,

A small Guild Title module, that someone might want. Modified module made by @dewral / @Avaji, here.

It can be configured from server to set Guild Name or Guild Nick, so you don’t need to update the client to change it.
Might be a easier way of doing this, but this is how i did it.

1715110591020.png1715110598608.png


How to install:

1. Copy paste module in /modules

2. Copy paste servercode “guildTitle” into your scripts folder.

3. Modify response to either “setGuildName” or “setGuildNick”:
Lua:
local data = {
   response = "SetGuildName", -- EDIT RESPONSE HERE
   creatureId = creatureID,
   name = creature:getName(),
   guildNick = creature:getGuildNick(),
   guildName = guild:getName(),
}

4. Gucci.
 

Attachments

And I had a good idea, to generate a different color between guilds... for example, the 'Draconic' of the guild that entered the game displayed in blue, okay? And another player from the same guild 'Draconic' entered, and the color that the first player entered with was still blue, working okay? Now, if another player is not in the same guild, a different color is generated... it's working perfectly. See the small and simple gif... anyone who wants to use it, feel free :)

guild cor.gif


otclient side.
look for this line.
Lua:
function updateTitle(creatureId, guildName)
to change this.

Lua:
local guildColors = {}

function updateTitle(creatureId, guildName)
    local target = g_map.getCreatureById(creatureId)
    if target then
        local color
        if guildColors[guildName] then
            color = guildColors[guildName]
        else
            local red = math.random(0, 255)
            local green = math.random(0, 255)
            local blue = math.random(0, 255)
            color = string.format("#%02X%02X%02X", red, green, blue)
            guildColors[guildName] = color
        end
        target:setTitle(guildName, titleFont, color)
    end
end
 
Love it! Gave me an idea for my small project, thanks!
 
Hey guys im not sure i did something wrong but i have this error in my terminal

ERROR: Unable to send extended opcode 134, extended opcodes are not enabled on this server.

I use TFS 1.5 nekiro downgrade
 
Hey guys im not sure i did something wrong but i have this error in my terminal

ERROR: Unable to send extended opcode 134, extended opcodes are not enabled on this server.

I use TFS 1.5 nekiro downgrade
You need to enable extended opcode on your client. game_features -> features.lua -> function updateFeature->
g_game.enableFeature(GameExtendedOpcode)
 
You need to enable extended opcode on your client. game_features -> features.lua -> function updateFeature->
g_game.enableFeature(GameExtendedOpcode)
Hmm did that I dont get any errors now but doesnt seems to work for 1.5, 7.72.
 
Hmm did that I dont get any errors now but doesnt seems to work for 1.5, 7.72.
got the same, tfs 142 10.98, otcv8

@edit
Added some debugging to the code and (ive changed opcode to 51)

Server:
Test has logged in.
Player logged in: Test
Received extended opcode: 201
Received extended opcode: 51
JSON decode error: ...forgottenserver-1.4.2\data\scripts\guildTitle.lua:19: attempt to index global 'json' (a nil value)

Client:
requestData called for creature: Test
Sending extended opcode with data: table: 0x0f6241c8
 
Last edited:
Hmm did that I dont get any errors now but doesnt seems to work for 1.5, 7.72.
I think I've found the solution. No idea whether all steps are needed but I've done em all and it works.. so.

1716891283604.png
(yes, i know, very attractive guild name)

go to:
Tibia - [LUA] Global environment storage using JSON (https://otland.net/threads/lua-global-environment-storage-using-json.283161/)

and what I had to do is:
-> run query in your phpmyadmin (query i post is different as i couldn't use the query from the thread. had to change it a bit. )
CREATE TABLE IF NOT EXISTS json_data (
id int NOT NULL AUTO_INCREMENT,
name varchar(255) NOT NULL DEFAULT '',
data text NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB;

-> download & put globalstorage.lua into data/lib

-> add in lib.lua:
-- JSON, globalstorage
dofile('data/lib/globalstorage.lua')

-> since had lots of errors with using json.lua from the link above, I've just went to globalstorage.lua and changed this:

do
local main_path = "data/lib/json/"
local _json = require(main_path .. "json") -- # json.lua

to:
do
local main_path = "data/lib/"
local _json = require(main_path .. "dkjson") -- # json.lua
just to use the dkjson that comes with the TFS.

Then, I logged in, 0 errors in console & the guild name is there:

Server side:
Dercas has logged in.
Player logged in: Dercas
Received extended opcode: 201
Received extended opcode: 51
Decoded creature ID: 268435456
Sending guild data to player: table: 0x021c733d2520

Client side:
requestData called for creature: Deer
requestData called for creature: Dercas
Sending extended opcode with data: table: 0x109186d0
handleData called with buffer: {"creatureId":268435456,"guildNick":"","guildName":"Aaaaa","response":"SetGuildName","name":"Dercas"}
updateTitle called for creatureId: 268435456 with guildName: Aaaaa
Title updated for creatureId: 268435456


AS mentioned before... I don't know which part actually fixed the issue (possibly all steps are needed, possibly not). Gonna look into it further later but for now, i leave the 'solution' as it is. dirty.
 
Last edited:
I think I've found the solution. No idea whether all steps are needed but I've done em all and it works.. so.

View attachment 84964
(yes, i know, very attractive guild name)

go to:
Tibia - [LUA] Global environment storage using JSON (https://otland.net/threads/lua-global-environment-storage-using-json.283161/)

and what I had to do is:
-> run query in your phpmyadmin (query i post is different as i couldn't use the query from the thread. had to change it a bit. )


-> download & put globalstorage.lua into data/lib

-> add in lib.lua:


-> since had lots of errors with using json.lua from the link above, I've just went to globalstorage.lua and changed this:



to:

just to use the dkjson that comes with the TFS.

Then, I logged in, 0 errors in console & the guild name is there:

Server side:


Client side:



AS mentioned before... I don't know which part actually fixed the issue (possibly all steps are needed, possibly not). Gonna look into it further later but for now, i leave the 'solution' as it is. dirty.
Nice ill try this out soon!
 
Hmm did that I dont get any errors now but doesnt seems to work for 1.5, 7.72.
I helped some guys who have a base on TFS 1.5, Nekiro 8.6, and 7.7.2 as well.

It's a very simple process... just download the json.lua file, move it to data/lib/core, and you're done.

It depends on the TFS version that works... for example, I use TFS 1.4.3, and this directory path works perfectly for me. However, for Nekiro 1.5 and some other bases, it won't work. You need to change it to global.lua and add this... You don't need to add 'data\lib\core.lua' anymore, just global.lua and restart... Test it to see if it works well, 100%.
1716903108963.png
global.lua.
Lua:
dofile('data/lib/core/json.lua')
 
I helped some guys who have a base on TFS 1.5, Nekiro 8.6, and 7.7.2 as well.

It's a very simple process... just download the json.lua file, move it to data/lib/core, and you're done.

It depends on the TFS version that works... for example, I use TFS 1.4.3, and this directory path works perfectly for me. However, for Nekiro 1.5 and some other bases, it won't work. You need to change it to global.lua and add this... You don't need to add 'data\lib\core.lua' anymore, just global.lua and restart... Test it to see if it works well, 100%.
View attachment 84965
global.lua.
Lua:
dofile('data/lib/core/json.lua')
For mine 1.4.2 it doesn't work, just tested. Got again:

JSON decode error: ...forgottenserver-1.4.2\data\scripts\script\guildTitle.lua:19: attempt to index global 'json' (a nil value)
 
Back
Top