Ir para conteúdo
  • 0

Duvida Sobre Zombie Event


SarioYana

Pergunta

e ae galera tou com +1 duvida ae sobre um script

zombie event

tipow ele ta funfando sertinho

mais quando player entra no local onde acontece o evento

n nasce o bicho ajuda ae vo coloca os scripts a baixo ae

 

esse é onattack do creature script

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[/size]
[size=5]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

esse eh o ondeath do creature script

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

esse é o onthink do creature script

function onThink(cid)
local target = getCreatureTarget(cid)
if(target ~= 0 and not isPlayer(target)) then
 doRemoveCreature(target)
end
return true
end

esse eh o onstartup do globalevents

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

esse eh o onthink do global events

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

esse eh o onenter do movements

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()
  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

esse eh o onsay do talkactions

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

e por final o monster zombie event

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

Vllw

ajuda ai!!

o script ta funfando perfeitamente unico poblema

q n da respaw do zombie event

Link para o comentário
Compartilhar em outros sites

2 respostass a esta questão

Posts Recomendados

  • 0

Estou com o mesmo problema, coloquei ontem kkkkkkk meu problema é o mesmo do seu e estou precisando de ajuda... vlws

 

O Meu problema acho que é no globalevents/scripts/zombie/onthink.lua e no lib/zombie_event.lua, na linha:function spawnNewZombie().

Obs: Uso TFS 0.4.

 

Esse é o meu erro...

 

9060d1311467276-zombie-event-new-version-bug-free-updated-yfs.jpg

 

Bora galerinha, ajuda aew pow

Editado por Helflin
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...