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

TFS 1.X+ Vial and jugs not working.

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
1,492
Solutions
27
Reaction score
858
Location
Santiago - Chile
GitHub
ralke23
Twitch
ralke23
Hi! I use Nekiro downgrade 8.6 (TFS 1.4). Was testing fluids in order to start merging the scripts of pits of inferno and I saw that they don't work at all. Jugs, vials and fluid containers are generally not working. I recorded the testing so you guys can see it :)


The script of the main repository can be seen here

How I can possibly fix this?
Thanks in advance, regards!
 
Solution
We check this trouble with @Xikini and saw this is actually a source bug. We applied a patch that is not the correct solution and only applies to 8.6, but it definitely works. First, I added new items for each vial type (red, blue, yellow, green, white, and purple) on Object Builder. The vials must have the following flags activated on properties: common, pickupable and multi-use.

1637942019872.png

Then, we close Object Builder and open Item Editor. We already have sprites for "vial of beer" and "empty vial" in our CIDs. For beer, mud and oil use Client ID (CID) 9112, for empty vial use Client ID 111, and for poison use Client ID 9843. For the...
We check this trouble with @Xikini and saw this is actually a source bug. We applied a patch that is not the correct solution and only applies to 8.6, but it definitely works. First, I added new items for each vial type (red, blue, yellow, green, white, and purple) on Object Builder. The vials must have the following flags activated on properties: common, pickupable and multi-use.

1637942019872.png

Then, we close Object Builder and open Item Editor. We already have sprites for "vial of beer" and "empty vial" in our CIDs. For beer, mud and oil use Client ID (CID) 9112, for empty vial use Client ID 111, and for poison use Client ID 9843. For the rest use the CID ones you created on Object Builder.

item_Editor.png

Save the modifications to items.otb, and load you new .dat .spr on you client folder. Then register the new fluids at items.xml, this is a example of it, be sure to match the local fluid containers and fluids variables:

XML:
    <item id="13068" name="vial of oil" />
    <item id="13069" name="empty vial"/>
    <item id="13070" name="vial of blood"/>
    <item id="13071" name="vial of swamp" />
    <item id="13072" name="vial of lemonade" />
    <item id="13073" name="vial of milk" />
    <item id="13074" name="vial of wine" />
    <item id="13075" name="vial of water" />
    <item id="13076" name="vial of beer" />
    <item id="13077" name="vial of slime" />
    <item id="13078" name="vial of manafluid" />
    <item id="13079" name="vial of lifefluid" />
    <item id="13080" name="vial of urine" />
    <item id="13081" name="vial of coconut milk" />
    <item id="13082" name="vial of mud" />
    <item id="13083" name="vial of fruit juice" />
    <item id="13084" name="vial of lava" />
    <item id="13085" name="vial of rum" />
    <item id="13086" name="vial of tea" />
    <item id="13087" name="vial of mead" />

And finally add the script, all the credits goes to @Xikini
Lua:
local drunk = Condition(CONDITION_DRUNK)
drunk:setParameter(CONDITION_PARAM_TICKS, 60000)

local poison = Condition(CONDITION_POISON)
poison:setParameter(CONDITION_PARAM_DELAYED, true)
poison:setParameter(CONDITION_PARAM_MINVALUE, -50)
poison:setParameter(CONDITION_PARAM_MAXVALUE, -120)
poison:setParameter(CONDITION_PARAM_STARTVALUE, -5)
poison:setParameter(CONDITION_PARAM_TICKINTERVAL, 4000)
poison:setParameter(CONDITION_PARAM_FORCEUPDATE, true)

local fluidMessage = {
    [13076] = "Aah...",
    [13077] = "Urgh!",
    [13072] = "Mmmh.",
    [13078] = "Aaaah...",
    [13079] = "Aaaah...",
    [13068] = "Urgh!",
    [13080] = "Urgh!",
    [13074] = "Aah...",
    [13082] = "Urgh!",
    [13085] = "Aah...",
    [13087] = "Aaaah..."
}

local fluidPool = 2016
local emptyContainer = 13069

local fluids = {
    [1]  = 13075, -- FLUID_WATER,
    [2]  = 13079, -- FLUID_LIFE,
    [3]  = 13076, -- FLUID_BEER,
    [4]  = 13077, -- FLUID_SLIME,
    [5]  = 13072, -- FLUID_LEMONADE,
    [6]  = 13073, -- FLUID_MILK,
    [7]  = 13078, -- FLUID_MANA,
    [10] = 13070, -- FLUID_BLOOD,
    [11] = 13068, -- FLUID_OIL,
    [13] = 13080, -- FLUID_URINE,
    [14] = 13081, -- FLUID_COCONUTMILK,
    [15] = 13074, -- FLUID_WINE,
    [19] = 13082, -- FLUID_MUD,
    [21] = 13083, -- FLUID_FRUITJUICE,
    [26] = 13084, -- FLUID_LAVA,
    [27] = 13085, -- FLUID_RUM,
    [28] = 13071, -- FLUID_SWAMP,
    [35] = 13086, -- FLUID_TEA,
    [43] = 13087, -- FLUID_MEAD  
}

local fluidContainers = {
    [13075] = 1,  -- FLUID_WATER,
    [13079] = 2,  -- FLUID_LIFE,
    [13076] = 3,  -- FLUID_BEER,
    [13077] = 4,  -- FLUID_SLIME,
    [13072] = 5,  -- FLUID_LEMONADE,
    [13073] = 6,  -- FLUID_MILK,
    [13078] = 7,  -- FLUID_MANA,
    [13070] = 10, -- FLUID_BLOOD,
    [13068] = 11, -- FLUID_OIL,
    [13080] = 13, -- FLUID_URINE,
    [13081] = 14, -- FLUID_COCONUTMILK,
    [13074] = 15, -- FLUID_WINE,
    [13082] = 19, -- FLUID_MUD,
    [13083] = 21, -- FLUID_FRUITJUICE,
    [13084] = 26, -- FLUID_LAVA,
    [13085] = 27, -- FLUID_RUM,
    [13071] = 28, -- FLUID_SWAMP,
    [13086] = 35, -- FLUID_TEA,
    [13087] = 43  -- FLUID_MEAD  
}
  
function onUse(player, item, fromPosition, target, toPosition, isHotkey)


    if target and target:isCreature() then
        print("Creature was targeted.")
        if player == target then
            print("Self targeted.")
            if table.contains({13076, 13074, 13087}, item:getId()) then
                player:addCondition(drunk)
            elseif table.contains({13077, 13071}, item:getId()) then
                player:addCondition(poison)
            elseif item:getId() == 13078 then
                player:addMana(math.random(50, 150))
                fromPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
            elseif item:getId() == 13079 then
                player:addHealth(60)
                fromPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
            end
            player:say(fluidMessage[item:getId()] or "Gulp.", TALKTYPE_MONSTER_SAY)
            item:transform(emptyContainer)
            return true
        end
        print("A creature other then self was targeted. Target is now top-most item under player.")
        local tile = Tile(toPosition)
        if tile then
            target = tile:getTopDownItem()
            if not target then
                target = tile:getGround()
            end
        end
    end
  
    if target and target:isItem() then
  
        print("Target is Item.")
      
        -- POI Gravestone
        local targetActionId = target:getActionId()
        if targetActionId == 2023 then
            local standPosition = Position(toPosition.x, toPosition.y + 1, toPosition.z)
            if player:getPosition() ~= standPosition then
                return false
            end
            local creatures = Tile(standPosition):getCreatures()
            for i = 1, #creatures do
                local _player = Player(creatures[i])
                if _player then
                    _player:teleportTo(Position(toPosition.x, toPosition.y, toPosition.z + 1))
                    _player:say('Muahahahaha..', TALKTYPE_MONSTER_SAY, false, _player)
                end
            end
            fromPosition:sendMagicEffect(CONST_ME_DRAWBLOOD)
            toPosition:sendMagicEffect(CONST_ME_MORTAREA)
            item:transform(emptyContainer)
            return true
        end
  
        -- empty vial
        if item:getId() == emptyContainer then
            local itemType = ItemType(target:getId())
            if itemType:isCorpse() then
                local fluidSource = itemType:getFluidSource()
                if fluidSource == 2 then
                    item:transform(13070) -- blood
                elseif fluidSource == 4 then
                    item:transform(13077) -- slime
                end
                return true
            end
            if target:getId() == fluidPool then
                item:transform(fluids[target.type])
                target:remove()
                return true
            end
            return true
        end
      
        -- full vials
        if item:getId() ~= emptyContainer then
            if target:getId() == emptyContainer then
                target:transform(fluids[fluidContainers[item:getId()]])
                item:transform(emptyContainer)
                return true
            end
            Game.createItem(fluidPool, fluidContainers[item:getId()], (toPosition.x == CONTAINER_POSITION and player:getPosition() or toPosition)):decay()
            item:transform(emptyContainer)
            return true
        end
      
        print("No function currently scripted for this action.")
        return true
    end
  
    print("Target was not an item or a creature. Empty tile?")
    print("No function currently scripted for this action.")
    return true
end

Regards!
 
Solution
Hi @Nekiro I haven't tested well but downloaded and pasted the latest sources after you added this commit

Then I started to have this errors on OTC. Not sure if this is directly related to the fluids commit, if someone can test it and confirm would be great. By the way, I replaced again the sources for the ones I downloaded at November 5 and started to work good again (this means is not OTC-related issue). Regards!

unknown.png
 
Hi @Nekiro I haven't tested well but downloaded and pasted the latest sources after you added this commit

Then I started to have this errors on OTC. Not sure if this is directly related to the fluids commit, if someone can test it and confirm would be great. By the way, I replaced again the sources for the ones I downloaded at November 5 and started to work good again (this means is not OTC-related issue). Regards!

View attachment 63729
I have tested on cip client, so if you are having issues on otc, then it might be otc issue.
 
idk if related but every time i walk near cup, jug, vial or any other fluid container i get a client debug
using today's source and datapack and made 0 changes
Code:
Debug Assertion 8.60 Objects.cpp 277
Mon Dec 13 17:52:04 2021
Graphic Engine: DirectX9 (2)
Last Packet Types: 100 010 031 100 020 000 000 000 000 000
Last Packet: 010 003 000 000 016 050 000 001 100 255 126 008 127 007 163 017
Player Position: [95,124,7]
Player Name: Druid Sample (Forgotten)
Player Action: 049 050 055 046 048 046 048 046 049 058 055 049 055 050
Player.cpp 361: exception occurred, reason:
Network.cpp 946: exception occurred (ErrorCode = 0), reason:
Control.cpp 1331: exception occurred (Type = 100) (MainWindow = 45844344), reason:
Communication.cpp 1681: exception occurred (PlayerX = 32511) (PlayerY = 32520), reason:
Communication.cpp 1659: exception occurred (xmin = 0) (ymin = 0), reason:
Communication.cpp 1638: exception occurred (Type = 9) (OldType = 2884), reason:
Objects.cpp 280: exception occurred (Type = 9) (Flag = 10), reason:
Objects.cpp 277: assertion failed (Type = 9) (ObjectProperties->high() = 11703), reason:
In(Type,ObjectProperties->low(),ObjectProperties->high())
tested with this ids 1775, 2005, 3942 and 3941
using 8.6 cip client
 
@Nekiro 👀 @Tibia Demon thanks for testing it, I couldn't do it theese days. Can you check if this still happens if you revert the vials commit? Fix fluids · nekiro/TFS-1.4-Downgrades@fe764b7 (https://github.com/nekiro/TFS-1.4-Downgrades/commit/fe764b7bb6d4153fea5de601616e7bbe7223cedd) Just remove and switch the green lines for the old red ones.

I thought this wasn't working specifially for me because I used the vial sprites that comes by default to create my own ones. Just discovered the solution I marked on this post doesn't allow me to sell "vial of oil", vial of wine", if I don't create new sprites for each of them (for ex. 5 sprites of the purple vial, 5 sprites of the yellow one, and so on).

Regards!
 
@Nekiro 👀 @Tibia Demon thanks for testing it, I couldn't do it theese days. Can you check if this still happens if you revert the vials commit? Fix fluids · nekiro/TFS-1.4-Downgrades@fe764b7 (https://github.com/nekiro/TFS-1.4-Downgrades/commit/fe764b7bb6d4153fea5de601616e7bbe7223cedd) Just remove and switch the green lines for the old red ones.

I thought this wasn't working specifially for me because I used the vial sprites that comes by default to create my own ones. Just discovered the solution I marked on this post doesn't allow me to sell "vial of oil", vial of wine", if I don't create new sprites for each of them (for ex. 5 sprites of the purple vial, 5 sprites of the yellow one, and so on).

Regards!
So, if I understand correctly, what is marked in green should I delete or replace with what is red and compile the file again?
 
So, if I understand correctly, what is marked in green should I delete or replace with what is red and compile the file again?
Yes, delete the green lines and add the red ones to switch back the commit. Then test and see if works.
Here's the list of latest commits that can be switched back, if the error is not there (focus on the recent ones):
 
Yes, delete the green lines and add the red ones to switch back the commit. Then test and see if works.
Here's the list of latest commits that can be switched back, if the error is not there (focus on the recent ones):
Ok, I make it, and now it works very well with this for id above.
 
Hello, what was the final solution for this problem? I'm stuck on this topic of vials, my map is rl and it's used for quests.
 
Back
Top