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

problem to save outfits - C++? lua script? storageValue?

dropz

Member
Joined
May 4, 2022
Messages
46
Reaction score
24
hello everyone!

well, im facing a problem after added addon/outfits.xml feature inside a TFS 1.2 Nostalrius (old protocol).
the point is, when i try add a new outfit using a script lua in actions for example, for the player use a item and get the outfit its running okay until i logout. if the player that get the outfit logout when log in again the earned outfit is gone.

here's a gif that shows whats going on:
Peek 2022-12-01 13-59.gif
in the example i use a three different items with 3 different ids that each one gives a different outfit (slayer, archer and wizz)..

when i use them the outfits shows in the "set outfit" panel, but after relog they gone.


i'm using a lua script that there i deal with the storageValues and the function of player:addOutfit(looktype), tried a lot of different forms to declare the functions and use the script, but without solution for it..

i'm thinking about if im forgot something at src side that letting a conflict happens or something like that...

before i was having a problem even to show the outfits on outfit panel, that was solved when i used a specific lua script for the action and now the outfits appearing in the panel but unfortunately it don't save.

here's my outfit.xml for this outfits:

XML:
    <outfit type="1" looktype="137" name="Slayer" premium="no" unlocked="no" enabled="yes" />
    <outfit type="1" looktype="138" name="Archer" premium="yes" unlocked="no" enabled="yes" />
    <outfit type="1" looktype="139" name="Wizzard" premium="yes" unlocked="no" enabled="yes" />


and here's my action lua script to use the item:

Lua:
local outfits =
{
    [5098] = {outfitStorage = 1006, name = "Slayer", looktype = 137},
    [5099] = {outfitStorage = 1007, name = "Archer", looktype = 138},
    [5100] = {outfitStorage = 1008, name = "Wizzard", looktype = 139}
}
 

function onUse(player, item, fromPosition, target, toPosition)
    local itemId = item:getId()
    local outfit = outfits[itemId]
    if outfit then      
        if player:getStorageValue(outfit.outfitStorage) > 0 then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "You have already unlocked this outfit.")
            return true
        else
            player:setStorageValue(outfit.outfitStorage, 1)
            player:addOutfit(outfit.looktype)
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "You have unlocked the " .. outfit.name .. " outfit.")
            player:getPosition():sendMagicEffect(14)
            item:remove(1)
            return true
        end
    end  
    return false
end
obs: yes, tried use another function like "player:addOutfitAddon(looktype, addon); player:canWearOutfit(looktype, addon)" but without different results.

do you guys have a idea about whats going on here?
and for sure, if necessary i post here the src code about outfits(protocolgame.cpp, player.cpp and other ones).

thanks in advance!
Post automatically merged:

has a way to activate in the engine a debug function that logs all the actions inside the server?
like if i use a item, shows whats happened with that action.. i think this could help in this case.

i ask it because currently i didnt receive any log when i use the items, receive the outfits and then they not save.
 
Last edited:
Back
Top