• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Break 5 jars spawn monster

vingo

Active Member
Joined
Oct 27, 2012
Messages
464
Reaction score
43
AS it says does anyone have the Horestis break jars script?

Maybe even to remove the wall after breaking 5 jars.



Something along the lines of this

PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local storage = 26000
local count = getGlobalStorageValue(storage)
local options = {
[1] = {name = "Break!"},
[2] = {name = "Waaaaaah!"},
[3] = {name = "You are too afraid to destroy this object."}
}
local fazer = options[math.random(1, #options)]
if fazer.name == "Break!" then
count = count - 1
setGlobalStorageValue(storage, count)
doRemoveItem(cid, itemEx.uid,1)
doPlayerSendTextMessage(cid, TEXTCOLOR_ORANGE_1, "Break!")
if count == 0 then
doSummonCreature(CREATURENAME, POSITION, true true) -- Of course put in the creaturename and position yourself
end
else
doPlayerSendTextMessage(cid, TEXTCOLOR_ORANGE_1, ""..fazer.."")
end
return true
end
 
Try this,
Code:
local config = {
    jarPositions = {
        [1] = Position({x = 1000, y = 1000, z = 7}),
        [2] = Position({x = 1000, y = 1000, z = 7}),
        [3] = Position({x = 1000, y = 1000, z = 7}),
        [4] = Position({x = 1000, y = 1000, z = 7}),
        [5] = Position({x = 1000, y = 1000, z = 7})
    },
    storage = 100,
    time = 3600,
    brokenJarId = 13495,
    chance = math.random(1, 100),
    randomText = {"Waaaaaah", "You are too afraid to destroy this object"},
    wallId = 3454,
    wallPosition = Position({x = 1000, y = 1000, z = 7})
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local player = Player(cid)
    if player:getStorageValue(config.storage) > os.time() then
        player:say("You are too afraid to destroy this object", TALKTYPE_ORANGE_1)
        return true
    end

    player:setStorageValue(config.storage, os.time() + config.time)

    if config.chance >= 11 then
        player:say(config.randomText[math.random(#config.randomText)], TALKTYPE_ORANGE_1)
        return true
    end
 
    Item(item.uid):transform(config.brokenJarId)
    player:say("Break!", TALKTYPE_ORANGE_1)

    for i = 1, #config.jarPositions do
        local tile = Tile(config.jarPositions[i])
        if tile then
            local thing = tile:getItemById(config.brokenJarId) then
            if thing and thing:isItem() then
                broken = 1
            else
                broken = 0
                break
            end
        end
    end

    if broken > 0 then
        local tile = Tile(config.wallPosition)
        if tile then
            local thing = tile:getItemById(config.wallId)
            if thing and thing:isItem() then
                thing:remove()
            end
        end
    end

    return true
end
 
Last edited:
and how would I setup this if there is 4 walls and what do I put in actions.xml ?

hmm


also It looks like I can break 1 and then it just says, "you're to afraid to break this"


data/actions/scripts/horestis.lua:onUse data/actions/scripts/horestis.lua:37: attempt to index local 'tile' (a nil value) stack traceback: [C]: in function '__index' data/actions/scripts/horestis.lua:37: in function <data/actions/scripts/horestis.lua:18>
 
Ok but let me break this down, I break all 5 jars.


4 Walls (1 wall on 4 tiles) gets removed and a message appears "Horestis has spawned" and then
doSummonCreature(horestis, xxxxx)
 
for i = 1, #config.jarPositions do
local tile = Tile(config.jarPositions)
if tile:getItemById(config.brokenJarId) then
broken = 1
else
broken = 0
break
end
end

if broken > 0 then
Tile(config.wallPosition):getItemById(config.wallId):remove()
player:say("Horestis has spawned", TALKTYPE_ORANGE_1)
doSummonCreature(Horestis, 32945, 32767, 12)
end

return true
end





will this work?
 
Code:
local config = {
    jarPositions = {
        [1] = Position({x = 1000, y = 1000, z = 7}),
        [2] = Position({x = 1000, y = 1000, z = 7}),
        [3] = Position({x = 1000, y = 1000, z = 7}),
        [4] = Position({x = 1000, y = 1000, z = 7}),
        [5] = Position({x = 1000, y = 1000, z = 7})
    },
    brokenJarId = 13495,
    chance = math.random(1, 100),
    randomText = {"Waaaaaah", "You are too afraid to destroy this object"},
    wallPositions = {
        [1] = Position({x = 1000, y = 1000, z = 7}),
        [2] = Position({x = 1000, y = 1000, z = 7}),
        [3] = Position({x = 1000, y = 1000, z = 7}),
        [4] = Position({x = 1000, y = 1000, z = 7})
    },
    wallId = 3454,
    bossName = "Horestis",
    bossPosition = Position({x = 1000, y = 1000, z = 7})
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local player = Player(cid)
    if config.chance >= 11 then
        player:say(config.randomText[math.random(#config.randomText)], TALKTYPE_ORANGE_1)
        return true
    end

    Item(item.uid):transform(config.brokenJarId)
    player:say("Break!", TALKTYPE_ORANGE_1)

    for i = 1, #config.jarPositions do
        local tile = Tile(config.jarPositions[i])
        if tile then
            local thing = tile:getItemById(config.brokenJarId) then
            if thing and thing:isItem() then
                broken = 1
            else
                broken = 0
                break
            end
        end
    end

    if broken > 0 then
        for i = 1, #config.wallPositions do
            local tile = Tile(config.wallPositions[i])
            if tile then
                local thing = tile:getItemById(config.wallId) then
                if thing and thing:isItem() then
                    thing:remove()
                end
            end
        end
        Game.createMonster(config.bossName, config.bossPosition)
        player:say("Horestis has spawned", TALKTYPE_ORANGE_1)
    end

    return true
end
 
Last edited:
Test without the chance:
Code:
local config = {
jarPositions = {
[1] = Position({x = 1000, y = 1000, z = 7}),
[2] = Position({x = 1000, y = 1000, z = 7}),
[3] = Position({x = 1000, y = 1000, z = 7}),
[4] = Position({x = 1000, y = 1000, z = 7}),
[5] = Position({x = 1000, y = 1000, z = 7})
},
brokenJarId = 13495,
chance = math.random(1, 100),
randomText = {"Waaaaaah", "You are too afraid to destroy this object"},
wallPositions = {
[1] = Position({x = 1000, y = 1000, z = 7}),
[2] = Position({x = 1000, y = 1000, z = 7}),
[3] = Position({x = 1000, y = 1000, z = 7}),
[4] = Position({x = 1000, y = 1000, z = 7})
},
wallId = 3454,
bossName = "Horestis",
bossPosition = Position({x = 1000, y = 1000, z = 7})
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
local player = Player(cid)
if config.chance >= 100 then
player:say(config.randomText[math.random(#config.randomText)], TALKTYPE_ORANGE_1)
return true
end

Item(item.uid):transform(config.brokenJarId)
player:say("Break!", TALKTYPE_ORANGE_1)

for i = 1, #config.jarPositions do
local tile = Tile(config.jarPositions[i])
if tile:getItemById(config.brokenJarId) then
broken = 1
else
broken = 0
break
end
end

if broken > 0 then
for i = 1, #config.wallPositions do
local wallPosition = Tile(config.wallPositions[i])
if wallPosition:getItemById(config.wallId) then
wallPosition:getItemById(config.wallId):remove()
end
end
Game.createMonster(config.bossName, config.bossPosition)
player:say("Horestis has spawned", TALKTYPE_ORANGE_1)
end

return true
end
 
works now, sweet thanks!


last question, Is there a chance you can add so that he wont run out of the room he spawns in or is that impossibru
 
Back
Top