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

Talkaction to remove wall

Heroid

Active Member
Joined
Mar 7, 2011
Messages
331
Solutions
11
Reaction score
34
Hey, I'm searching for a talkaction that removes a wall north of me with a specific action id by saying !remove. (player does not need to look north for it to work)

Thanks :d
 
Solution
Code:
<talkaction words="!remove" separator=" " script="your_file_name_here.lua"/>

Lua:
local config = {
    wall_action_id = 12345, -- action ID of your wall
    onBreakMsg = 'KABOOOM!', -- msg when they break it
    onBreakEffect = CONST_ME_BLOCKHIT, -- effect when they break it
    errorMsg = 'Special wall not found.' -- msg if wall not found
}

function onSay(player, words, param)
    local pos = player:getPosition()
    local wallPos = Position(pos.x, pos.y-1, pos.z)
   
    local tile = Tile(wallPos)
    if not tile then
        player:sendCancelMessage(config.errorMsg)
        pos:sendMagicEffect(CONST_ME_POFF)
        return false
    end
   
    local tileThings = tile:getItems()
    for i = 1,#tileThings do
        local wall =...
Code:
<talkaction words="!remove" separator=" " script="your_file_name_here.lua"/>

Lua:
local config = {
    wall_action_id = 12345, -- action ID of your wall
    onBreakMsg = 'KABOOOM!', -- msg when they break it
    onBreakEffect = CONST_ME_BLOCKHIT, -- effect when they break it
    errorMsg = 'Special wall not found.' -- msg if wall not found
}

function onSay(player, words, param)
    local pos = player:getPosition()
    local wallPos = Position(pos.x, pos.y-1, pos.z)
   
    local tile = Tile(wallPos)
    if not tile then
        player:sendCancelMessage(config.errorMsg)
        pos:sendMagicEffect(CONST_ME_POFF)
        return false
    end
   
    local tileThings = tile:getItems()
    for i = 1,#tileThings do
        local wall = tile:getThing(i)
        if    wall and (wall:getActionId() == config.wall_action_id) then
            player:say(config.onBreakMsg, TALKTYPE_MONSTER_SAY)
            wallPos:sendMagicEffect(config.onBreakEffect)
            wall:remove()
            return false
        end
    end
   
    player:sendCancelMessage(config.errorMsg)
    pos:sendMagicEffect(CONST_ME_POFF)   
    return false
end
 
Solution
Back
Top