Ir para conteúdo
  • Cadastre-se

Posts Recomendados

┌──────────────────────────────────────────────────┐

Nome: Sign of Zodiac
Versão do script: 1.0.0
Tipo do script: Sistema (Creature Script, Talkaction e Lib)
Servidor Testado: The Forgotten Server 0.4.0 Doomed Elderberry
Autor: Lwkass
└──────────────────────────────────────────────────┘
 
- Características:

 

~ Bônus em experiencia (Todos recebem 10% a mais)
~ Bônus na defesa contra elemento (Todos absorvem 5%)
~ Cada signo possui um elemento (Fire, Ice, Lighting ou Earth)
~ Signos de Fogo: Aries, Leo e Sagittarius
~ Signos da Terra: Taurus, Virgo e Capricorn
~ Signos da Eletricidade (Ar): Gemini, Libra e Aquarius
~ Signos de Agua: Cancer, Scorpio e Pisces
 

 

- Explicando:
Para escolher o signo o player deve colocar o dia e o mês do aniversário e o sistema automaticamente coloca o signo, comando:
 

 

!zodiac dia/mês
 

 

Só para deixar claro como o sistema funciona, usando de exemplo o signo de Leão (Leo) que é do elemento Fire:
* Se receber um dano do elemento Fire, absorve 5% (modificável) do dano total, ou seja, o dano seria igual a 95% do que seria (dano absorvido indicado por animatedText).
* Se matar um monstro que tenha uma defesa contra Fire maior que 0% ganha bônus de 10% (modificável) da exp total, ou seja, ganha-se 110% (exp extra indicada por animatedText).

Se o signo fosse do elemento Earth, então seria a mesma coisa só que com o elemento Earth, se fosse Ice ou Lighting a mesma coisa.

Pode-se usar o comando !zodiac info para informações.



- Script:
Primeiro, na pasta data/lib (caso a pasta não exista, crie) do seu servidor crie um arquivo Lua com o nome zodiac-Lib.lua (Lib com maiúscula) e salve com isso dentro:
 
--[[

	Sign of Zodiac System
						v1.0.0
	by: Lwkass ([email protected])
	
]]


Zodiac = {
	constant = {
		OPTION_PERCENT_BLOCK = 5, -- In Percent
		OPTION_EXTRA_EXP_RATE = 10, -- In Percent
		STORAGE_SIGN = 16161,
		elements = { 
			["Fire"] = { combat = COMBAT_FIREDAMAGE, color = COLOR_ORANGE },
			["Earth"] = { combat = COMBAT_EARTHDAMAGE, color = COLOR_LIGHTGREEN },
			["Lighting"] = { combat = COMBAT_ENERGYDAMAGE, color = COLOR_TEAL },
			["Ice"] = { combat = COMBAT_ICEDAMAGE, color = COLOR_LIGHTBLUE }
		}
	},
	signs = {
		["Aries"] = {
			date = {"21/03", "20/04"}, 
			element = "Fire"
		},
		["Taurus"] = {
			date = {"21/04", "20/05"}, 
			element = "Earth"
		},
		["Gemini"] = {
			date = {"21/05", "20/06"}, 
			element = "Lighting"
		},
		["Cancer"] = {
			date = {"21/06", "21/07"}, 
			element = "Ice"
		},
		["Leo"] = {
			date = {"22/07", "22/08"}, 
			element = "Fire"
		},
		["Virgo"] =  {
			date = {"23/08", "22/09"}, 
			element = "Earth"
		},
		["Libra"] = {
			date = {"23/09", "22/10"}, 
			element = "Lighting"
		},
		["Scorpio"] = {
			date = {"23/10", "21/11"}, 
			element = "Ice"
		},
		["Sagittarius"] = {
			date = {"22/11", "21/12"}, 
			element = "Fire"
		},
		["Capricorn"] = {
			date = {"22/12", "20/01"}, 
			element = "Earth"
		},
		["Aquarius"] = {
			date = {"21/01", "19/02"}, 
			element = "Lighting"
		},
		["Pisces"] = {
			date = {"20/02", "20/03"}, 
			element = "Ice"
		}
	},

	getSignInfo = function (signName)
		return Zodiac.signs[signName]
	end,
	
	set = function (cid, signName)
		setPlayerStorageValue(cid, Zodiac.constant.STORAGE_SIGN, signName)
	end,
	
	get = function (cid)
		return getPlayerStorageValue(cid, Zodiac.constant.STORAGE_SIGN), Zodiac.getSignInfo(getPlayerStorageValue(cid, Zodiac.constant.STORAGE_SIGN)) or 0
	end,
	
	getElement = function (cid)
		return Zodiac.getSignInfo(getPlayerStorageValue(cid, Zodiac.constant.STORAGE_SIGN)).element
	end,
	
	getSign = function (cid, day, month)
		for sign, info in pairs(Zodiac.signs) do
			_, _, beginDay, beginMonth = info.date[1]:find("(%d+)/(%d+)")
			_, _, endDay, endMonth = info.date[2]:find("(%d+)/(%d+)")
			beginDay, beginMonth, endDay, endMonth = tonumber(beginDay), tonumber(beginMonth), tonumber(endDay), tonumber(endMonth)
			
			if ((month == beginMonth and day >= beginDay) or (month == endMonth and day <= endDay)) then
				return sign, info
			end
		end
	end
}

Agora na pasta data/creaturescripts/scripts:

No arquivo login.lua adicione isso antes do return:
 
-- Zodiac
	registerCreatureEvent(cid, "zodiacKill")
	registerCreatureEvent(cid, "zodiacStats")
	
	if (getPlayerLastLogin(cid) <= 0 or getPlayerStorageValue(cid, 16160) == 1) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Please, when is your birthday date ? (Example: !zodiac day/month = !zodiac 1/2, !zodiac 23/7,...)")
		setPlayerStorageValue(cid, 16160, 1) -- Talk state
	else
		doPlayerSetSpecialDescription(cid, ", sign of " .. getPlayerStorageValue(cid, 16161))
	end

E crie esses arquivos:

zodiacKill.lua
 
dofile('data/lib/zodiac-Lib.lua')

function getMonsterPath(monstername)
	f = io.open ("data/monster/monsters.xml", 'r')
	
	for line in f:lines() do
		_, _, name, path, file_name = string.find(line, '<monster name="(.+)" file="(.+)/(.+).xml"/>')
		if (name and path and file_name and name:lower() == monstername:lower()) then
			f:close()
			return path .. "/" .. file_name .. ".xml"
		end
	end
end

function getMonsterElementDefense(monstername, element)
	f = io.open ("data/monster/" .. getMonsterPath(monstername), 'r')
	
	for line in f:lines() do
		if (string.find(line, '</elements>')) then break end
		_, _, n = string.find(line, '<element '.. element:lower() ..'Percent="([-%d]+)"/>')
		if (n) then
			f:close()
			return tonumber(n)
		end
	end
	
	f:close()
	return 0
end

-------

function onKill(cid, target, lastHit)
	if (isMonster(target) and getMonsterElementDefense(getCreatureName(target), (Zodiac.getElement(cid) == "Lighting" and "Energy" or Zodiac.getElement(cid))) > 0) then
		local exp_bonus = math.ceil(getMonsterInfo(getCreatureName(target)).experience * (Zodiac.constant.OPTION_EXTRA_EXP_RATE/100))
		doSendAnimatedText(getThingPos(cid), exp_bonus, COLOR_GREY)
		doPlayerAddExperience(cid, exp_bonus)
	end
	return true
end

 zodiacStats.lua

dofile('data/lib/zodiac-Lib.lua')

function onStatsChange(cid, attacker, type, combat, value)
	playerSign = Zodiac.get(cid)
	
	if (combat == Zodiac.constant.elements[Zodiac.getElement(cid)].combat) then
		valuem = math.ceil(value*(Zodiac.constant.OPTION_PERCENT_BLOCK/100))
		doCreatureAddHealth(cid, valuem)
		doSendAnimatedText(getThingPos(cid), "+"..valuem, Zodiac.constant.elements[Zodiac.getElement(cid)].color)
	end
	return true
end

Certo, agora no arquivo data/creaturescripts/creaturescripts.xml, adicione isso:

 

  <event type="statschange" name="zodiacStats" event="script" value="zodiacStats.lua"/>
    <event type="kill" name="zodiacKill" event="script" value="zodiacKill.lua"/>  

Na pasta data/talkactions/scripts, adicione um arquivo Lua com o nome de zodiacTalk.lua:

 

dofile('data/lib/zodiac-Lib.lua')

function onSay(cid, words, param, channel)
	if (param:len() == 0) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can use '!zodiac day/month' or '!zodiac info'")
		return true
	end

	playerSign, Info = Zodiac.get(cid) 
	
	if (type(playerSign) == "string" and param:lower() == "info") then
		doPlayerPopupFYI(cid, [[      Zodiac Informations ~   
-------------------------------
  * Sign: ]] .. playerSign .. [[ 
  * Element: ]] .. Info.element .. [[
 
 
  * Bonus:
    +]] .. Zodiac.constant.OPTION_EXTRA_EXP_RATE .. [[% experience of ]] .. Zodiac.getElement(cid) ..  [[ monsters 
    +]] .. Zodiac.constant.OPTION_PERCENT_BLOCK .. [[% of defense in attacks with ]] .. Zodiac.getElement(cid) ..  [[ element ]])
	
	elseif (getPlayerStorageValue(cid, 16160) == 1) then
		_, _, day, month = string.find(param, "(%d+)/(%d+)")
		day, month = tonumber(day), tonumber(month)
		if (day and month and day > 0 and day <= 31 and month > 0 and month <= 12) then
			Zodiac.set(cid, Zodiac.getSign(cid, day, month))
			playerSign = Zodiac.get(cid)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, param)
			doSendMagicEffect(getThingPos(cid), math.random(28, 30))
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You sign of zodiac is " .. playerSign .. " which is of element " .. Zodiac.getElement(cid) .. " !")
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You can see more information saying '!zodiac info', remember this...")
			setPlayerStorageValue(cid, 16160, -1)
		else
			doPlayerSendCancel(cid, "You put a invalid date.")
		end
	end
	
	return true
end

Coloque essa tag no arquivo data/talkactions/talkactions.xml

 

 <talkaction words="!zodiac" event="script" value="zodiacTalk.lua"/>  

 

Editado por KekezitoLHP (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Mt lgl cara esse script. vai ajuda mt nego querendo coisa nova no serv

"ℱoco, ℱorçα, ℱé, ℱelicidαde & ℱodα-se os ℱilhos dα Putα."

Premiações:

tYBgy.png

Link para o post
Compartilhar em outros sites

Sim, pelo que explica o tuto sim

"ℱoco, ℱorçα, ℱé, ℱelicidαde & ℱodα-se os ℱilhos dα Putα."

Premiações:

tYBgy.png

Link para o post
Compartilhar em outros sites

Sim, pelo que explica o tuto sim

pronto, já fiz tudo como manda o tutorial, e como eu consigo ativar ?

é só criar um char ?

Link para o post
Compartilhar em outros sites

Vc leu o tuto inteiro amigo ??

 

 

- Explicando:
Para escolher o signo o player deve colocar o dia e o mês do aniversário e o sistema automaticamente coloca o signo, comando:
 

 

!zodiac dia/mês
 

 

Só para deixar claro como o sistema funciona, usando de exemplo o signo de Leão (Leo) que é do elemento Fire:
* Se receber um dano do elemento Fire, absorve 5% (modificável) do dano total, ou seja, o dano seria igual a 95% do que seria (dano absorvido indicado por animatedText).
* Se matar um monstro que tenha uma defesa contra Fire maior que 0% ganha bônus de 10% (modificável) da exp total, ou seja, ganha-se 110% (exp extra indicada por animatedText).

Se o signo fosse do elemento Earth, então seria a mesma coisa só que com o elemento Earth, se fosse Ice ou Lighting a mesma coisa.

Pode-se usar o comando !zodiac info para informações.

"ℱoco, ℱorçα, ℱé, ℱelicidαde & ℱodα-se os ℱilhos dα Putα."

Premiações:

tYBgy.png

Link para o post
Compartilhar em outros sites

Deu erro em tudo

[Error - LuaScriptInterface::loadFile] cannot open data/talkactions/scripts/zodiacTalk.lua: No such file or directory

[22/06/2013 16:51:15] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/zodiacTalk.lua)

[22/06/2013 16:51:15] cannot open data/talkactions/scripts/zodiacTalk.lua: No such file or directory

[22/06/2013 16:51:15] [Error - LuaScriptInterface::loadFile] cannot open data/creaturescripts/scripts/frags.lua: No such file or directory

[22/06/2013 16:51:15] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/frags.lua)

[22/06/2013 16:51:15] cannot open data/creaturescripts/scripts/frags.lua: No such file or directory

[22/06/2013 16:51:15] [Error - LuaScriptInterface::loadFile] cannot open data/creaturescripts/scripts/zodiacStats.lua: No such file or directory

[22/06/2013 16:51:15] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/zodiacStats.lua)

[22/06/2013 16:51:15] cannot open data/creaturescripts/scripts/zodiacStats.lua: No such file or directory

[22/06/2013 16:51:15] [Error - LuaScriptInterface::loadFile] cannot open data/creaturescripts/scripts/zodiacKill.lua: No such file or directory

[22/06/2013 16:51:15] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/zodiacKill.lua)

[22/06/2013 16:51:15] cannot open data/creaturescripts/scripts/zodiacKill.lua: No such file or directory

[22/06/2013 16:51:15] [Error - GlobalEvent::configureEvent] No valid type "globalsave" for globalevent with name globalsave

[22/06/2013 16:51:15] [Warning - BaseEvents::loadFromXml] Cannot configure an event

Link para o post
Compartilhar em outros sites

Deu erro em tudo

[Error - LuaScriptInterface::loadFile] cannot open data/talkactions/scripts/zodiacTalk.lua: No such file or directory

[22/06/2013 16:51:15] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/zodiacTalk.lua)

[22/06/2013 16:51:15] cannot open data/talkactions/scripts/zodiacTalk.lua: No such file or directory

[22/06/2013 16:51:15] [Error - LuaScriptInterface::loadFile] cannot open data/creaturescripts/scripts/frags.lua: No such file or directory

[22/06/2013 16:51:15] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/frags.lua)

[22/06/2013 16:51:15] cannot open data/creaturescripts/scripts/frags.lua: No such file or directory

[22/06/2013 16:51:15] [Error - LuaScriptInterface::loadFile] cannot open data/creaturescripts/scripts/zodiacStats.lua: No such file or directory

[22/06/2013 16:51:15] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/zodiacStats.lua)

[22/06/2013 16:51:15] cannot open data/creaturescripts/scripts/zodiacStats.lua: No such file or directory

[22/06/2013 16:51:15] [Error - LuaScriptInterface::loadFile] cannot open data/creaturescripts/scripts/zodiacKill.lua: No such file or directory

[22/06/2013 16:51:15] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/zodiacKill.lua)

[22/06/2013 16:51:15] cannot open data/creaturescripts/scripts/zodiacKill.lua: No such file or directory

[22/06/2013 16:51:15] [Error - GlobalEvent::configureEvent] No valid type "globalsave" for globalevent with name globalsave

[22/06/2013 16:51:15] [Warning - BaseEvents::loadFromXml] Cannot configure an event

 

Bom.. se esqueceu de coloca algum arquivo, entre em todas as pasta veja se os arquivos estão no local com nome certo, veja se adiciono no arquivo xml 

Link para o post
Compartilhar em outros sites

O problema é que nós arquivos que eu criei e renomeei, eu coloquei (.LUA) no final e é por isso que tava dando erro.

agora os bichos estão bugados, os bichos não dão hits, e quando morrem eles não caiem e continuam atacando mas sem da nenhum hits, e no executor do OT fica roletando erros

post-25547-0-84952500-1372021679_thumb.p

Link para o post
Compartilhar em outros sites

como posso fazer pra n ter o talk

 

ex: a primeira vez q o player entrar vai ser sorteado o signo dele de acordo com a vocação

 

vocation1 = Gemini, Libra e Aquarius

vocation2=Cancer, Scorpio e Pisces  

vocation3=Taurus, Virgo e Capricorn

vocation4=Aries, Leo e Sagittarius

 

tem como fazer isso vc pode me ajudar

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Conteúdo Similar

    • Por Fausto32
      Script/Tutorial+ Php +Map +Talkaction +Portal.
      Ps: Antes de falar q o topico já existe no forum teste os outros scripts
      Então começando por informações basícas :
      Para abrir o evento : /zombiestart numero de players . exemplo : /zombiestart 2
      Para Iniciar o evento sem o numero maximo de players: /zombiestart force.
      Apos aberto sempre q um player ente no portal do evento e avisado por broadcast quem
      entrou na arena e o numero de players restantes para o evento ser iniciado.
      Apos o evento ser iniciado um zombie e sumonado a cada 20 segundos, o player que for infectado e teleportado para o templo vence o ultimo player restante na arena.
      Ao terminar o evento e anuciado por broadcast o nome do player vencedor tempo q durou na arena e por quantos zombies ele sobreviveu, entrega de premio automatica, premio configuravel.
      Garantia de funcionabilidade perfeita em TFS 0.4 se configurado corretamente, não testado em outras versões de distros.
      Creditos: Me .. não criei mais montei peguei de varios servers/topicos e corigi os varios bugs de distro colocaria os creditos de onde peguei a maioria do script mais foi de um server sem creditos q nem era pra ter sido postado.
      Enfim Vamos ao Evento !
      Primeiro vou estar postando a pagina classica do Zombie event no Gesior que seria a parte PHP para informar os players sobre o evento.
      Pagina PHP + Tutorial de como implementar ela no seu site.
      Agora alguns mapas para o zombie event:
      Então Agora vamos ao script !
      data\creaturescripts\scripts\zombie – A pasta ‘zombie’ deve ser criada no diretorio citado.
      \data\creaturescripts\scripts\Zombie\onattack.lua
        function loseOnZombieArena(cid) kickPlayerFromZombiesArea(cid) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "BOOM! You are dead.") local players = getZombiesEventPlayers() if(#players <= 1) then local winner = players[1] if(winner) then doPlayerAddItem(winner, 2157, 5, true) doPlayerAddItem(winner, 6119, 1, true) doPlayerSendTextMessage(winner, MESSAGE_STATUS_CONSOLE_BLUE, "You won zombies arena event.") doBroadcastMessage("After " .. os.time() - getPlayerZombiesEventStatus(winner) .. " seconds of fight " .. getCreatureName(winner) .. " won Zombie Arena Event in game versus " .. getStorage(ZE_ZOMBIES_SPAWNED) .. " zombies!") kickPlayerFromZombiesArea(winner) else doBroadcastMessage("Zombie arena event finished! No one win?!?!?! WTF!") end doSetStorage(ZE_STATUS, 0) doSetStorage(ZE_PLAYERS_NUMBER, ZE_DEFAULT_NUMBER_OF_PLAYERS) doSetStorage(ZE_ZOMBIES_TO_SPAWN, 0) doSetStorage(ZE_ZOMBIES_SPAWNED, 0) local width = (math.max(ZE_spawnFromPosition.x, ZE_spawnToPosition.x) - math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)) / 2 + 1 local height = (math.max(ZE_spawnFromPosition.y, ZE_spawnToPosition.y) - math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)) / 2 + 1 local centerPos = {x=math.min(ZE_spawnFromPosition.x, ZE_spawnToPosition.x)+width,y=math.min(ZE_spawnFromPosition.y, ZE_spawnToPosition.y)+height,z=ZE_spawnFromPosition.z} for z = math.min(ZE_spawnFromPosition.z, ZE_spawnToPosition.z), math.max(ZE_spawnFromPosition.z, ZE_spawnToPosition.z) do centerPos.z = z for i, uid in pairs(getSpectators(centerPos, width, height, false)) do if(isMonster(uid)) then doRemoveCreature(uid) end end end end end function onStatsChange(target, cid, changetype, combat, value) if((cid and isMonster(cid) and getCreatureName(cid) == "Zombie Event") or (isInRange(getThingPosition(target), ZE_spawnFromPosition, ZE_spawnToPosition) and changetype == STATSCHANGE_HEALTHLOSS and math.abs(value) >= getCreatureHealth(target))) then doCreatureAddHealth(target, getCreatureMaxHealth(target)) loseOnZombieArena(target) return false end return true end \data\creaturescripts\scripts\Zombie\ondeath.lua
        function onDeath(cid) setZombiesToSpawnCount(getZombiesToSpawnCount() + 2) doCreatureSay(cid, "I'll be back!", 19) return true end \data\creaturescripts\scripts\Zombie\onthink.lua
        function onThink(cid) local target = getCreatureTarget(cid) if(target ~= 0 and not isPlayer(target)) then doRemoveCreature(target) end return true end \data\globalevents\scripts\zombie\ onstartup.lua
        function onstartup() db.executeQuery("UPDATE `player_storage` SET `value` = 0 WHERE `key` = " .. ZE_isOnZombieArea .. ";") doSetStorage(ZE_STATUS, 0) doSetStorage(ZE_PLAYERS_NUMBER, ZE_DEFAULT_NUMBER_OF_PLAYERS) doSetStorage(ZE_ZOMBIES_TO_SPAWN, 0) doSetStorage(ZE_ZOMBIES_SPAWNED, 0) addZombiesEventBlockEnterPosition() return true end \data\globalevents\scripts\zombie\onthink.lua
        function onThink(interval, lastExecution, thinkInterval) if(getStorage(ZE_STATUS) == 2) then setZombiesToSpawnCount(getZombiesToSpawnCount()+1) local players = getZombiesEventPlayers() for i=1, getZombiesToSpawnCount() * 2 do if(getZombiesToSpawnCount() > 0 and spawnNewZombie()) then setZombiesToSpawnCount(getZombiesToSpawnCount()-1) end end end return true end \data\lib\zombie_event.lua
        -- CONFIG ZE_DEFAULT_NUMBER_OF_PLAYERS = 20 ZE_ACCESS_TO_IGNORE_ARENA = 4 -- POSITIONS ZE_blockEnterItemPosition = {x=32341, y=32213, z=7} -- onde nasce o teleport? ZE_enterPosition = {x=32154, y=32578, z=7} -- onde os players nascem dentro da arena zombie? ZE_kickPosition = {x=32368, y=32241, z=7} -- quando morre vai para onde? ZE_spawnFromPosition = {x=32140,y=32566,z=7} -- para sumonar zombie (de) ZE_spawnToPosition = {x=32168,y=32590,z=7} -- para sumonar zombie (ate) -- ITEM IDS --ZE_blockEnterItemID = 2700 ZE_blockEnterItemID = 1387 -- STORAGES -- - player ZE_isOnZombieArea = 34370 -- - global ZE_STATUS = 34370 -- =< 0 - off, 1 - waiting for players, 2 - is running ZE_PLAYERS_NUMBER = 34371 ZE_ZOMBIES_TO_SPAWN = 34372 ZE_ZOMBIES_SPAWNED = 34373 -- FUNCTION function setZombiesEventPlayersLimit(value) doSetStorage(ZE_PLAYERS_NUMBER, value) end function getZombiesEventPlayersLimit() return getStorage(ZE_PLAYERS_NUMBER) end function addPlayerToZombiesArea(cid) doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT) doTeleportThing(cid, ZE_enterPosition, true) doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT) if(getPlayerAccess(cid) < ZE_ACCESS_TO_IGNORE_ARENA) then setPlayerZombiesEventStatus(cid, os.time()) end end function kickPlayerFromZombiesArea(cid) doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT) doTeleportThing(cid, ZE_kickPosition, true) doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT) setPlayerZombiesEventStatus(cid, 0) end function getPlayerZombiesEventStatus(cid) return getCreatureStorage(cid, ZE_isOnZombieArea) end function setPlayerZombiesEventStatus(cid, value) doCreatureSetStorage(cid, ZE_isOnZombieArea, value) end function getZombiesEventPlayers() local players = {} for i, cid in pairs(getPlayersOnline()) do if(getPlayerZombiesEventStatus(cid) > 0) then table.insert(players, cid) end end return players end function getZombiesCount() return getStorage(ZE_ZOMBIES_SPAWNED) end function addZombiesCount() doSetStorage(ZE_ZOMBIES_SPAWNED, getStorage(ZE_ZOMBIES_SPAWNED)+1) end function resetZombiesCount() doSetStorage(ZE_ZOMBIES_SPAWNED, 0) end function getZombiesToSpawnCount() return getStorage(ZE_ZOMBIES_TO_SPAWN) end function setZombiesToSpawnCount(count) doSetStorage(ZE_ZOMBIES_TO_SPAWN, count) end function addZombiesEventBlockEnterPosition() -- remove tp -- remove o TP local item = getTileItemById(ZE_blockEnterItemPosition, ZE_blockEnterItemID) if(item.uid ~= 0) then doRemoveItem(item.uid) end --doRemoveItem(getThingFromPos(Castle.desde).uid) --[[ if(getTileItemById(ZE_blockEnterItemPosition, ZE_blockEnterItemID).uid == 0) then doCreateItem(ZE_blockEnterItemID, 1, ZE_blockEnterItemPosition) end ]]-- end function removeZombiesEventBlockEnterPosition() -- add tp if(getTileItemById(ZE_blockEnterItemPosition, ZE_blockEnterItemID).uid == 0) then --doCreateItem(ZE_blockEnterItemID, 1, ZE_blockEnterItemPosition) local tp = doCreateTeleport(ZE_blockEnterItemID, ZE_enterPosition, ZE_blockEnterItemPosition) doItemSetAttribute(tp, "aid", "5555") end --[[ local item = getTileItemById(ZE_blockEnterItemPosition, ZE_blockEnterItemID) if(item.uid ~= 0) then doRemoveItem(item.uid) end ]]-- end function spawnNewZombie() local posx = {} local posy = {} local posz = {} local pir = {} for i=1, 5 do local posx_tmp = math.random(ZE_spawnFromPosition.x ,ZE_spawnToPosition.x) local posy_tmp = math.random(ZE_spawnFromPosition.y ,ZE_spawnToPosition.y) local posz_tmp = math.random(ZE_spawnFromPosition.z ,ZE_spawnToPosition.z) local pir_tmp = 0 local spec = getSpectators({x=posx_tmp, y=posy_tmp, z=posz_tmp}, 3, 3, false) if(spec and #spec > 0) then for z, pid in pairs(spec) do if(isPlayer(pid)) then pir_tmp = pir_tmp + 1 end end end posx[i] = posx_tmp posy[i] = posy_tmp posz[i] = posz_tmp pir[i] = pir_tmp end local lowest_i = 1 for i=2, 5 do if(pir[i] < pir[lowest_i]) then lowest_i = i end end local ret = doCreateMonster("Zombie Event", {x=posx[lowest_i], y=posy[lowest_i], z=posz[lowest_i]}, false) if type(ret) == "number" then addZombiesCount() setGlobalStorageValue(201201051801, ret) end return type(ret) == "number" end \data\movements\scripts\zombie\ onenter.lua
        function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) if(not isPlayer(cid)) then return true end if(getPlayerAccess(cid) >= ZE_ACCESS_TO_IGNORE_ARENA) then addPlayerToZombiesArea(cid) elseif(#getZombiesEventPlayers() < getZombiesEventPlayersLimit() and getStorage(ZE_STATUS) == 1) then addPlayerToZombiesArea(cid) local players_on_arena_count = #getZombiesEventPlayers() if(players_on_arena_count == getZombiesEventPlayersLimit()) then addZombiesEventBlockEnterPosition() -- removeTP doSetStorage(ZE_STATUS, 2) doBroadcastMessage("Zombie Arena Event started.") else doBroadcastMessage(getCreatureName(cid) .. " has entered a Zombie Arena. We still need " .. getZombiesEventPlayersLimit() - players_on_arena_count .. " players.") end else doTeleportThing(cid, fromPosition, true) addZombiesEventBlockEnterPosition() end return true end \data\talkactions\scripts\zombie\ onsay.lua
        function onSay(cid, words, param, channel) if(getStorage(ZE_STATUS) ~= 2) then local players_on_arena_count = #getZombiesEventPlayers() if(param == 'force') then if(players_on_arena_count > 0) then setZombiesEventPlayersLimit(players_on_arena_count ) addZombiesEventBlockEnterPosition() doSetStorage(ZE_STATUS, 2) doBroadcastMessage("Zombie Arena Event started.") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Zombies event started.") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot start Zombies event. There is no players on arena.") end else if(param ~= '' and tonumber(param) > 0) then setZombiesEventPlayersLimit(tonumber(param)) end removeZombiesEventBlockEnterPosition() doSetStorage(ZE_STATUS, 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Event started.") doPlayerBroadcastMessage(cid, "Zombie Arena Event teleport is opened. We are waiting for " .. getZombiesEventPlayersLimit() - players_on_arena_count .. " players to start.") end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Zombies event is already running.") end return true end data\monster\zombie_event.xml
        <monster name="Zombie Event" nameDescription="an event zombie" race="undead" experience="480" speed="170" manacost="0"> <health now="20000" max="20000"/> <look type="311" corpse="9875"/> <targetchange interval="5000" chance="50"/> <strategy attack="100" defense="0"/> <flags> <flag summonable="0"/> <flag attackable="1"/> <flag hostile="1"/> <flag illusionable="0"/> <flag convinceable="0"/> <flag pushable="0"/> <flag canpushitems="1"/> <flag canpushcreatures="1"/> <flag targetdistance="1"/> <flag staticattack="90"/> <flag runonhealth="0"/> </flags> <attacks> <attack name="melee" interval="1000" min="-1500" max="-2350"/> </attacks> <defenses armor="0" defense="0"/> <immunities> <immunity paralyze="1"/> <immunity invisible="1"/> <immunity fire="1"/> <immunity energy="1"/> <immunity poison="1"/> </immunities> <voices interval="5000" chance="10"> <voice sentence="You wont last long!"/> <voice sentence="Mmmmh.. braains!"/> </voices> <script> <event name="ZombieThink"/> <event name="ZombieDeath"/> </script> <loot> </loot> </monster> Agora as Tags nos xml’s . /data/creaturescripts/creaturescripts.xml
        <event type="think" name="ZombieThink" event="script" value="zombie/onthink.lua"/> <event type="statschange" name="ZombieAttack" event="script" value="zombie/onattack.lua"/> <event type="death" name="ZombieDeath" event="script" value="zombie/ondeath.lua"/> /data/globalevents/globalevents.xml
        <globalevent name="ZombieGlobalThink" interval="5000" event="script" value="zombie/onthink.lua"/> <globalevent name="ZombieGlobalStartup" type="start" event="script" value="zombie/onstartup.lua"/> /data/movements/movements.xml
        <movevent type="StepIn" actionid="5555" event="script" value="zombie/onenter.lua"/> /data/talkactions/talkactions.xml
        <talkaction log="yes" words="/zombiestart" access="4" event="script" value="zombie/onsay.lua"/> /data/monster/monsters.xml
        <monster name="Zombie Event" file="zombie_event.xml"/> Script Terminado ! Next: Tutorial de como configurar o zombie event ! Estarei postando apenas as partes q podem ou devem ser editadas em cada script. data\creaturescripts\scripts\zombiez\onattack.lua
      Next: \data\lib\zombie_event.lua
      Então galera eh isso ai .-. meu primeiro post não mim crucifiquem k Duvidas, reclamações elogios chigamentos u.u só comentar como dizia o mestre o topico ta explicado nos minimos detalhes e ''de forma bem entendida'' (entendedoresentenderam) então eh isso vlw ai a todos q mim ajudaram nisso e nem sabem ?
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo