.: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.