JO

[Arquivado]Easy Annihilator System

Por Jovial, 31 de jan. de 2008 em Noticias - Arquivo

otserv
tibia
12
4.7k
JovialJ
31 de janeiro de 2008 às 22:47

.:Easy Annihilator System:.

 

Olá, a um tempo atras fiz um sistema para facilitar a criação de quests como a annihilator, hoje decidi refaze-lo e postar aqui. Como eu não pude testar todas as funções que refiz, pesso a vocês para testar-lo, e , se encontrar bugs reportar-me.

 

Features:

  • Aceita quantidade de players que você desejar.
  • Aceita quantidade de monstros que você desejar.
  • Aceita quantidade de baús que você desejar (Mas é possivel pegar somente um dos itens).
  • Verifica se existe alguem na sala, impossibilitando entrar 2 times juntos.
  • Quando um time entra na sala, os monstros são renovados.

 

Como Instalar:

Copie o código abaixo e coloque-o no fim do arquivo "data/actions/lib/actions.lua".

--[[
Easy Annihilator by Jovial
Version: 2.0
]]

AnnihilatorSys = {}
AnnihilatorSys_MT = {__index = AnnihilatorSys}

function AnnihilatorSys:new(CONFIG)
local ret = CONFIG
ret.VERSION = "2.0"
setmetatable(ret, AnnihilatorSys_MT)
return ret
end

function AnnihilatorSys:getVersion()
return self.VERSION
end

function AnnihilatorSys:onUse(cid, item)
local tmp
if (item.uid == self.ANNIHILATOR_LEVER_UNIQUEID) then
	if (item.itemid == 1945) then
		if (self:CheckPlayersPositions() == TRUE) then
			if (self:CheckPlayersLevels() == TRUE) then
				for tmp = 1, #self.PLAYER_POS do
					if (self.IS_FORGOTTEN_SERVER == TRUE) then
						doTeleportThing(getThingfromPos(self.PLAYER_POS[tmp]).uid, self.PLAYER_TOPOS[tmp], FALSE)
					else
						doTeleportThing(getThingfromPos(self.PLAYER_POS[tmp]).uid, self.PLAYER_TOPOS[tmp])
					end
					doSendMagicEffect(self.PLAYER_POS[tmp], CONST_ME_POFF)
					doSendMagicEffect(self.PLAYER_TOPOS[tmp], CONST_ME_ENERGYAREA)
				end
				if (self.MONSTERS ~= nil) then
					for tmp = 1, #self.MONSTERS do
						doSummonCreature(self.MONSTERS[tmp].name, self.MONSTERS[tmp].pos)
					end
				end
				doTransformItem(item.uid, 1946)	
			else
				doPlayerSendCancel(cid, "All player need be level " .. (self.MIN_LEVEL or 0) .. " or higher.")
			end
		else
			doPlayerSendCancel(cid, "You need " .. #self.PLAYER_POS .. " players in your team.")
		end
	elseif (item.itemid == 1946) then
		if (self:Check() == TRUE) then
			doTransformItem(item.uid, 1945)	
		end
	else
		return FALSE
	end
else
	if ((self.CHESTS ~= nil) and (self.STORAGE ~= nil)) then
		for tmp = 1, #self.CHESTS do
			if (item.uid == self.CHESTS[tmp].uniqueid) then
				if (getPlayerStorageValue(cid, self.STORAGE) == -1) then
					doPlayerAddItem(cid, self.CHESTS[tmp].prize, self.CHESTS[tmp].count)
					setPlayerStorageValue(cid, self.STORAGE, 1)
					doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found " .. self:getArticle(getItemName(self.CHESTS[tmp].prize)) .. " " .. getItemName(self.CHESTS[tmp].prize) .. ".")
				else
					doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
				end
			end
		end
	end
end
return TRUE
end

function AnnihilatorSys:CheckPlayersPositions()
local tmp
for tmp = 1, #self.PLAYER_POS do
	if (getThingfromPos(self.PLAYER_POS[tmp]).uid <= 0) then
		return FALSE
	end			
end
return TRUE
end

function AnnihilatorSys:CheckPlayersLevels()
local tmp
for tmp = 1, #self.PLAYER_POS do
	if (getPlayerLevel(getThingfromPos(self.PLAYER_POS[tmp]).uid) < (self.MIN_LEVEL or 0)) then
		return FALSE
	end			
end
return TRUE
end

function AnnihilatorSys:Check()
local players = 0
local monsters = {}
local X,Y,tmp
for X = self.TOP_LEFT_POS.x, self.BOTTOM_RIGHT_POS.x do
	for Y = self.TOP_LEFT_POS.y, self.BOTTOM_RIGHT_POS.y do
		local creature = getThingfromPos({x = X, y = Y, z = self.TOP_LEFT_POS.z, stackpos = 253})
		if (creature.uid > 0) then
			if (isPlayer(creature.uid) == TRUE) then
				if (getPlayerAccess(creature.uid) < (self.CHECK_INVISIBLE_ACCESS or 1)) then
					players = players + 1
				end
			else
				table.insert(monsters,creature.uid)
			end
		end
	end
end
if (players == 0) then
	for tmp = 1, #monsters do
		if (doRemoveCreature ~= nil) then
			doRemoveCreature(monsters[tmp])
		else
			if (self.IS_FORGOTTEN_SERVER == TRUE) then
				doTeleportThing(monsters[tmp], self.TRASH_POS, FALSE)
			else
				doTeleportThing(monsters[tmp], self.TRASH_POS)
			end
		end
	end
	return TRUE
else
	return FALSE
end
end

function AnnihilatorSys:getArticle(str)
if (string.find(string.lower(string.sub(str,1,1)), "[aeiouy]")) then
	return "an"
else
	return "a"
end
end

O forum geralmente retira os Tabs, sugiro que vocês recoloque-os.

 

Tutorial:

Para aprender como usá-lo entre aqui.

 

Espero que sejá util, e que vocês gostem.

 

cya;

Jovial.

Editado Fevereiro 1 por Jovial

EvolutionsE
01 de fevereiro de 2008 às 14:41

uid mais um otimo script do jovial ^^

isso vai ajudar muito na criação de annihilatores e quests do msm tipo

2 semanas depois...
matheusbmM
09 de fevereiro de 2008 às 17:07

Cara fico bom mas c me lembro bem ja vi isso em otro post não?

2 semanas depois...
smengaS
19 de fevereiro de 2008 às 22:21

pooo... o meu da um erro no lib e não funciona a annihi..

pode alguem me ajudar? vlw..

MalzbierM
25 de fevereiro de 2008 às 16:53

aki deu um erro na lib

 

@Evolutions sempre elogiando mas nunca vendo realmente se a script realmente funciona

 

OBS: Odeio Gente Desse Tipo.

JovialJ
26 de fevereiro de 2008 às 20:08

Primeiro a lib funciona, 2 como posso saber que erro esta dando ai se vcs não colam a msg do erro ¬¬ o erro pode não passar de mal instalação/configuração e ou por faltar alguma função no server que vc deseja usa-la

MalzbierM
27 de fevereiro de 2008 às 16:56

ai esta o erro

 

 

 

lib_error543.jpg.xs.jpg

 

axo q eu instalei errado ela

Editado Fevereiro 27 por Malzbier

2 meses depois...
darkmale157D
09 de abril de 2008 às 19:14

Aqui esta dando o mesmo erro !

 

Por que seraa !

1 mês depois...
Bebum78B
04 de maio de 2008 às 15:30

tem que adicionar no actions.xml,desse jeito sem adiciona n funciona..

1 mês depois...
dragherD
09 de junho de 2008 às 19:17

como assim adicionar no actions.xml? nao tem nada pra adicionar no actions.xml, aqui estpa dando o mesmo erro do Malzbier

2 semanas depois...
careca21C
18 de junho de 2008 às 02:38

muito Bom

So 1 coisa !

eu Ponho iso no Lib e ten o tutorial la explicando

mas eu poso criar mas de 1 ani ??

 

 

Otimo

Aproved !!

9 anos depois...
StigalS
25 de abril de 2018 às 16:21
Esta noticia foi arquivada.
Este tópico está fechado e foi movido para Noticia - Arquivo.

+ Caso tenha atualizações você poderá criar outro tópico.