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

Lua Similar to the annihilator

Teshan

New Member
Joined
Nov 10, 2010
Messages
51
Reaction score
0
Today and invented a new quest that is similar to the annihilator but only at the entrance but instead of 4 slots are 7 slots and I wonder if someone could do me a script for me to work those 7 slots using the lever up.

I reputation

11mcllg.jpg


I hope your answers.
 
Hello.

Try:
PHP:
        local room = {     -- room with demons
        fromX = 33229,
        fromY = 31697,
        fromZ = 14,

        toX = 33224,
        toY = 31697,
        toZ = 14
        }

        local monster_pos = {   <-- MONSTERS POS -->
        [1] = {pos = {19015, 19142, 9}, monster = "Demon"},
        [2] = {pos = {19017, 19142, 9}, monster = "Demon"},
        [3] = {pos = {19019, 19142, 9}, monster = "Demon"},
        [4] = {pos = {19021, 19142, 9}, monster = "Demon"},
        [5] = {pos = {19016, 19146, 9}, monster = "Demon"},
        [6] = {pos = {19018, 19146, 9}, monster = "Demon"},
        [7] = {pos = {19020, 19146, 9}, monster = "Demon"},
        [8] = {pos = {19022, 19144, 9}, monster = "Demon"},
        [9] = {pos = {19023, 19144, 9}, monster = "Demon"},
        [10] = {pos = {19024, 19144, 9}, monster = "Demon"}
        }

        local players_pos = {   <-- PLAYER POSITIONS -->
        {x = 19020, y =19150, z = 7, stackpos = 253},
        {x = 19020, y =19151, z = 7, stackpos = 253},
        {x = 19020, y =19152, z = 7, stackpos = 253},
		{x = 19020, y =19153, z = 7, stackpos = 253},
		{x = 19020, y =19154, z = 7, stackpos = 253},
		{x = 19020, y =19155, z = 7, stackpos = 253},
        {x = 19020, y =19156, z = 7, stackpos = 253}
        }

        local new_player_pos = { <-- NEW PLAYER POSITIONS -->
        {x = 19021, y = 19144, z = 9},
        {x = 19020, y = 19144, z = 9},
        {x = 19019, y = 19144, z = 9},
		{x = 19018, y = 19144, z = 9},
		{x = 19017, y = 19144, z = 9},
		{x = 19016, y = 19144, z = 9},
        {x = 19015, y = 19144, z = 9}
        }

        local playersOnly = "yes" <-- HERE YOU CAN PUT IF WANT ONLY PLAYERS -->
        local questLevel = 150  <-- LEVEL FROM QUEST -->

function onUse(cid, item, fromPosition, itemEx, toPosition)
        local all_ready, monsters, player, level = 0, 0, {}, 0
        if item.itemid == 1945 then
                for i = 1, #players_pos do
                        table.insert(player, 0)
                end
                for i = 1, #players_pos do
                        player[i] = getThingfromPos(players_pos[i])
                        if player[i].itemid > 0 then
                                if string.lower(playersOnly) == "yes" then
                                        if isPlayer(player[i].uid) == TRUE then
                                                all_ready = all_ready+1
                                        else
                                                monsters = monsters+1
                                        end
                                else
                                        all_ready = all_ready+1
                                end
                        end
                end
                if all_ready == #players_pos then
                        for i = 1, #players_pos do
                                player[i] = getThingfromPos(players_pos[i])
                                if isPlayer(player[i].uid) == TRUE then
                                        if getPlayerLevel(player[i].uid) >= questLevel then
                                                level = level+1
                                        end
                                else
                                        level = level+1
                                end
                        end
                        if level == #players_pos then
                                if string.lower(playersOnly) == "yes" and monsters == 0 or string.lower(playersOnly) == "no" then
                                        for _, area in pairs(monster_pos) do
                                                        doSummonCreature(area.monster,{x=area.pos[1],y=area.pos[2],z=area.pos[3]})
                                        end
                                        for i = 1, #players_pos do
                                                doSendMagicEffect(players_pos[i], CONST_ME_POFF)
                                                doTeleportThing(player[i].uid, new_player_pos[i], FALSE)
                                                doSendMagicEffect(new_player_pos[i], CONST_ME_ENERGYAREA)
                                                doTransformItem(item.uid,1946)
                                        end
                                else
                                        doPlayerSendTextMessage(cid,19,"Only players can do this quest.")
                                end
                        else
                                doPlayerSendTextMessage(cid,19,"All Players have to be level "..questLevel.." to do this quest.")
                        end
                else
                        doPlayerSendTextMessage(cid,19,"You need "..table.getn(players_pos).." players to do this quest.")
                end
        elseif item.itemid == 1946 then
                local player_room = 0
                for x = room.fromX, room.toX do
                        for y = room.fromY, room.toY do
                                for z = room.fromZ, room.toZ do
                                        local pos = {x=x, y=y, z=z,stackpos = 253}
                                        local thing = getThingfromPos(pos)
                                        if thing.itemid > 0 then
                                                if isPlayer(thing.uid) == TRUE then
                                                        player_room = player_room+1
                                                end
                                        end
                                end
                        end
                end
                if player_room >= 1 then
                        doPlayerSendTextMessage(cid,19,"There is already a team in the quest room.")          
                elseif player_room == 0 then
                        for x = room.fromX, room.toX do
                                for y = room.fromY, room.toY do
                                        for z = room.fromZ, room.toZ do
                                                local pos = {x=x, y=y, z=z,stackpos = 253}
                                                local thing = getThingfromPos(pos)
                                                if thing.itemid > 0 then
                                                        doRemoveCreature(thing.uid)
                                                end
                                        end
                                end
                        end
                        doTransformItem(item.uid,1945)
                end
        end
        return TRUE
end

And:
<action actionid="7001" script="scriptname.lua"/>

Not tested, but I think work fine.
Rep++ if help ;)
 
Back
Top