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

Fluid Destroying wall script

Curb

Active Member
Joined
Sep 7, 2014
Messages
82
Solutions
5
Reaction score
34
I need a script that I can remove a wall using a fluid (urine). Would you guys help me? 😁
I tried it editing the baking script but no success.


I'm using nostalrius (based on TFS 1.2).
 
Solution
Lua:
local drunk = Condition(CONDITION_DRUNK)
drunk:setParameter(CONDITION_PARAM_TICKS, 60000)

local poison = Condition(CONDITION_POISON)
poison:setTiming(100)

local messages = {
    [FLUID_WATER] = "Gulp.",
    [FLUID_WINE] = "Aah...",
    [FLUID_BEER] = "Aah...",
    [FLUID_MUD] = "Gulp.",
    [FLUID_BLOOD] = "Gulp.",
    [FLUID_SLIME] = "Urgh!",
    [FLUID_OIL] = "Gulp.",
    [FLUID_URINE] = "Urgh!",
    [FLUID_MILK] = "Mmmh.",
    [FLUID_MANAFLUID] = "Aaaah...",
    [FLUID_LIFEFLUID] = "Aaaah...",
    [FLUID_LEMONADE] = "Mmmh."
}

function onUse(player, item, fromPosition, target, toPosition)
    local targetItemType = ItemType(target:getId())
    if targetItemType and targetItemType:isFluidContainer() then
        if target:getFluidType() == 0 and item:getFluidType() ~= 0 then
            target:transform(target:getId(), item:getFluidType())...
What does your fluids.lua script look like?

Something like this should work if you make a new simple script. Just remember to put the actionid on the wall object you want to destory to 1337 or change it to something else. But you might want to include it inside the fluids.lua script file so it wont break something whit the fluids if you drink it or pour it on the floor.
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local ItemType = ItemType(item.itemid)
    if target:getActionId() == 1337 && ItemType == 13 then    -- i think 13 is the typeid of urine else change it to the right one
        return destroyItem(player, target, toPosition)
    end
end

P.S. Im not to familiar whit tfs 1.x+

Edit: It might not be possible to use a vial on a wall, but there is a work around if that is the case.
Can you check what typeid urine uses? Then i can help you improve the script
 
Last edited:
Lua:
local drunk = Condition(CONDITION_DRUNK)
drunk:setParameter(CONDITION_PARAM_TICKS, 60000)

local poison = Condition(CONDITION_POISON)
poison:setTiming(100)

local messages = {
    [FLUID_WATER] = "Gulp.",
    [FLUID_WINE] = "Aah...",
    [FLUID_BEER] = "Aah...",
    [FLUID_MUD] = "Gulp.",
    [FLUID_BLOOD] = "Gulp.",
    [FLUID_SLIME] = "Urgh!",
    [FLUID_OIL] = "Gulp.",
    [FLUID_URINE] = "Urgh!",
    [FLUID_MILK] = "Mmmh.",
    [FLUID_MANAFLUID] = "Aaaah...",
    [FLUID_LIFEFLUID] = "Aaaah...",
    [FLUID_LEMONADE] = "Mmmh."
}

function onUse(player, item, fromPosition, target, toPosition)
    local targetItemType = ItemType(target:getId())
    if targetItemType and targetItemType:isFluidContainer() then
        if target:getFluidType() == 0 and item:getFluidType() ~= 0 then
            target:transform(target:getId(), item:getFluidType())
            item:transform(item:getId(), 0)
            return true
        elseif target:getFluidType() ~= 0 and item:getFluidType() == 0 then
            target:transform(target:getId(), 0)
            item:transform(item:getId(), target:getFluidType())
            return true
        end
    end
  
    if target:isCreature() and target:getPlayer() ~= nil then
        if item:getFluidType() == FLUID_NONE then
            player:sendCancelMessage("It is empty.")
        else
            local self = target == player
            if self and item:getFluidType() == FLUID_BEER or item:getFluidType() == FLUID_WINE then
                player:addCondition(drunk)
            elseif self and item:getFluidType() == FLUID_SLIME then
                player:addCondition(slime)
            elseif item:getFluidType() == FLUID_MANAFLUID then
                target:addMana(math.random(50, 100))
                target:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
            elseif item:getFluidType() == FLUID_LIFEFLUID then
                target:addHealth(math.random(25, 50))
                target:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
            end
          
            if not self then
                if item:getFluidType() ~= FLUID_MANAFLUID and item:getFluidType() ~= FLUID_LIFEFLUID then
                    if toPosition.x == CONTAINER_POSITION then
                        toPosition = player:getPosition()
                    end
                    Game.createItem(2886, item:getFluidType(), toPosition):decay()
                    return true
                end
            end
          
            local message = messages[item:getFluidType()]
            if message then
                target:say(message, TALKTYPE_MONSTER_SAY)
            else
                target:say("Gulp.", TALKTYPE_MONSTER_SAY)
            end
            item:transform(item:getId(), FLUID_NONE)
        end
    else
        if toPosition.x == CONTAINER_POSITION then
            toPosition = player:getPosition()
        end
      
        local tile = Tile(toPosition)
        if not tile then
            return false
        end
      
        if item:getFluidType() ~= FLUID_NONE and tile:hasFlag(TILESTATE_IMMOVABLEBLOCKSOLID) then
            return false
        end
      
        local fluidSource = targetItemType and targetItemType:getFluidSource() or FLUID_NONE
        if fluidSource ~= FLUID_NONE then
            item:transform(item:getId(), fluidSource)
        elseif item:getFluidType() == FLUID_NONE then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "It is empty.")
        else

            Game.createItem(2886, item.type, toPosition):decay()
            item:transform(item:getId(), 0)
        end
    end
    return true
end

Vial of Urine: 2874 (same as empty vial)

And you are right, can't use vial on the wall.

EDIT: Got it guys. Just added it inside fluids.lua:

Lua:
        if item:getFluidType() == FLUID_URINE then
        if target:getId() == 1270 and toPosition.x == 32170 and toPosition.y == 32146 and toPosition.z == 11 then
        item:transform(item:getId(), FLUID_NONE)
        Game.sendMagicEffect({x = 32170, y = 32146, z = 11}, 3)
        Game.removeItemOnMap({x = 32170, y = 32146, z = 11}, 1270)   
        return true
        end
        end
 
Last edited:
Solution
Lua:
local drunk = Condition(CONDITION_DRUNK)
drunk:setParameter(CONDITION_PARAM_TICKS, 60000)

local poison = Condition(CONDITION_POISON)
poison:setTiming(100)

local messages = {
    [FLUID_WATER] = "Gulp.",
    [FLUID_WINE] = "Aah...",
    [FLUID_BEER] = "Aah...",
    [FLUID_MUD] = "Gulp.",
    [FLUID_BLOOD] = "Gulp.",
    [FLUID_SLIME] = "Urgh!",
    [FLUID_OIL] = "Gulp.",
    [FLUID_URINE] = "Urgh!",
    [FLUID_MILK] = "Mmmh.",
    [FLUID_MANAFLUID] = "Aaaah...",
    [FLUID_LIFEFLUID] = "Aaaah...",
    [FLUID_LEMONADE] = "Mmmh."
}

function onUse(player, item, fromPosition, target, toPosition)
    local targetItemType = ItemType(target:getId())
    if targetItemType and targetItemType:isFluidContainer() then
        if target:getFluidType() == 0 and item:getFluidType() ~= 0 then
            target:transform(target:getId(), item:getFluidType())
            item:transform(item:getId(), 0)
            return true
        elseif target:getFluidType() ~= 0 and item:getFluidType() == 0 then
            target:transform(target:getId(), 0)
            item:transform(item:getId(), target:getFluidType())
            return true
        end
    end
 
    if target:isCreature() and target:getPlayer() ~= nil then
        if item:getFluidType() == FLUID_NONE then
            player:sendCancelMessage("It is empty.")
        else
            local self = target == player
            if self and item:getFluidType() == FLUID_BEER or item:getFluidType() == FLUID_WINE then
                player:addCondition(drunk)
            elseif self and item:getFluidType() == FLUID_SLIME then
                player:addCondition(slime)
            elseif item:getFluidType() == FLUID_MANAFLUID then
                target:addMana(math.random(50, 100))
                target:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
            elseif item:getFluidType() == FLUID_LIFEFLUID then
                target:addHealth(math.random(25, 50))
                target:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
            end
         
            if not self then
                if item:getFluidType() ~= FLUID_MANAFLUID and item:getFluidType() ~= FLUID_LIFEFLUID then
                    if toPosition.x == CONTAINER_POSITION then
                        toPosition = player:getPosition()
                    end
                    Game.createItem(2886, item:getFluidType(), toPosition):decay()
                    return true
                end
            end
         
            local message = messages[item:getFluidType()]
            if message then
                target:say(message, TALKTYPE_MONSTER_SAY)
            else
                target:say("Gulp.", TALKTYPE_MONSTER_SAY)
            end
            item:transform(item:getId(), FLUID_NONE)
        end
    else
        if toPosition.x == CONTAINER_POSITION then
            toPosition = player:getPosition()
        end
     
        local tile = Tile(toPosition)
        if not tile then
            return false
        end
     
        if item:getFluidType() ~= FLUID_NONE and tile:hasFlag(TILESTATE_IMMOVABLEBLOCKSOLID) then
            return false
        end
     
        local fluidSource = targetItemType and targetItemType:getFluidSource() or FLUID_NONE
        if fluidSource ~= FLUID_NONE then
            item:transform(item:getId(), fluidSource)
        elseif item:getFluidType() == FLUID_NONE then
            player:sendTextMessage(MESSAGE_STATUS_SMALL, "It is empty.")
        else

            Game.createItem(2886, item.type, toPosition):decay()
            item:transform(item:getId(), 0)
        end
    end
    return true
end

Vial of Urine: 2874 (same as empty vial)

And you are right, can't use vial on the wall.

EDIT: Got it guys. Just added it inside fluids.lua:

Lua:
        if item:getFluidType() == FLUID_URINE then
        if target:getId() == 1270 and toPosition.x == 32170 and toPosition.y == 32146 and toPosition.z == 11 then
        item:transform(item:getId(), FLUID_NONE)
        Game.sendMagicEffect({x = 32170, y = 32146, z = 11}, 3)
        Game.removeItemOnMap({x = 32170, y = 32146, z = 11}, 1270)  
        return true
        end
        end
FYI you could just type
Lua:
Game.sendMagicEffect({x = 32170, y = 32146, z = 11}, 3)
Game.removeItemOnMap({x = 32170, y = 32146, z = 11}, 1270) 

like this instead

Game.sendMagicEffect(toPosition, 3)
Game.removeItemOnMap(toPosition, 1270)
 
If this solved your request then mark solution as best answer.
Edit : I marked it for you, you could just mark it as solved next time.
 
Last edited:
Back
Top