• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action alternative Annihilator

andypsylon

be be
Joined
Jan 13, 2009
Messages
772
Reaction score
65
Location
de/pl
based on a script from tfs :thumbup:
opportunities:
- default settings like in global Tibia but can be changed!
* allow only one enter per day (yes/no)
* allows more times (yes/no)
* without animation and info (yes/no)
- no executable if someone fight
- removes old monsters before summon new ones
- executable right after the last fighter to come out
- old fighter CAN'T DISTURB, thanks to use of magical door, can't reenter to demons room
- lever exhaustion
- works with every creature which is set, (default- Demon)
- gm test option (yes/no)
- not need to type all position if you have a standard map
- fightTime - coutdown, how long players can fight

- new option: customMobs - Freely selectable monsters

instalation:
in yourots/data/actions/actions.xml add:
<action uniqueid="11111" event="script" value="quests/annihilator_neu.lua"/>
lever uniqueid may be the same as anniStor

in yourots/data/actions/scripts/quests/annihilator_neu.lua
Lua:
-- ver. 1.6 2013-07-12
-- author tfs, otland.net/members/andypsylon
local c = {
	daily		= "yes", -- if 'yes' than like in global Tibia allow only one enter per day
	withEffects	= "yes", -- if 'no' than like in global Tibia without Effects  
	onlyOnce	= "yes", -- if 'yes' than like in global Tibia allow only once for player
	anniStor	= 11111, -- if onlyOnce is "yes" you free Storage Nr., may be the same as lever uniqueid!
	level		= 100, -- player level
	tempAid		= 22222, -- your free nr - temp storage for magic doors and tile, IMPORTANT !anniStor ~= tempAid! - must be different
	mob			= "Demon", -- monster name
	customMobs	= "yes",	-- if you will different mobs
	normalMap	= "yes", -- must "no" if you have custom map, example vertically anni
	test		= "no", -- here 'yes' if you will test it with 1 player
	fightTime	= 15, -- min. - coutdown, how long players can fight
	exhaustion	= 4, -- sek. - exhaustion for lever
	exhaustionStor = 33333, -- your Storage Nr. for Exhaustion 
	entry = {
		{x=169, y=247, z=10}, -- 1 player, The first position just behind switch!
		{x=168, y=247, z=10},
		{x=167, y=247, z=10},
		{x=166, y=247, z=10}
	},
	des = {
		{x=178, y=247, z=10}, -- 1 player
		{x=177, y=247, z=10},
		{x=176, y=247, z=10},
		{x=175, y=247, z=10}
	},
	mobPos = {	-- you cann ignore this if you have 'normalMap = "yes"'
		{x=175, y=245, z=10},
		{x=177, y=245, z=10},
		{x=179, y=247, z=10}, -- here position opposite 1
		{x=180, y=247, z=10}, -- here position opposite 2
		{x=176, y=249, z=10},
		{x=178, y=249, z=10}
	},
	customMobName = {	-- you cann ignore this if you have 'customMobs = "no"'
		"Rat",
		"Rat",
		"Cave Rat", -- where position opposite 1
		"Cave Rat", -- where position opposite 2
		"Rat",
		"Rat"
	}
}
 
c.daily = getBooleanFromString(c.daily)
c.withEffects = getBooleanFromString(c.withEffects)
c.onlyOnce = getBooleanFromString(c.onlyOnce)
c.customMobs = getBooleanFromString(c.customMobs)
c.normalMap = getBooleanFromString(c.normalMap)
c.test = getBooleanFromString(c.test)
local anniEvent = 0

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.itemid == 1946) then
		if(not c.daily) or c.test then
			doTransformItem(item.uid, 1945)
		else
			doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
		end
		return true
	end
 	if(item.itemid ~= 1945) then return true end
	if(exhaustion.check(cid, c.exhaustionStor)) then return true end
	exhaustion.set(cid, c.exhaustionStor, c.exhaustion)

	local fighter = {}
	fighter = getSpectators(c.des[1], 3, 3)
	if fighter ~= nil then
		for _, pid in ipairs(fighter) do
			if isPlayer(pid) then
				if(c.withEffects) then
					doCreatureSay(cid, "Halo! Halo!\nWe are still fighting here!", TALKTYPE_MONSTER, nil, cid, c.des[1])
				end
				return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
			end
		end
		for _, pid in ipairs(fighter) do
			if isCreature(pid) then
				doRemoveCreature(pid)
			end
		end
	end

	if(anniEvent ~= 0) then stopEvent(anniEvent) end
	local players = {}
	for _, position in ipairs(c.entry) do
		local pid = getTopCreature(position).uid

		if(pid == 0 or not isPlayer(pid) or getPlayerLevel(pid) < c.level) then
			if(c.withEffects) then
				doCreatureSay(cid, "Need a player\nwith lvl."..c.level, TALKTYPE_MONSTER, nil)
				doSendMagicEffect(position, CONST_ME_TUTORIALARROW)
			end
			return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
		elseif(c.onlyOnce and getCreatureStorage(pid, c.anniStor) > 0) then
			if(c.withEffects) then
				doCreatureSay(cid, "That fighter\ncan't do anni again.", TALKTYPE_MONSTER, nil)
				doSendMagicEffect(position, CONST_ME_TUTORIALARROW)
			end
			return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
		end
		table.insert(players, pid)
		if c.test then break end
	end
 
	if normalMap then
		local zmienne = {{'-3','-2'}, {'-1','-2'}, {'-2','2'}, {'0','2'}, {'1','0'}, {'2','0'}} -- horizontally
		for i, pos in ipairs(zmienne) do
			c.mobPos = c.des[1]
			c.mobPos.x = c.mobPos.x + tonumber(pos[1])
			c.mobPos.y = c.mobPos.y + tonumber(pos[2])
			doCreateMonster(c.customMobs and c.customMobName[i] or c.mob, c.mobPos)
		end
	else
		for i, pos in ipairs(c.mobPos) do
			doCreateMonster(c.customMobs and c.customMobName[i] or c.mob, pos)
		end
	end
 
	for i, pid in ipairs(players) do
		doSendMagicEffect(c.entry[i], CONST_ME_POFF)
		doTeleportThing(pid, c.des[i], false)
		doSendMagicEffect(c.des[i], CONST_ME_ENERGYAREA)
		doCreatureSetStorage(pid, c.tempAid, 1)
		if c.test then break end
	end
	doTransformItem(item.uid, 1946)

	anniEvent = addEvent(function()
		for i, pid in ipairs(players) do
			if getCreatureStorage(pid, c.tempAid) == 1 then
				doCreatureSetStorage(pid, c.tempAid, -1)
				doRemoveCondition(pid, CONDITION_INFIGHT)
				local pos = getClosestFreeTile(cid, c.entry[i], false, false)
				pos.y = pos.y +1
				doTeleportThing(pid, pos, false)
				doSendMagicEffect(getThingPosition(pid), CONST_ME_TELEPORT)
				doCreatureSay(pid, "Time is up!", TALKTYPE_MONSTER)
			end
		end
		doTransformItem(item.uid, 1945)
	end, c.fightTime*60*1000)

	return true
end

on your map replace door to the magic and add aid on it and 1 out tile
annihi.jpg

in yourots/data/movements/movements.xml add:
<movevent type="StepIn" actionid="22222" event="script" value="guests/annihilator_neu.lua"/>
in yourots/data/movements/scripts/quests/annihilator_neu.lua
Lua:
-- ver. 1.3
-- author tfs, otland.net/members/andypsylon
local c = {
	[22222] = "Congratulations!" -- Annihilator
}

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if(not isPlayer(cid)) then return true end

	local i = item.actionid
	if c[i] and (not isItemDoor(item.itemid)) then
		if(getCreatureStorage(cid, i)) == 1 then
			doCreatureSetStorage(cid, i, -1)
			doCreatureSay(cid, c[i], TALKTYPE_MONSTER)
		end
	end
	return true
end
-- annihilator v1.6
- test on tfs v.0.4 -> OK:thumbup:
- test on tfs v.0.3.6 -> OK:thumbup:
have you any wishes?
 
Last edited:
is there a storageDone? So that a person won't be able to do quest ever again... Because players will just help each other - no matter that there is 24 hour block... :S


i also dont understand the magic door part... What is that suppose to do? Sorry Im editing this post but xD
"Insert magic door on your map" - where exactly? Actually this script is really confusing for me... :S

is tempAid same as just normal actionid? If not then how do u add tempAids in RME? xD But I guess its just normal actionid ;d
 
Last edited:
:D
yes, tempAid (in scripts) = actionid (in map)

Door exactly as in the picture with "tempAid" actionid - Player can no more hits back in the fight room!!

--
neu ver.
 
Last edited:
ohhh! that is actually a good idea! It will avoid blocking others! I didn't have time to test ur scripts but I will definitly do it now because I understand everything :p I just need to do some map changes ;D

I will tell u if everything works fine when I finish :p I'll edit this post or something ;D
EDIT
storage = 11111, -- your free nr - annihi Storage - that is not the lever uniqueid? xD right? Im just wondering because of this line
Code:
<action uniqueid="[COLOR="#FF0000"]11111[/COLOR]" event="script" value="quests/annihilator_neu.lua"/>

so, the red thing is uniqueid of lever and the blue thing is just the storage of the quest, right ? xD

EDIT 2
When the lever was in the right position and I moved it once (it was id 1945 and I moved it to id 1946) that error showed up:
ani error.jpg

and now the lever doesn't react when I pull it. I mean like, It desn''t even move. :S

EDIT 3

and the magic door doesn't work ;o ;(
 
Last edited:
I'm on mobile right now so I can't test it and see whole script code. I have question, does Your script remove/kill old monsters before summon new ones?
 
I'm on mobile right now so I can't test it and see whole script code. I have question, does Your script remove/kill old monsters before summon new ones?
YES! :)

thanx.. needs a break .. and I will continue doing that!
 
Last edited:
I guess yes :p
Code:
			return true
		elseif isCreature(pid) then
			doRemoveCreature(pid.uid)
		end
i think this function is reponsible for that xD but i might be wrong

Well, i guess i was wrong when i read the post above xD
 
Ok, i've tested it and.. When i pull the lever i got debug and here is no errors in console. Im using TFS 0.3.6. Whats i can doing wrong?
 
I tested at 0.4, and for me all is well.
@up maybe functions have changed, i will check it
you can test now neu ver 1.2
 
Same, debug and no errors in console, also doors not working for me :huh:, maybe i doing something wrong?
 
for 036pl1: TALKTYPE_MONSTER_SAY --> TALKTYPE_MONSTER

what du you mean "also doors not working for me" ?
 
Okey its working :D! But the doors while i use them says:
Code:
The doors seems to be sealed aganist unwanted intruders
Also can You add possiblity to turn off/on "executable right after the last fighter to come out" because i've war server and someone can train his mlvl on annihilator after kill all demons :/
 
Okey its working :D! But the doors while i use them says:
Code:
The doors seems to be sealed aganist unwanted intruders
Also can You add possiblity to turn off/on "executable right after the last fighter to come out" because i've war server and someone can train his mlvl on annihilator after kill all demons :/

i want to do event for that
 
when i open the magic door and walk on the tile, i get a debug...

im using 0.4

also, the exhaustion doesn't work for me... and its kind of spam of this arrow when player pulls a lever and there is not enough players or what ever xd
 
Lol, you mean your script? ;D i didnt really change anything except for where i should change xD so config ;d

Code:
-- ver. 1.3
-- author tfs, otland.net/members/andypsylon
local config = {
	daily	= "no", -- if yes than like in global Tibia allow only one enter per day
	noEffects = "no", -- if yes than like in global Tibia without Effects  
	repeatt	= "no", -- if yes than like in global Tibia allow only once for player
	anniStor = 100, -- if repeatt "yes" your free Storage Nr., may be the same as lever uniqueid!
	level	= 100, -- player level
	tempAid = 22222, -- your free nr - temp storage for magic doors and tile, IMPORTANT !anniStor ~= tempAid! - must be different
	mob		= "Demon", -- your alternate monster
	normalMap = "no", -- must "no" if you have custom map, example vertically anni
	test	= "yes", -- (yes/no) will you test it with 1 player? 
	exhaustion = 4, -- sek.
	exhaustionStor = 33333, -- your Storage Nr. for Exhaustion 
	entry =
	{
		{x=33225, y=31671, z=13}, -- The first position just behind switch!
		{x=33224, y=31671, z=13},
		{x=33223, y=31671, z=13},
		{x=33222, y=31671, z=13}
	},
	destination =
	{
		{x=33222, y=31659, z=13}, -- /goto 178, 247, 10
		{x=33221, y=31659, z=13},
		{x=33220, y=31659, z=13},
		{x=33219, y=31659, z=13}
	},
	mobPos = -- ignore when you have normal(standard) horizontally annihilator on your map(like rl anni)
	{
		{x=33220, y=31657, z=13}, -- y - 2, x - 3
		{x=33222, y=31657, z=13}, -- y - 2, x - 1
		{x=33219, y=31661, z=13}, -- y + 2, x - 2
		{x=33221, y=31661, z=13}, -- y + 2
		{x=33223, y=31659, z=13}, -- x + 1
		{x=33224, y=31659, z=13} -- x + 2
	},
 
}
 
config.daily = getBooleanFromString(config.daily)
config.noEffects = getBooleanFromString(config.noEffects)
config.repeatt = getBooleanFromString(config.repeatt)
config.normalMap = getBooleanFromString(config.normalMap)
config.test = getBooleanFromString(config.test)
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.itemid == 1946) then
		if(not config.daily) or config.test then
			doTransformItem(item.uid, item.itemid - 1)
		else
			doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
		end
		return true
	end
 	if(item.itemid ~= 1945) then return true end
	if(exhaustion.check(cid, config.exhaustionStor)) then return true end
	exhaustion.set(cid, config.exhaustionStor, config.exhaustion)
 
	local fighter = {}
	fighter = getSpectators(config.destination[1], 3, 3)
	if fighter ~= nil then
		for i, pid in ipairs(fighter) do
			if isPlayer(pid) then
				if(not config.noEffects) then
					doCreatureSay(cid, "Halo! Halo!\nWe are still fighting here!", TALKTYPE_MONSTER, nil, cid, config.destination[1])
				end
				return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
			end
		end
		for i, pid in ipairs(fighter) do
			if isCreature(pid) then
				doRemoveCreature(pid)
			end
		end
	end
 
	local players = {}
	for _, position in ipairs(config.entry) do
		local pid = getTopCreature(position).uid
 
		if(pid == 0 or not isPlayer(pid) or getPlayerLevel(pid) < config.level) then
			if(not config.noEffects) then
				doCreatureSay(cid, "Need a player\nwith lvl."..config.level, TALKTYPE_MONSTER, nil)
				doSendMagicEffect(position, CONST_ME_TUTORIALARROW)
			end
			return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
		elseif(config.repeatt and getCreatureStorage(pid, config.storage) > 0) then
			if(not config.noEffects) then
				doCreatureSay(cid, "That fighter\ncan't do again.", TALKTYPE_MONSTER, nil)
				doSendMagicEffect(position, CONST_ME_TUTORIALARROW)
			end
			return doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
		end
		table.insert(players, pid)
		if config.test then break end
	end
 
local zmienne = {{"-3", "-2"}, {"-1", "-2"}, {"-2", "+2"}, {"+0", "+2"}, {"+1", "+0"}, {"+2", "+0"}} -- horizontally
	if normalMap then
		for _, pos in ipairs(zmienne) do
			config.mobPos = config.destination[1]
			config.mobPos.x = config.mobPos.x + tonumber(pos[1])
			config.mobPos.y = config.mobPos.y + tonumber(pos[2])
			doCreateMonster(config.mob, mobPos)
		end
	else
		for _, position in ipairs(config.mobPos) do
			doCreateMonster(config.mob, position)
		end
	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)
		doCreatureSetStorage(pid, config.tempAid, 1)
		if config.test then break end
	end
 
	doTransformItem(item.uid, item.itemid + 1)
	return true
end

and the movements, well. its just ur script. I didnt change anything... Of course actions ids are set as they should be and uniqueids...
 
and the movements, well. its just ur script. I didnt change anything... Of course actions ids are set as they should be and uniqueids...
not uniqueid!
aid! and exactly tempAid!

insert what your console debug,
check storage 33333, is free?
 
movements.xml
Code:
<movevent type="StepIn" actionid="22222" event="script" value="anihilator/annihilator_neu.lua"/>

actions.xml
Code:
<action uniqueid="11111" event="script" value="Anihilator/anihilator.lua"/>

yea, and sorry. i didnt mean like uniqueid... i have actionid everywhere xd well, except for the lever ;o coz it should be uniqueid of the lever

Help? xD
 
Last edited:
I have no idea, already tested on 2 servers. Check everything again.

and paste here what you have in the console.
 
Back
Top