• 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!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

TFS 1.X+ Lifefluid and POT nekiro version 7.72 1.5

bpm91

Active Member
Joined
May 23, 2019
Messages
417
Solutions
5
Reaction score
38
Location
Brazil
Could anyone tell me, how do I make manafluid-lifefluid disappear instead of turning into a vial? and the trap pot, does anyone know how to make the liquid come out of it when using it?
in nekiro tfs 1.5 version 7.72

1650161623385.png
 
OP
OP
bpm91

bpm91

Active Member
Joined
May 23, 2019
Messages
417
Solutions
5
Reaction score
38
Location
Brazil
no work :/

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 = {
    [FLUID_BEER] = "Aah...",
    [FLUID_SLIME] = "Urgh!",
    [FLUID_LEMONADE] = "Mmmh.",
    [FLUID_MANA] = "Aaaah...",
    [FLUID_LIFE] = "Aaaah...",
    [FLUID_OIL] = "Urgh!",
    [FLUID_URINE] = "Urgh!",
    [FLUID_WINE] = "Aah...",
    [FLUID_MUD] = "Urgh!",
    [FLUID_RUM] = "Aah...",
    [FLUID_MEAD] = "Aaaah..."
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local targetItemType = ItemType(target.itemid)
    if targetItemType and targetItemType:isFluidContainer() then
        if target.type == FLUID_NONE and item.type ~= FLUID_NONE then
            target:transform(target:getId(), item.type)
            item:transform(item:getId(), FLUID_NONE)
            return true
        elseif target.type ~= FLUID_NONE and item.type == FLUID_NONE then
            item:transform(item:getId(), target.type)
            target:transform(target:getId(), FLUID_NONE)
            return true
        end
    end

    if target.itemid == 1 then
        if item.type == FLUID_NONE then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "It is empty.")
        elseif target.uid == player.uid then
            if table.contains({FLUID_BEER, FLUID_WINE, FLUID_MEAD}, item.type) then
                player:addCondition(drunk)
            elseif item.type == FLUID_SLIME then
                player:addCondition(poison)
            elseif item.type == FLUID_MANA then
                player:addMana(math.random(50, 150))
                fromPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
            elseif item.type == FLUID_LIFE then
                player:addHealth(60)
                fromPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
            end
            player:say(fluidMessage[item.type] or "Gulp.", TALKTYPE_MONSTER_SAY)
            item:transform(item:getId(), FLUID_NONE)
        else
            Game.createItem(2016, item.type, toPosition):decay()
            item:transform(item:getId(), FLUID_NONE)
        end
    else
        local fluidSource = targetItemType and targetItemType:getFluidSource() or FLUID_NONE
        if fluidSource ~= FLUID_NONE then
            item:transform(item:getId(), fluidSource)
        elseif table.contains(distillery, target.itemid) then
            local tmp = distillery[target.itemid]
            if tmp then
                item:transform(item:getId(), FLUID_NONE)
            else
                player:sendCancelMessage("You have to process the bunch into the distillery to get rum.")
            end
        elseif item.type == FLUID_NONE then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "It is empty.")
        else
            if toPosition.x == CONTAINER_POSITION then
                toPosition = player:getPosition()
            end
            Game.createItem(2016, item.type, toPosition):decay()
            item:transform(item:getId(), FLUID_NONE)
        end
    end
    return true
end
 
Last edited:

danilopucci

Active Member
Joined
Nov 22, 2019
Messages
62
Solutions
1
Reaction score
37
GitHub
danilopucci
no work :/

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 = {
    [FLUID_BEER] = "Aah...",
    [FLUID_SLIME] = "Urgh!",
    [FLUID_LEMONADE] = "Mmmh.",
    [FLUID_MANA] = "Aaaah...",
    [FLUID_LIFE] = "Aaaah...",
    [FLUID_OIL] = "Urgh!",
    [FLUID_URINE] = "Urgh!",
    [FLUID_WINE] = "Aah...",
    [FLUID_MUD] = "Urgh!",
    [FLUID_RUM] = "Aah...",
    [FLUID_MEAD] = "Aaaah..."
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local targetItemType = ItemType(target.itemid)
    if targetItemType and targetItemType:isFluidContainer() then
        if target.type == FLUID_NONE and item.type ~= FLUID_NONE then
            target:transform(target:getId(), item.type)
            item:transform(item:getId(), FLUID_NONE)
            return true
        elseif target.type ~= FLUID_NONE and item.type == FLUID_NONE then
            item:transform(item:getId(), target.type)
            target:transform(target:getId(), FLUID_NONE)
            return true
        end
    end

    if target.itemid == 1 then
        if item.type == FLUID_NONE then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "It is empty.")
        elseif target.uid == player.uid then
            if table.contains({FLUID_BEER, FLUID_WINE, FLUID_MEAD}, item.type) then
                player:addCondition(drunk)
            elseif item.type == FLUID_SLIME then
                player:addCondition(poison)
            elseif item.type == FLUID_MANA then
                player:addMana(math.random(50, 150))
                fromPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
            elseif item.type == FLUID_LIFE then
                player:addHealth(60)
                fromPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
            end
            player:say(fluidMessage[item.type] or "Gulp.", TALKTYPE_MONSTER_SAY)
            item:transform(item:getId(), FLUID_NONE)
        else
            Game.createItem(2016, item.type, toPosition):decay()
            item:transform(item:getId(), FLUID_NONE)
        end
    else
        local fluidSource = targetItemType and targetItemType:getFluidSource() or FLUID_NONE
        if fluidSource ~= FLUID_NONE then
            item:transform(item:getId(), fluidSource)
        elseif table.contains(distillery, target.itemid) then
            local tmp = distillery[target.itemid]
            if tmp then
                item:transform(item:getId(), FLUID_NONE)
            else
                player:sendCancelMessage("You have to process the bunch into the distillery to get rum.")
            end
        elseif item.type == FLUID_NONE then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "It is empty.")
        else
            if toPosition.x == CONTAINER_POSITION then
                toPosition = player:getPosition()
            end
            Game.createItem(2016, item.type, toPosition):decay()
            item:transform(item:getId(), FLUID_NONE)
        end
    end
    return true
end
Are you sure that you changed the file? Because the file that you replied on last are not modified.
I am almost sure that you should make the jakub742's modification on line 56 of your file
I am not able to test it now, but I can do it later
 
Last edited:
OP
OP
bpm91

bpm91

Active Member
Joined
May 23, 2019
Messages
417
Solutions
5
Reaction score
38
Location
Brazil
it worked, I think I was on the wrong line, could you tell me how I can make the water POT can throw liquid out and in? this gray POT we used to trap in the old days?1651850004979.png
 

danilopucci

Active Member
Joined
Nov 22, 2019
Messages
62
Solutions
1
Reaction score
37
GitHub
danilopucci
it worked, I think I was on the wrong line, could you tell me how I can make the water POT can throw liquid out and in? this gray POT we used to trap in the old days?View attachment 67596
I will try to check later to be sure. But I think you can check it by yourself:
  • go to actions.xml, check if there is the pot ID and a script related to it. If there is not, add it. I think it is the same script as vials (other/fluids.lua)
  • if everthing is ok, check if the pot ID is correct on items.xml, actions.xml and on related scripts
 
OP
OP
bpm91

bpm91

Active Member
Joined
May 23, 2019
Messages
417
Solutions
5
Reaction score
38
Location
Brazil
i no have action to id 2562 :/
I realized now that I can't use this fluids script for mana fluid and life fluid, because all items that are containers are disappearing along with them, how can I make a script just for mana and life?
 
Last edited:

danilopucci

Active Member
Joined
Nov 22, 2019
Messages
62
Solutions
1
Reaction score
37
GitHub
danilopucci
i no have action to id 2562 :/
Did you add it?
I realized now that I can't use this fluids script for mana fluid and life fluid, because all items that are containers are disappearing along with them, how can I make a script just for mana and life?
Yes, you can rename your modified fluids.lua file (ex: mana_fluids.lua), then go to actions.xml and on vials ID o change the script name to the new one.
I am not sure, it is something like this on actions.xml

XML:
    <action itemid="1386" script="other/teleport.lua" />
    <action itemid="3678" script="other/teleport.lua" />
    <action fromid="2376" toid="2404" script="other/destroy.lua" />
    <action fromid="2406" toid="2419" script="other/destroy.lua" />
    <action fromid="2421" toid="2453" script="other/destroy.lua" />
    <action fromid="2005" toid="2009" script="other/mana_fluids.lua" />
    <action fromid="2011" toid="2015" script="other/fluids.lua" />
    <action itemid="2562" script="other/fluids.lua" /> 
    <action itemid="2023" script="other/fluids.lua" />
    <action itemid="1775" script="other/fluids.lua" />
    <action fromid="2031" toid="2034" script="other/fluids.lua" />
    <action fromid="2574" toid="2577" script="other/fluids.lua" />
    <action fromid="5792" toid="5797" script="other/die.lua" />
    <action itemid="2692" script="other/createbread.lua" />
    <action itemid="2694" script="other/createbread.lua" />
    <action fromid="5303" toid="5304" script="other/windows.lua" />
This way only vials (I think it is ID 2005 to 2009) are going to use mana_fluids.lua and the itemid="2562" are going to use other/fluids.lua as the other containers.
Be sure to revert back your editted fluids.lua to changes take effect
 
OP
OP
bpm91

bpm91

Active Member
Joined
May 23, 2019
Messages
417
Solutions
5
Reaction score
38
Location
Brazil
I think I'm going to need a new script for the fluids, because for example, in the old version, the fluids worked like this, you could use them on the floor if they fell,
you couldn't use it on another player (they fall to the ground when trying to use it on another player) but mine doesn't do any of that. this goes for the containers script too, they are not throwing the liquids on the floor

1651855776559.png

when trying to throw the liquid on the floor this message appears
 
Last edited:
OP
OP
bpm91

bpm91

Active Member
Joined
May 23, 2019
Messages
417
Solutions
5
Reaction score
38
Location
Brazil
I have fluids 1 and fluids 2, fluids 1 are the containers, but they don't have a splash effect, throw liquid on the floor,
fluid 2 are manafluid and life fluid, I would like to add the functions of
hit the floor, and not be able to use it on another player, if you use it, he will also hit the floor
 

johnsamir

Banned User
Joined
Oct 13, 2009
Messages
555
Solutions
5
Reaction score
97
Location
Nowhere
I have fluids 1 and fluids 2, fluids 1 are the containers, but they don't have a splash effect, throw liquid on the floor,
fluid 2 are manafluid and life fluid, I would like to add the functions of
hit the floor, and not be able to use it on another player, if you use it, he will also hit the floor
you have to link the pot id to your mana/life fluids. example, my fluids are located in others/fluids.lua
so it goes like this
Lua:
<action itemid="2562" script="other/fluids.lua"/>
 

danilopucci

Active Member
Joined
Nov 22, 2019
Messages
62
Solutions
1
Reaction score
37
GitHub
danilopucci
I think I'm going to need a new script for the fluids, because for example, in the old version, the fluids worked like this, you could use them on the floor if they fell,
you couldn't use it on another player (they fall to the ground when trying to use it on another player) but mine doesn't do any of that. this goes for the containers script too, they are not throwing the liquids on the floor

View attachment 67599

when trying to throw the liquid on the floor this message appears
Quick fix:
define the line below on your fluids.lua
Lua:
local distillery = {[5513] = 5469, [5514] = 5470}

Explanation:
This can be solved by making a check on this code and the error that you printed. I followed the error message: fluids.lua:65 (the error is on fluids.lua on line 65)
The line 65 calls table.contains method which is defined on global.lua:84 and the error message says "bad argument #1 to 'pairs' (table expected, got nil)". On table.contains the "pairs" is the first argument.
Looking on call of table.contains on fluids.lua:65 the first argument is "distillery" which is nill. So here are the source of the problem: distillery is nill.
Checking on fluids.lua I found that the distillery is not defined. I go to the forgottenserver main branch and found the original fluids.lua has a definition of "distillery".

The right solution on my point of view:

As it is a downgrade and probably you are not using this "distillery" I would remove the entire elseif block which starts on line 65 and the code would be:

Lua:
        local fluidSource = targetItemType and targetItemType:getFluidSource() or FLUID_NONE
        if fluidSource ~= FLUID_NONE then
            item:transform(item:getId(), fluidSource)
        elseif item.type == FLUID_NONE then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "It is empty.")
        else
            if toPosition.x == CONTAINER_POSITION then
                toPosition = player:getPosition()
            end
            Game.createItem(2016, item.type, toPosition):decay()
            item:transform(item:getId(), FLUID_NONE)
        end
 

johnsamir

Banned User
Joined
Oct 13, 2009
Messages
555
Solutions
5
Reaction score
97
Location
Nowhere
Quick fix:
define the line below on your fluids.lua
Lua:
local distillery = {[5513] = 5469, [5514] = 5470}

Explanation:
This can be solved by making a check on this code and the error that you printed. I followed the error message: fluids.lua:65 (the error is on fluids.lua on line 65)
The line 65 calls table.contains method which is defined on global.lua:84 and the error message says "bad argument #1 to 'pairs' (table expected, got nil)". On table.contains the "pairs" is the first argument.
Looking on call of table.contains on fluids.lua:65 the first argument is "distillery" which is nill. So here are the source of the problem: distillery is nill.
Checking on fluids.lua I found that the distillery is not defined. I go to the forgottenserver main branch and found the original fluids.lua has a definition of "distillery".

The right solution on my point of view:
As it is a downgrade and probably you are not using this "distillery" I would remove the entire elseif block which starts on line 65 and the code would be:

Lua:
        local fluidSource = targetItemType and targetItemType:getFluidSource() or FLUID_NONE
        if fluidSource ~= FLUID_NONE then
            item:transform(item:getId(), fluidSource)
        elseif item.type == FLUID_NONE then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "It is empty.")
        else
            if toPosition.x == CONTAINER_POSITION then
                toPosition = player:getPosition()
            end
            Game.createItem(2016, item.type, toPosition):decay()
            item:transform(item:getId(), FLUID_NONE)
        end
is ther a way to set a delay of 1 sec for spells after use manafluid?
 
Top