Reload sprites after re-log

Cesrarr

Member
Joined
Oct 3, 2018
Messages
34
Best answers
0
Reaction score
5
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?
 

Summ

(\/)(;,,;)(\/) Y not?
Staff member
Global Moderator
Joined
Oct 15, 2008
Messages
4,160
Best answers
9
Reaction score
1,010
Location
Germany :O
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 })
 
OP
Cesrarr

Cesrarr

Member
Joined
Oct 3, 2018
Messages
34
Best answers
0
Reaction score
5
@Summ
The function g_sprites.loadSpr only work one time, second time dont reload
 

Gesior.pl

Mega Noob&LOL 2012
Joined
Sep 18, 2007
Messages
2,033
Best answers
19
Reaction score
1,089
Location
PLand
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:

Gesior.pl

Mega Noob&LOL 2012
Joined
Sep 18, 2007
Messages
2,033
Best answers
19
Reaction score
1,089
Location
PLand
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:
OP
Cesrarr

Cesrarr

Member
Joined
Oct 3, 2018
Messages
34
Best answers
0
Reaction score
5
@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:
OP
Cesrarr

Cesrarr

Member
Joined
Oct 3, 2018
Messages
34
Best answers
0
Reaction score
5
@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

Mega Noob&LOL 2012
Joined
Sep 18, 2007
Messages
2,033
Best answers
19
Reaction score
1,089
Location
PLand
@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?
 

Fresh

Quack!
Joined
Oct 21, 2009
Messages
1,587
Best answers
10
Reaction score
180
Location
Poland
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.
 
OP
Cesrarr

Cesrarr

Member
Joined
Oct 3, 2018
Messages
34
Best answers
0
Reaction score
5
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.
 

Gesior.pl

Mega Noob&LOL 2012
Joined
Sep 18, 2007
Messages
2,033
Best answers
19
Reaction score
1,089
Location
PLand
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.
 
Top