Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Pessoal, peguei um Zombie Event aqui e estou com um problema, o Zombie ao inves de quando encostar no Player ele ser teletransportado para o Templo, ele apenas ataca o player até a morte, teria como passar um script de zombie que teleport o player para o templo quando encosta nele?

 

Gracias :D

FPCMCUA.jpg

Link para o post
Compartilhar em outros sites

<?xml version="1.0" encoding="UTF-8"?>
<mod name="Zombie_Event" version="3.0" author="VirrageS" contact="otland.net" enabled="yes">

	<config name="config_zombie_event">
		<![CDATA[
			configZombieEvent = {
				storages = {
					main = 'zombieEventMain', -- set free storage
					player = 'zombieEventPlayer', -- set free storage
					joining = 'zombieEventJoining', -- set free storage
					kills = 'zombieEventKills', -- set free storage
					exhaust = 'zombieEventExhaust', -- set free storage
					countEvent = 'zombieEventCountEvent' -- set free storage
				},
				
				position = {x=801,y=2052,z=7}, -- position to which player is teleporting
				room = {
					from = {x=780,y=2037,z=7}, -- left top corner of event room
					to = {x=817,y=2075,z=7} -- right bottom corner of event room
				},				
				
				rewards = {7958, 11366, 2346, 7450}, -- reward id which player can win (reward is random)				
				players = {
					max = 20, -- max players in event
					min = 2, -- min players to event start
					minLevel = 8, -- min level to join to event
					pvpEnabled = false -- can players hit theirselfs
				},
				
				days = {
					['Tuesday'] = {'21:59:20'}, 
					['Thursday'] = {'21:59:20'}, 
					['Friday'] = {'21:59:20'}, 
					['Sunday'] = {'21:59:20'}
				},
				
				spawnDelay = 2000, -- miliseconds
				amountCreatingMonsters = 5,
				monsters = {'Scratchclaw', 'Propell Zombie', 'Vile Centurion', 'Mongrel Man', 'Daidalost'}, -- name of monsters which is creating in event

				delayTime = 5.0, -- time in which players who joined to event are teleporting to teleport position [miuntes]
				startEvent = 1, -- time from teleport to start event [seconds]
				stopEvent = 9200, -- [seconds]
				text = '-PL-\nAby wygrac i otrzymac nagrode, zabij jak najwieksza liczbe zombie przez 20min lub pozostan sam na arenie.\n\n-ENG-\nTo win and get a reward, kill as many zombies for 20 minutes or stay the same in the arena.'
			}
		]]>
	</config>
	
	<lib name="lib_zombie_event">
		<![CDATA[
			function doStopZombieEvent()
				if getStorage(configZombieEvent.storages.main) > 0 then
					local playerTable, creatureTable = {}, {}

					for x = configZombieEvent.room.from.x, configZombieEvent.room.to.x do
						for y = configZombieEvent.room.from.y, configZombieEvent.room.to.y do
							local n, i = getTileInfo({x=x, y=y, z=configZombieEvent.room.from.z}).creatures, 1
							if n ~= 0 then
								local v = getThingfromPos({x=x, y=y, z=configZombieEvent.room.from.z, stackpos=i}).uid
								while v ~= 0 do
									if isPlayer(v) then
										table.insert(playerTable, v)
										if n == #playerTable then
											break
										end
									elseif isMonster(v) then
										table.insert(creatureTable, v)
										if n == #creatureTable then
											break
										end
									end
									i = i + 1
									v = getThingfromPos({x=x, y=y, z=configZombieEvent.room.from.z, stackpos=i}).uid
								end
							end
						end
					end

					if #playerTable > 1 then
						table.sort(playerTable, function(a, b) return (getCreatureStorage(a, configZombieEvent.storages.kills)) > (getCreatureStorage(b, configZombieEvent.storages.kills)) end)
						
						local prize = math.random(#configZombieEvent.rewards)
						
						doTeleportThing(playerTable[1], getTownTemplePosition(getPlayerTown(playerTable[1])))
						doCreatureSetStorage(playerTable[1], configZombieEvent.storages.kills, 0)
						doPlayerAddItem(playerTable[1], configZombieEvent.rewards[prize], 1)
						doCreatureAddHealth(playerTable[1], getCreatureMaxHealth(playerTable[1]) - getCreatureHealth(playerTable[1]))
						doCreatureAddMana(playerTable[1], getCreatureMaxMana(playerTable[1]) - getCreatureMana(playerTable[1]))
						doPlayerSendTextMessage(playerTable[1], MESSAGE_EVENT_ADVANCE, 'You win! You have received '..getItemNameById(configZombieEvent.rewards[prize])..' as reward.')
						doBroadcastMessage('Zombie Plague Attack has finished. The winner is '..getCreatureName(playerTable[1])..'. Congratulations!')
						doSetStorage(configZombieEvent.storages.main, -1)
						
						db.query("INSERT INTO `events` (`event_name`, `winner_name`, `won_item`, `time_win`) VALUES (\"Zombie\", \"" .. getCreatureName(playerTable[1]) .. "\", \"" .. getItemNameById(configZombieEvent.rewards[prize]) .. "\", " .. getStorage(configZombieEvent.storages.countEvent) ..");")

						for i = 2, #playerTable do
							doCreatureAddHealth(playerTable[i], getCreatureMaxHealth(playerTable[i]) - getCreatureHealth(playerTable[i]))
							doCreatureAddMana(playerTable[i], getCreatureMaxMana(playerTable[i]) - getCreatureMana(playerTable[i]))
							doTeleportThing(playerTable[i], getTownTemplePosition(getPlayerTown(playerTable[i])))
							doPlayerSendTextMessage(playerTable[i], MESSAGE_EVENT_ADVANCE, 'You loss.')
							doSendMagicEffect(getThingPos(playerTable[i]), CONST_ME_STUN)
							doCreatureSetStorage(playerTable[i], configZombieEvent.storages.kills, 0)
						end

						for i = 1, #creatureTable do
							if isMonster(creatureTable[i]) then
								doRemoveCreature(creatureTable[i])
							end
						end
						
						doSetStorage(configZombieEvent.storages.countEvent, getStorage(configZombieEvent.storages.countEvent) + 1)
					elseif #playerTable == 0 then
						for i = 1, #creatureTable do
							if isMonster(creatureTable[i]) then
								doRemoveCreature(creatureTable[i])
							end
						end
					
						doBroadcastMessage('No one win in Zombie Plague Attack.')
						doSetStorage(configZombieEvent.storages.main, -1)
						doSetStorage(configZombieEvent.storages.countEvent, getStorage(configZombieEvent.storages.countEvent) + 1)
					end
				end
			end

			function doStartZombieEvent()
				doSetStorage(configZombieEvent.storages.joining, -1)

				if configZombieEvent.players.min <= doCountPlayersZombieEvent() then
					for _, cid in ipairs(getPlayersOnline()) do
						if getCreatureStorage(cid, configZombieEvent.storages.player) > 0 then
							doCreatureSetStorage(cid, configZombieEvent.storages.player, -1)
							doTeleportThing(cid, configZombieEvent.position)
							doCreatureSetNoMove(cid, false)
							doRemoveCondition(cid, CONDITION_INFIGHT)
							
							doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Get ready. Zombie Plague Attack starts in '..configZombieEvent.startEvent..' seconds.')
						end
					end
					
					addEvent(doSetStorage, configZombieEvent.startEvent * 1000, configZombieEvent.storages.main, 1)
					addEvent(doStopZombieEvent, configZombieEvent.stopEvent * 1000)
					addEvent(doRepeatCheckZombieEvent, configZombieEvent.startEvent * 1000 + 2000)
					
					doBroadcastMessage('Zombie Plague Attack has started. LET\'S GO!')
				else
					for _, cid in ipairs(getPlayersOnline()) do
						if getCreatureStorage(cid, configZombieEvent.storages.player) > 0 then
							doCreatureSetNoMove(cid, false)
							doRemoveCondition(cid, CONDITION_INFIGHT)
						end
					end
					
					doBroadcastMessage('Zombie Plague Attack hasn\'t started beacuse there were not enough players.')
				end
			end
			
			function doRepeatCheckZombieEvent()
				if getStorage(configZombieEvent.storages.main) > 0 then
					local playerTable, creatureTable, xTable, yTable = {}, {}, {}, {}

					for x = configZombieEvent.room.from.x, configZombieEvent.room.to.x do
						for y = configZombieEvent.room.from.y, configZombieEvent.room.to.y do
							local n, i = getTileInfo({x=x, y=y, z=configZombieEvent.room.to.z}).creatures, 1
							if n ~= 0 then
								local v = getThingfromPos({x=x, y=y, z=configZombieEvent.room.to.z, stackpos=i}).uid
								while v ~= 0 do
									if isPlayer(v) then
										table.insert(playerTable, v)
										if n == #playerTable then
											break
										end
									elseif isMonster(v) then
										table.insert(creatureTable, v)
										if n == #creatureTable then
											break
										end
									end
									i = i + 1
									v = getThingfromPos({x=x, y=y, z=configZombieEvent.room.to.z, stackpos=i}).uid
								end
							end
							
							table.insert(xTable, x)
							table.insert(yTable, y)
						end
					end

					if #playerTable == 1 then
						local prize = math.random(#configZombieEvent.rewards)
						
						addEvent(doTeleportThing, 200, playerTable[1], getTownTemplePosition(getPlayerTown(playerTable[1])), true)
						doPlayerAddItem(playerTable[1], configZombieEvent.rewards[prize], 1)
						doCreatureSetStorage(playerTable[1], configZombieEvent.storages.kills, 0)
						doCreatureAddHealth(playerTable[1], getCreatureMaxHealth(playerTable[1]) - getCreatureHealth(playerTable[1]))
						doCreatureAddMana(playerTable[1], getCreatureMaxMana(playerTable[1]) - getCreatureMana(playerTable[1]))
						doPlayerSendTextMessage(playerTable[1], MESSAGE_EVENT_ADVANCE, 'You win! You have received '..getItemNameById(configZombieEvent.rewards[prize])..' as reward.')
						doBroadcastMessage('Zombie Plague Attack has finished. The winner is '..getCreatureName(playerTable[1])..'. Congratulations.')
						db.query("INSERT INTO `events` (`event_name`, `winner_name`, `won_item`, `time_win`) VALUES (\"Zombie\", \"" .. getCreatureName(playerTable[1]) .. "\", \""..getItemNameById(configZombieEvent.rewards[prize]).."\", "..getStorage(configZombieEvent.storages.countEvent)..");")
						
						for i = 1, #creatureTable do
							if isMonster(creatureTable[i]) then
								doRemoveCreature(creatureTable[i])
							end
						end
						
						doSetStorage(configZombieEvent.storages.main, -1)
						doSetStorage(configZombieEvent.storages.countEvent, getStorage(configZombieEvent.storages.countEvent) + 1)
						return
					elseif #playerTable == 0 then
						for i = 1, #creatureTable do
							if isMonster(creatureTable[i]) then
								doRemoveCreature(creatureTable[i])
							end
						end
					
						doBroadcastMessage('No one win in Zombie Plague Attack.')
						doSetStorage(configZombieEvent.storages.main, -1)
						
						doSetStorage(configZombieEvent.storages.countEvent, getStorage(configZombieEvent.storages.countEvent) + 1)
						return
					end
				
					local pos = {x=xTable[math.random(#xTable)], y=yTable[math.random(#yTable)], z=7}				
					for i = 1, configZombieEvent.amountCreatingMonsters do
						doCreateMonster(configZombieEvent.monsters[math.random(#configZombieEvent.monsters)], pos, false, false, false)
						doSendMagicEffect(pos, CONST_ME_BATS)
					end
					
					addEvent(doRepeatCheckZombieEvent, configZombieEvent.spawnDelay)
				end
			end
			
			function doCountPlayersZombieEvent()
				local x = 0
				for _, cid in ipairs(getPlayersOnline()) do
					if getCreatureStorage(cid, configZombieEvent.storages.player) > 0 then
						x = x + 1
					end
				end
				return x
			end
			
			function doStartCountingZombieEvent(x)
				if configZombieEvent.delayTime-x > 0 then
					doBroadcastMessage('Zombie Plague Attack is going to start in '..configZombieEvent.delayTime-x..' minutes. You can join to the event by saying "!zombie join".')
					addEvent(doStartCountingZombieEvent, 60*1000, x+1)
				end
			end
		]]>
	</lib>

	<talkaction words="!zombie" event="script">
		<![CDATA[
			domodlib("config_zombie_event")

			function onSay(cid, words, param)
				if getStorage(configZombieEvent.storages.joining) ~= 1 then
					return doPlayerSendCancel(cid, 'Zombie Plague Attack hasn\'t started yet.')
				elseif param == '' then
					return doPlayerSendCancel(cid, 'Command param required (say: "!zombie join" or "!zombie leave.").')
				elseif getPlayerLevel(cid) < configZombieEvent.players.minLevel then
					return doPlayerSendCancel(cid, 'You can\'t join to the event if you don\'t have a require '..configZombieEvent.players.minLevel..' level.')
				elseif getTileInfo(getThingPos(cid)).protection ~= true then
					return doPlayerSendCancel(cid, 'You can\'t join to the event if you aren\'t in protection zone.')
				elseif exhaustion.check(cid, configZombieEvent.storages.exhaust) ~= false then
					return doPlayerSendCancel(cid, 'You must wait '..exhaustion.get(cid, configZombieEvent.storages.exhaust)..' seconds to use this command again.')
				end

				if param == 'join' then
					if getCreatureStorage(cid, configZombieEvent.storages.player) > 0 then
						return doPlayerSendCancel(cid, 'You have arleady joined to event. Wait patiently for start.')
					elseif doCountPlayersZombieEvent() == configZombieEvent.players.max then
						return doPlayerSendCancel(cid, 'Max players in the event have been reached.')
					end
					
					doCreatureSetNoMove(cid, true)
					doPlayerPopupFYI(cid, configZombieEvent.text)
					doCreatureSetStorage(cid, configZombieEvent.storages.player, 1)
					doAddCondition(cid, createConditionObject(CONDITION_INFIGHT, -1))
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have joined to Zombie Plague Attack. You can\'t move until event don\'t start. Wait patiently for the event start.')
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, 'You have joined to Zombie Plague Attack.')
				elseif param == 'leave' then
					if getCreatureStorage(cid, configZombieEvent.storages.player) <= 0 then
						return doPlayerSendCancel(cid, 'You can\'t leave from the event if you don\'t join.')
					end
					
					doCreatureSetNoMove(cid, false)
					doCreatureSetStorage(cid, configZombieEvent.storages.player, -1)
					doRemoveCondition(cid, CONDITION_INFIGHT)
					doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, 'You have left from the Zombie Plague Attack.')
				end
				
				exhaustion.set(cid, configZombieEvent.storages.exhaust, 5)				
				return true
			end
		]]>
	</talkaction>
	
	<talkaction words="!startzombie" access="5" event="script">
		<![CDATA[
			domodlib("config_zombie_event")
			domodlib("lib_zombie_event")

			function onSay(cid, words, param)
				if getStorage(configZombieEvent.storages.main) > 0 then
					return doPlayerSendCancel(cid, 'Zombie Plague Attack is already running.')
				end
			
				doStartCountingZombieEvent(0)

				for _, pid in ipairs(getPlayersOnline()) do
					if getCreatureStorage(pid, configZombieEvent.storages.player) > 0 then
						doCreatureSetStorage(pid, configZombieEvent.storages.player, -1)
						doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)), true)
						doCreatureSetStorage(pid, configZombieEvent.storages.kills, 0)
					end
				end

				doSetStorage(configZombieEvent.storages.joining, 1)
				addEvent(doStartZombieEvent, configZombieEvent.delayTime * 60 * 1000)
				return true
			end
		]]>
	</talkaction>
	
	<talkaction words="!stopzombie" access="5" event="script">
		<![CDATA[
			domodlib("config_zombie_event")
			domodlib("lib_zombie_event")

			function onSay(cid, words, param)
				if getStorage(configZombieEvent.storages.main) > 0 then
					doStopZombieEvent()
				else
					doPlayerSendCancel(cid, 'You can not do it if Zombie Plague Attack is not enabled.')
				end
				return true
			end
		]]>
	</talkaction>

	<globalevent name="Zombie_Event_Days" interval="1000" event="script">
		<![CDATA[
			domodlib("config_zombie_event")
			domodlib("lib_zombie_event")
			
			local daysOpen = {}			
			for k, v in pairs(configZombieEvent.days) do
				table.insert(daysOpen, k)
			end
			
			function onThink(interval)
				if isInArray(daysOpen, os.date('%A')) then
					if isInArray(configZombieEvent.days[os.date('%A')], os.date('%X', os.time())) then
						if getStorage(configZombieEvent.storages.joining) ~= 1 then
							doStartCountingZombieEvent(0)

							for _, pid in ipairs(getPlayersOnline()) do
								if getCreatureStorage(pid, configZombieEvent.storages.player) > 0 then
									doCreatureSetStorage(pid, configZombieEvent.storages.player, -1)
									doTeleportThing(pid, getTownTemplePosition(getPlayerTown(pid)), true)
									doCreatureSetStorage(pid, configZombieEvent.storages.kills, 0)
								end
							end

							doSetStorage(configZombieEvent.storages.joining, 1)
							addEvent(doStartZombieEvent, configZombieEvent.delayTime * 60 * 1000)
						end
					end
				end
				return true
			end
		]]>
	</globalevent>
	
	<event type="statschange" name="Zombie_Event_Dead" event="script">
		<![CDATA[
			domodlib("config_zombie_event")

			function onStatsChange(cid, attacker, type, combat, value)
				if type == 1 and getCreatureHealth(cid) <= value then
					if isInRange(getThingPos(cid), configZombieEvent.room.from, configZombieEvent.room.to) then
						if isPlayer(cid) then
							doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
							doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
							doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
							doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, 'You loss due to attack.')
							
							doSendAnimatedText(getThingPos(cid), value, TEXTCOLOR_RED)
							doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
							doCreatureSetStorage(cid, configZombieEvent.storages.kills, 0)
							return false
						end
					end
				elseif configZombieEvent.players.pvpEnabled ~= true and isInArray({1,3}, type) and isPlayer(attacker) and isPlayer(cid) then
					if isInRange(getThingPos(cid), configZombieEvent.room.from, configZombieEvent.room.to) then
						return false
					end
				end
				return true
			end
		]]>
	</event>

	<event type="kill" name="Zombie_Event_Kill" event="script">
		<![CDATA[
			domodlib("config_zombie_event")

			function onKill(cid, target, damage, flags)
				if isInRange(getThingPos(cid), configZombieEvent.room.from, configZombieEvent.room.to) then
					if isInArray(configZombieEvent.monsters, getCreatureName(target)) then
						doCreatureSetStorage(cid, configZombieEvent.storages.kills, math.max(0, getCreatureStorage(cid, configZombieEvent.storages.kills) + 1))
					end
				end
				return true
			end
		]]>
	</event>

	<event type="login" name="Zombie_Event_Login" event="script">
		<![CDATA[
			domodlib("config_zombie_event")

			function onLogin(cid)
				if getCreatureStorage(cid, configZombieEvent.storages.player) > 0 then
					doCreatureSetStorage(cid, configZombieEvent.storages.player, -1)
					doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), true)
					doCreatureSetNoMove(cid, false)
					doRemoveCondition(cid, CONDITION_INFIGHT)
					doCreatureSetStorage(cid, configZombieEvent.storages.player.kills, 0)
				end

				registerCreatureEvent(cid, 'Zombie_Event_Dead')
				registerCreatureEvent(cid, 'Zombie_Event_Kill')
				return true
			end
		]]>
	</event>
	
	<globalevent name="Zombie_Event_Start" type="startup" event="script">
		<![CDATA[
			domodlib("config_zombie_event")

			function onStartup()
				doSetStorage(configZombieEvent.storages.main, -1)
				doSetStorage(configZombieEvent.storages.joining, -1)
				return true
			end
		]]>
	</globalevent>
</mod>

Não achei onde substitui.... esse eh o MOD

Script do Zombie:

<?xml version="1.0" encoding="UTF-8"?>
<monster name="Propell Zombie" nameDescription="a propell zombie" race="undead" experience="6000" speed="90" manacost="0">
	<health now="17500" max="17500"/>
	<look type="311" corpse="9875"/>
	<targetchange interval="5000" chance="8"/>
	<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"/>
		<flag skull="black"/>
	</flags>
	<attacks>
		<attack name="melee" interval="2000" min="-999" max="-1000"/>
		<attack name="manadrain" interval="1000" chance="13" range="1" min="-700" max="-900"/>
<attack name="death" interval="3000" chance="15" range="7" radius="4" min="-625" max="-953">
	<attribute key="shootEffect" value="suddendeath"/>
	<attribute key="areaEffect" value="mortarea"/>
</attack>
	</attacks>
	<defenses armor="15" defense="10"/>
	<elements>
		<element icePercent="30"/>
		<element firePercent="30"/> 
        <element physicalPercent="-50"/> 
        <element deathPercent="100"/> 
        <element holyPercent="-20"/> 
        <element energyPercent="10"/> 
        <element earthPercent="10"/> 
	</elements>
	<immunities>
		<immunity lifedrain="1"/>
		<immunity paralyze="1"/>
		<immunity invisible="1"/>
		<immunity earth="1"/>
		<immunity fire="1"/>
	</immunities>
	<summons maxSummons="2">
		<summon name="Propell Zombie" interval="500" chance="10" max="3"/>
	</summons>
	<voices interval="5000" chance="10">
		<voice sentence="Mst.... klll...."/>
		<voice sentence="Whrrrr... ssss.... mmm.... grrrrl"/>
		<voice sentence="Dnnnt... cmmm... clsrrr...."/>
		<voice sentence="Httt.... hmnnsss..."/>
	</voices>
	<loot>
		<item id="2148" countmax="64" chance="24000"/><!-- gold coin -->
		<item id="2227" chance="45000"/><!-- rotten meat -->
		<item id="2050" chance="46250"/><!-- torch -->
		<item id="2460" chance="8700"/><!-- brass helmet -->
		<item id="2457" chance="8700"/><!-- steel helmet -->
		<item id="2398" chance="7250"/><!-- mace -->
		<item id="1987" chance="100000"><!-- bag -->
			<inside>
				<item id="9808" chance="7250"/><!-- rusty armor -->			
				<item id="2381" chance="2900"/><!-- battle hammer -->
				<item id="2381" chance="4350"/><!-- halberd -->
				<item id="2205" chance="2900"/><!-- life ring -->
				<item id="7620" chance="1450"/><!-- mana potion -->
				<item id="2657" chance="900"/><!-- simple dress -->
			</inside>
		</item>
	</loot>
</monster>

FPCMCUA.jpg

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.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo