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

Reload sprites after re-log

Cesrarr

Member
Joined
Oct 3, 2018
Messages
34
Reaction score
7
Was searching on otclient sources, a way to make otclient reload sprites after an compilation, then instead need reopen the client each time compiled any new sprite, will just need re-log our char.

Code:
g_sprites.loadSpr(sprPath)

Do someone know how do it?
 
Solution
Tfs 1.0
The point is to test sprite design and not to generate new server items, don't be so stupid please.
To make talkaction you need LUA function from TFS 1.1:
PHP:
itemType:getClientId()
otland/forgottenserver

With new LUA function you can add talkaction (it's for TFS 1.0):
PHP:
function onSay(cid, words, param)
    local player = Player(cid)
    if not player:getGroup():getAccess() then
        return true
    end

    if player:getAccountType() < ACCOUNT_TYPE_GOD then
        return false
    end

    local itemClientId = tonumber(param)

    -- now do something stupid, iterate over all items to find item by client id:)
    for itemId = 1, 30000 do
        local itemType = ItemType(itemId)
        if...
Currently the sprites are loaded whenever you change the client version (edubart/otclient). If you use a module that automatically changes the IP and client version to those of your server, then this usually only happens once.
You can create a new module and load the sprites when the player logs in by connecting that process to the onGameStart callback.
I am not sure if that would cause any issues, but I guess you will see if it does.

Lua:
connect(g_game, { onGameStart = your_function_that_reloads_the_sprites })
 
I will check it tommorow. There are some caches and one of them must be not cleared, when you try to load again same sprites/client version.

EDIT:
Try to reload .dat file/set client version to some other and again to yours.
'Texture's (generated from .spr) are cached in 'Thing's which are generated from .dat:
edubart/otclient
 
Last edited:
Tested (you can paste 2 commands in 1 line to OTC Terminal):
PHP:
g_sprites.loadSpr('/things/860/Tibia') g_things.loadDat('/things/860/Tibia')
RELOADs sprites without relog. Textures just replace in game, while you are logged!
I think it will make your custom spirites development much faster :)

You can add it to 'login' event like Summ said. Then it will reload sprites every relog. I think it will be even faster then executing it in Terminal.
 
Last edited:
@Gesior.pl
EDIT:
Your code:
g_sprites.loadSpr('/things/1041/Tibia') g_sprites.loadDat('/things/1041/Tibia')

It is:
g_sprites.loadSpr('/things/1041/Tibia') g_things.loadDat('/things/1041/Tibia')

Anyway, thank you for the help !!!
 
Last edited:
@Gesior.pl would be even better if could be possible use adm command /i to create items using client id instead server id.

Each time ill create a item i need go in map or item editor to search what the server id

a.png

Do someone have any idea to make it easier/faster?
 
Last edited:
@Gesior.pl would be even better if could be possible use adm command /i to create items using client id instead server id.

Each time ill create a item i need go in map or item editor to search what the server id

View attachment 33217


Do someone have any idea to make it easier/faster?
What OTS engine? TFS 1.3?
 
It's not a big deal to generate new items and put them into map editor and go to Others tab to check their ID's.
Stop being lazy as f^ck. It's useless command to create item with clientid.
 
What OTS engine? TFS 1.3?
Tfs 1.0

It's not a big deal to generate new items and put them into map editor and go to Others tab to check their ID's.
Stop being lazy as f^ck. It's useless command to create item with clientid.
The point is to test sprite design and not to generate new server items, don't be so stupid please.
 
Tfs 1.0
The point is to test sprite design and not to generate new server items, don't be so stupid please.
To make talkaction you need LUA function from TFS 1.1:
PHP:
itemType:getClientId()
otland/forgottenserver

With new LUA function you can add talkaction (it's for TFS 1.0):
PHP:
function onSay(cid, words, param)
    local player = Player(cid)
    if not player:getGroup():getAccess() then
        return true
    end

    if player:getAccountType() < ACCOUNT_TYPE_GOD then
        return false
    end

    local itemClientId = tonumber(param)

    -- now do something stupid, iterate over all items to find item by client id:)
    for itemId = 1, 30000 do
        local itemType = ItemType(itemId)
        if itemType:getClientId() and itemType:getClientId() == itemClientId then
            player:addItem(itemType:getId(), 1)
            player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
            return true
        end
    end
   
    player:sendCancelMessage("Item with client ID " .. itemClientId .. " not found.")
    return false
end
It will add item to player EQ/backpack or drop on ground, when it's not possible to pick this kind of item.
 
Solution
Back
Top