• 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 TFS 0.3.6 Anni system

Joined
Jun 19, 2009
Messages
1,852
Reaction score
5
actions/scripts/quests/annihilator.lua

Code:
local config = {
	daily = "no", -- allow only one enter per day? (like in global Tibia)
	level = 100,
	storage = 30015
	entry =
	{
		{x = 247, y = 659, z = 13},
		{x = 247, y = 660, z = 13},
		{x = 247, y = 661, z = 13},
		{x = 247, y = 662, z = 13}
	},
	destination =
	{
		{x = 189, y = 650, z = 13},
		{x = 189, y = 651, z = 13},
		{x = 189, y = 652, z = 13},
		{x = 189, y = 653, z = 13}
	}
}

config.daily = getBooleanFromString(config.daily)
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.itemid == 1946) then
		if(config.daily) then
			doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
		else
			doTransformItem(item.uid, item.itemid - 1)
		end

		return true
	end

	if(item.itemid ~= 1945) then
		return true
	end

	local players = {}
	for _, position in ipairs(config.entry) do
		local pid = getTopCreature(position).uid
		if(pid == 0 or not isPlayer(pid) or getCreatureStorage(pid, config.storage) > 0 or getPlayerLevel(pid) < config.level) then
			doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
			return true
		end

		table.insert(players, pid)
	end

	for i, pid in ipairs(players) do
		doSendMagicEffect(config.entry[i], CONST_ME_POFF)
		doTeleportThing(pid, config.destination[i], false)
		doSendMagicEffect(config.destination[i], CONST_ME_ENERGYAREA)
	end

	doTransformItem(item.uid, item.itemid + 1)
	return true
end

This is what I found in my quests folder.. I'm pretty sure it works but if 4 people clicks on the lever, they will go to the anni room.

I've set daily to no, which means 4 people can go to anni room whenever they wants but what if the monsters in there dies and another team quickly goes in to the room? Will the monsters respawn as soon as 4 people goes in? or?

thanks
 
open anihilator.lua, delete all the lines in there and paste this:

PHP:
-- Annihilator by Shawak v2.1

        -- CONFIG --

        local room = {     -- room with demons
        fromX = 33219,
        fromY = 31657,
        fromZ = 13,
        --------------
        toX = 33222,
        toY = 31661,
        toZ = 13
        }

        local monster_pos = {
        [1] = {pos = {33219, 31657, 13}, monster = "Demon"},
        [2] = {pos = {33221, 31657, 13}, monster = "Demon"},
        [3] = {pos = {33220, 31661, 13}, monster = "Demon"},
        [4] = {pos = {33222, 31661, 13}, monster = "Demon"},
        [5] = {pos = {33223, 31659, 13}, monster = "Demon"},
        [6] = {pos = {33224, 31659, 13}, monster = "Demon"}
        }

        local players_pos = {
        {x = 33222, y =31671, z = 13, stackpos = 253},
        {x = 33223, y =31671, z = 13, stackpos = 253},
        {x = 33224, y =31671, z = 13, stackpos = 253},
        {x = 33225, y =31671, z = 13, stackpos = 253}
        }

        local new_player_pos = {
        {x = 33219, y = 31659, z = 13},
        {x = 33220, y = 31659, z = 13},
        {x = 33221, y = 31659, z = 13},
        {x = 33222, y = 31659, z = 13}
        }

        local playersOnly = "no"
        local questLevel = 101

        ------------------------------------------------------
        --- CONFIG END ---------------------------------------
        ------------------------------------------------------

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


DON'T FORGET TO CONFIGURE YOUR MAP POSITIONS ON THE SCRIPT!
 
open anihilator.lua, delete all the lines in there and paste this:

PHP:
-- Annihilator by Shawak v2.1

        -- CONFIG --

        local room = {     -- room with demons
        fromX = 33219,
        fromY = 31657,
        fromZ = 13,
        --------------
        toX = 33222,
        toY = 31661,
        toZ = 13
        }

        local monster_pos = {
        [1] = {pos = {33219, 31657, 13}, monster = "Demon"},
        [2] = {pos = {33221, 31657, 13}, monster = "Demon"},
        [3] = {pos = {33220, 31661, 13}, monster = "Demon"},
        [4] = {pos = {33222, 31661, 13}, monster = "Demon"},
        [5] = {pos = {33223, 31659, 13}, monster = "Demon"},
        [6] = {pos = {33224, 31659, 13}, monster = "Demon"}
        }

        local players_pos = {
        {x = 33222, y =31671, z = 13, stackpos = 253},
        {x = 33223, y =31671, z = 13, stackpos = 253},
        {x = 33224, y =31671, z = 13, stackpos = 253},
        {x = 33225, y =31671, z = 13, stackpos = 253}
        }

        local new_player_pos = {
        {x = 33219, y = 31659, z = 13},
        {x = 33220, y = 31659, z = 13},
        {x = 33221, y = 31659, z = 13},
        {x = 33222, y = 31659, z = 13}
        }

        local playersOnly = "no"
        local questLevel = 101

        ------------------------------------------------------
        --- CONFIG END ---------------------------------------
        ------------------------------------------------------

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


DON'T FORGET TO CONFIGURE YOUR MAP POSITIONS ON THE SCRIPT!

I didn't ask for an Anni script :p I just wanted to know/understand elf's anni script: P
 
i dont see in that script , a demon spawn.....u inserted the demons by urself right? some scripts got a demon respawn included on it....like the one the guy posted
 
Last edited:
actions/scripts/quests/annihilator.lua

Code:
local config = {
	daily = "no", -- allow only one enter per day? (like in global Tibia)
	level = 100,
	storage = 30015
	entry =
	{
		{x = 247, y = 659, z = 13},
		{x = 247, y = 660, z = 13},
		{x = 247, y = 661, z = 13},
		{x = 247, y = 662, z = 13}
	},
	destination =
	{
		{x = 189, y = 650, z = 13},
		{x = 189, y = 651, z = 13},
		{x = 189, y = 652, z = 13},
		{x = 189, y = 653, z = 13}
	}
}

config.daily = getBooleanFromString(config.daily)
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.itemid == 1946) then
		if(config.daily) then
			doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
		else
			doTransformItem(item.uid, item.itemid - 1)
		end

		return true
	end

	if(item.itemid ~= 1945) then
		return true
	end

	local players = {}
	for _, position in ipairs(config.entry) do
		local pid = getTopCreature(position).uid
		if(pid == 0 or not isPlayer(pid) or getCreatureStorage(pid, config.storage) > 0 or getPlayerLevel(pid) < config.level) then
			doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
			return true
		end

		table.insert(players, pid)
	end

	for i, pid in ipairs(players) do
		doSendMagicEffect(config.entry[i], CONST_ME_POFF)
		doTeleportThing(pid, config.destination[i], false)
		doSendMagicEffect(config.destination[i], CONST_ME_ENERGYAREA)
	end

	doTransformItem(item.uid, item.itemid + 1)
	return true
end

This is what I found in my quests folder.. I'm pretty sure it works but if 4 people clicks on the lever, they will go to the anni room.

I've set daily to no, which means 4 people can go to anni room whenever they wants but what if the monsters in there dies and another team quickly goes in to the room? Will the monsters respawn as soon as 4 people goes in? or?

thanks

to answer you. no. you need the demon spawns on the map. that script wont make them spawn so people could block respawn
 
no mary , you need a SCRIPT with demon spawn on it , u shoudlnt put demons on the anihi room , the scrpts should have a spawn on it

so when someone activate the switch, the 6 demons spawn on the selected positions, then players get teleported there , once anihi finish, when other ppl turn on the switch again..same happen, dmeon spawns again


local monster_pos = {
[1] = {pos = {33219, 31657, 13}, monster = "Demon"},
[2] = {pos = {33221, 31657, 13}, monster = "Demon"},
[3] = {pos = {33220, 31661, 13}, monster = "Demon"},
[4] = {pos = {33222, 31661, 13}, monster = "Demon"},
[5] = {pos = {33223, 31659, 13}, monster = "Demon"},
[6] = {pos = {33224, 31659, 13}, monster = "Demon"}
}


test the script frankito posted for you
 
Thanks :p but I know that, but can't I just put the monsters on the map and spawntime=1? That way, as soon as someone gets out of the monsters "screen" then the monsters will respawn..
 
then someone could stay on the anihi room and do a demon hunt


you can...but you shouldnt , having the chance to make it perfect, u will use the simplest way?
 
Back
Top