Ir para conteúdo

Como Arruma Esse Bug?


Strubol

Posts Recomendados

Eu acho que é essa lib:

-- CONFIG
ZE_DEFAULT_NUMBER_OF_PLAYERS = 5
ZE_ACCESS_TO_IGNORE_ARENA = 3
-- POSITIONS
ZE_blockEnterItemPosition = {x= 407, y=728, z=7}
ZE_enterPosition = {x = 932, y = 987, z = 7}
ZE_kickPosition = {x=1674, y=1504, z=7}
ZE_spawnFromPosition = {x = 917, y = 1000, z = 7}
ZE_spawnToPosition = {x = 948, y = 1000, z = 7}
-- ITEM IDS
ZE_blockEnterItemID = 2700
-- 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()
if(getTileItemById(ZE_blockEnterItemPosition, ZE_blockEnterItemID).uid == 0) then
	doCreateItem(ZE_blockEnterItemID, 1, ZE_blockEnterItemPosition)
end
end

function removeZombiesEventBlockEnterPosition()
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 = (type(doCreateMonster("Zombie Event", {x=posx[lowest_i], y=posy[lowest_i], z=posz[lowest_i]}, false)) == 'number')
if(ret) then
	addZombiesCount()
end
return ret
end

 

vlw

 

Obs: O script todo está nesse site: http://otland.net/f82/zombie-event-new-version-bug-free-updated-128664/

Link para o comentário
Compartilhar em outros sites

Tente:

 

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
		if getSpectators(centerPos, width, height, false) then
			for i, uid in pairs(getSpectators(centerPos, width, height, false)) do
				if(isMonster(uid)) then
					doRemoveCreature(uid)
				end
			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

Link para o comentário
Compartilhar em outros sites

não deu certo :/, os zumis não sumiram..

 

Consegui fazer os zumbis sumirem automaticamente, más como as coisas não são perfeitas, comessou a ocorrer este erro:

[07/09/2011 22:18:29] [Error - GlobalEvent Interface] 
[07/09/2011 22:18:29] data/globalevents/scripts/zombie/onthink.lua:onThink
[07/09/2011 22:18:29] Description: 
[07/09/2011 22:18:29] data/lib/zombie_event.lua:104: bad argument #2 to 'random' (interval is empty)
[07/09/2011 22:18:29] stack traceback:
[07/09/2011 22:18:29] 	[C]: in function 'random'
[07/09/2011 22:18:30] 	data/lib/zombie_event.lua:104: in function 'spawnNewZombie'
[07/09/2011 22:18:30] 	data/globalevents/scripts/zombie/onthink.lua:6: in function <data/globalevents/scripts/zombie/onthink.lua:1>
[07/09/2011 22:18:30] [Error - GlobalEvents::think] Couldn't execute event: ZombieGlobalThink

:winksmiley02:

 

edit: Consegui arrumar tudo :D, agora só falta a 2ª e a 3ª pergunta a serem respondidas =D,

vou te dar rep+ demon, e amanhã eu vou dar pro mulizeu, pq ele ajudou pacas..

xD.. Vlw aê

Link para o comentário
Compartilhar em outros sites

Respondendo a 3º pergunta. Vá em data/movements/scripts, crie um arquivo .lua e cole isto nele:

 

function onStepIn(cid, item, pos, frompos)

local aids = {
[1000] = 1,
[1200] = 2,
[1400] = 5
}

if isPlayer(cid) then
doPlayerSetTown(cid, aids[item.actionid])
doPlayerSendTextMessage(cid,25,"Congratulations! You are the newest resident of ".. getTownName(aids[item.actionid]) ..".")
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
else
doTeleportThing(cid, frompos)
end

return true
end

 

Depois vá em data/movements, abra o arquivo movements.xml e cole esta tag nele:

 

<movevent type="StepIn" actionid="1000;1200;1400" event="script" value="NomeDoArquivo.lua"/>

 

Edite onde diz NomeDoArquivo.

 

Seguinte, você tem que colocar os actionids nos portais. Eu já mostrei como configurar o script com 3 actionid, basta você coloca-los nos portais pelo mapeditor. Ai o teleport que tem o actionid 1000 deve ser para cidade com id 1, o que tem actionid 1200 deve ser para cidade com id 2, e assim por diante.

 

Qualquer dúvida é só postar.

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

nossa, valeu demon, cara, eu nunca iria encontrar isso no google .-., eu achei alguns más só que dava bug..

 

valeu.., só espera a cota de rep chegar q eu dou um ae pra vc..

 

ou mano, se não for pedir demais..

eu intalei o exphit no meu ot e quando eu ataco o monstro assassin o ot trava tudo e da esse erro:

[08/09/2011 13:49:36] [Error - CreatureScript Interface] 
[08/09/2011 13:49:36] data/creaturescripts/scripts/exphit.lua:onStatsChange
[08/09/2011 13:49:36] Description: 
[08/09/2011 13:49:36] data/creaturescripts/scripts/exphit.lua:21: attempt to index a boolean value
[08/09/2011 13:49:36] stack traceback:
[08/09/2011 13:49:36] 	data/creaturescripts/scripts/exphit.lua:21: in function <data/creaturescripts/scripts/exphit.lua:15>

[08/09/2011 13:49:36] [Error - CreatureScript Interface] 
[08/09/2011 13:49:36] data/creaturescripts/scripts/exphit.lua:onStatsChange
[08/09/2011 13:49:36] Description: 
[08/09/2011 13:49:37] (luaGetMonsterInfo) Monster not found

Eu acho que é alguma coisa simples, qualquer coisa eu procuro no google..

 

vlw!

Link para o comentário
Compartilhar em outros sites

monster XML:

<monster name="Assassin" file="outlaws/assasin.xml"/>

 

Assasin.xml

<?xml version="1.0" encoding="UTF-8"?>
<monster name="Assasin" nameDescription="an assassin" race="blood" experience="105" speed="224" manacost="450">
 <health now="175" max="175"/>
 <look type="129" head="95" body="95" legs="95" feet="95" corpse="6080"/>
 <targetchange interval="2000" chance="5"/>
 <strategy attack="70" defense="20"/>
 <flags>
   <flag summonable="0"/>
   <flag attackable="1"/>
   <flag hostile="1"/>
   <flag illusionable="0"/>
   <flag convinceable="1"/>
   <flag pushable="0"/>
   <flag canpushitems="1"/>
   <flag canpushcreatures="1"/>
   <flag targetdistance="1"/>
   <flag runonhealth="0"/>
 </flags>
 <attacks>
   <attack name="melee" interval="2000" skill="45" attack="45"/>
   <attack name="physical" interval="1000" chance="13" range="7" min="-28" max="-38">
     <attribute key="shootEffect" value="throwingstar"/>
   </attack>
   <attack name="drunk" interval="1000" chance="10" range="6">
     <attribute key="shootEffect" value="poison"/>
     <attribute key="areaEffect" value="poison"/>
   </attack>
 </attacks>
 <defenses armor="15" defense="20">
   <defense name="speed" interval="1000" chance="9" speedchange="1201" duration="3000">
     <attribute key="areaEffect" value="redshimmer"/>
   </defense>
   <defense name="invisible" interval="1000" chance="9" duration="2000">
     <attribute key="areaEffect" value="blueshimmer"/>
   </defense>
 </defenses>
 <elements>
 <element physicalPercent="8"/>
 <element deathPercent="5"/>
 </elements>
 <immunities>
   <immunity invisible="1"/>
 </immunities>
 <voices interval="5000" chance="10">
   <voice sentence="Die!"/>
   <voice sentence="Feel the hand of death!"/>
   <voice sentence="You are on my deathlist!"/>
 </voices>
 <loot>
   <item id="2513" countmax="1" chance="1500"/>
   <item id="2404" countmax="1" chance="4000"/>
   <item id="2148" countmax="40" chance="80000"/>
   <item id="2399" countmax="10" chance="15000"/>
   <item id="3969" countmax="1" chance="200"/>
   <item id="2403" countmax="1" chance="10000"/>
   <item id="3968" countmax="1" chance="1300"/>
<item id="3969" countmax="1" chance="1000"/>
   <item id="2510" countmax="1" chance="2000"/>
   <item id="2145" countmax="1" chance="200"/>
   <item id="2457" countmax="1" chance="3000"/>
   <item id="7366" countmax="4" chance="1500"/>
   <item id="2509" countmax="1" chance="1000"/>
   <item id="2050" countmax="2" chance="30000"/>
 </loot>
</monster>

Link para o comentário
Compartilhar em outros sites

Pelo visto é um bug da função do TFS mesmo. Enfim, fiz uma função aqui, vamos ver se vai:

 

Vai em lib/functions.lua e cola esta função do final dela:

 

function getMonsterExperience(name)

local info = io.open("data/monster/monsters.xml", "r")
local mm = string.lower(info:read("*all"))
local name = string.lower(name)

for _, line in pairs(lines(mm)) do
if string.find(line, "'" .. name .. "'") or string.find(line, '"' .. name .. '"') then
xml = string.sub(line, string.find(line, "file")+6, string.find(line, ".xml")+3)
break
end
end

local info2 = io.open("data/monster/" .. xml, "r")
local mm2 = string.lower(info2:read("*all"))

local exp = string.match(mm2, "%d+", string.find(mm2, "experience"), "%d+")

return exp
end

function lines(str)

local t = {}
local j = {}
local c = nil

for i = 1, #str do
if i == 1 then
table.insert(t, 1)
elseif string.byte(string.sub(str, i, i)) == 10 then
table.insert(t, i)
end
end

for i = 1, #t do
c = t[i+1] and t[i+1] -1
table.insert(j, string.sub(str, t[i], c))
end

return j
end

 

Depois substitua o script do exphit por:

 

-- Exp por Hit By: xOtServx --
rateExp = 50 -- agora vc configura o rate de exp do server.
------------------------------

function CalculeExp(monsterhp, exptotal, hit)
       local x = hit <= monsterhp and math.ceil(exptotal * hit / monsterhp) or 0
       local x2 = x -  20 + math.random(20)
       return  x2 > 0 and x2 or 0
end

function isSummon(uid)
       return uid ~= getCreatureMaster(uid) or false
end

function onStatsChange(cid, attacker, type, combat, value)
       if type == STATSCHANGE_HEALTHLOSS then
               if isMonster(cid) then
                       if isCreature(attacker) then
                               local sid = isSummon(attacker) == true and getCreatureMaster(attacker) or attacker
                               if isPlayer(sid) then
                                       local expg = CalculeExp(getCreatureMaxHealth(cid), getMonsterExperience(getCreatureName(cid)) * rateExp, value)
                                       doPlayerSendTextMessage(sid, 23, "You gain "..expg.." exp.")
                                       doPlayerAddExp(sid, expg)
                               end
                       end
               end
       elseif type == STATSCHANGE_HEALTHGAIN then
               return false
       end
       return true
end

function onCombat(cid, target)
       if isMonster(target) and not isSummon(target) and not isPlayer(target) then
               registerCreatureEvent(target, "ExpGain")
       end
       return true
end

 

Testa e me diz se funcionou.

Link para o comentário
Compartilhar em outros sites

Deu esse erro aqui quando eu ataquei o asassin:

[08/09/2011 22:01:23] [Error - CreatureScript Interface] 
[08/09/2011 22:01:23] data/creaturescripts/scripts/exphit.lua:onStatsChange
[08/09/2011 22:01:23] Description: 
[08/09/2011 22:01:23] data/lib/050-function.lua:777: attempt to concatenate global 'xml' (a nil value)
[08/09/2011 22:01:23] stack traceback:
[08/09/2011 22:01:23] 	data/lib/050-function.lua:777: in function 'getMonsterExperience'
[08/09/2011 22:01:23] 	data/creaturescripts/scripts/exphit.lua:21: in function <data/creaturescripts/scripts/exphit.lua:15>

Link para o comentário
Compartilhar em outros sites

Ahhhhh, o bug não é da função do tfs não. É porque o nome do monstro ta diferente no arquivo dele e no monsters.xml.

 

Só arrumar que vai funcionar tanto com a minha função e o script editado quanto sem a minha função e o script original (aconselho usar o original).

Link para o comentário
Compartilhar em outros sites

  • 2 months later...

não deu certo :/, os zumis não sumiram..

 

Consegui fazer os zumbis sumirem automaticamente, más como as coisas não são perfeitas, comessou a ocorrer este erro:

[07/09/2011 22:18:29] [Error - GlobalEvent Interface]
[07/09/2011 22:18:29] data/globalevents/scripts/zombie/onthink.lua:onThink
[07/09/2011 22:18:29] Description:
[07/09/2011 22:18:29] data/lib/zombie_event.lua:104: bad argument #2 to 'random' (interval is empty)
[07/09/2011 22:18:29] stack traceback:
[07/09/2011 22:18:29] 	[C]: in function 'random'
[07/09/2011 22:18:30] 	data/lib/zombie_event.lua:104: in function 'spawnNewZombie'
[07/09/2011 22:18:30] 	data/globalevents/scripts/zombie/onthink.lua:6: in function <data/globalevents/scripts/zombie/onthink.lua:1>
[07/09/2011 22:18:30] [Error - GlobalEvents::think] Couldn't execute event: ZombieGlobalThink

:winksmiley02:

 

edit: Consegui arrumar tudo :D, agora só falta a 2ª e a 3ª pergunta a serem respondidas =D,

vou te dar rep+ demon, e amanhã eu vou dar pro mulizeu, pq ele ajudou pacas..

xD.. Vlw aê

 

cara.. como vc resolveu esse erro?! eu estou com o mesmo aqui... =\

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...