• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Zombie Event - Without Bugs! Work on all TFS

please tell me when it done!
 
tfs 0.3.6 dont work, it doesnt start or boradcast smth!
 
i dotn understand this part
:S

ZE_centerRoomPosition = {x=1601,y=1503,z=7}-----i undserstand this
ZE_rX_rY = {22,18}---- But this not
 
i dotn understand this part
:S

ZE_centerRoomPosition = {x=1601,y=1503,z=7}-----i undserstand this
ZE_rX_rY = {22,18}---- But this not

The ZE_rX_rY = {22,18}
This is the size of the room. Example : Count the squares from the left side of the room to the right side, lets pretend it is 30, now count the squares from north to south, lets pretend it is 20. So you would put here ZE_rX_rY = {30,20}.
 
ok i did it but when the event starts it i say !zombie and nothign happen and i add the telport with unique id and nothign happen and give me this error when i stepin on the teleport

[14/12/2011 23:00:31] [Error - MoveEvents Interface]
[14/12/2011 23:00:31] buffer:eek:nStepIn
[14/12/2011 23:00:31] Description:
[14/12/2011 23:00:31] [string "loadBuffer"]:25: attempt to perform arithmetic on global 'players_on_arena_count' (a nil value)
[14/12/2011 23:00:31] stack traceback:
[14/12/2011 23:00:31] [string "loadBuffer"]:25: in function <[string "loadBuffer"]:2>ç


and the teleport not take u to anyware u stay on the same place...


can enyone help me?
 
Last edited:
Try now.

The ZE_rX_rY = {22,18}
This is the size of the room. Example : Count the squares from the left side of the room to the right side, lets pretend it is 30, now count the squares from north to south, lets pretend it is 20. So you would put here ZE_rX_rY = {30,20}.
And this result to divide by 2, so finish result is no {30,20} just {15,10}.
 
Bro still giving me the same error :SS S:S :S:S

[14/12/2011 23:00:31] [Error - MoveEvents Interface]
[14/12/2011 23:00:31] buffernStepIn
[14/12/2011 23:00:31] Description:
[14/12/2011 23:00:31] [string "loadBuffer"]:25: attempt to perform arithmetic on global 'players_on_arena_count' (a nil value)
[14/12/2011 23:00:31] stack traceback:
[14/12/2011 23:00:31] [string "loadBuffer"]:25: in function <[string "loadBuffer"]:2>ç

y put on the ZE_rX_rY = {25,18}. the queares are like a Leter L right¿?

let me send u an imagen of how i am counting the squares

Link: ImageShack? - Online Photo and Video Hosting
 
#up
Now divide to 2. So finish result is 13,10.
Do you change your script on this from my first post?
 
This is My MOD :) jejeje and the cords that i add from my map

<?xml version='1.0' encoding='UTF-8'?>
<mod name='Zombie Event' version='2.0' author='Oskar' contact='http://tibia.net.pl/members/oskar.html' enabled='yes'>
<config name='zombieEvent_conf'><![CDATA[
ZE_REWARDS = {
random = false,
rew = {2160,5,2645,1}
}

ZE_MAX_PLAYERS = 15
ZE_ACCESS_TO_IGNORE_ARENA = 7

-- POSITIONS
ZE_kickPosition = {x=1000,y=1000,z=7}
ZE_enterPosition = {x=1968,y=1006,z=7}

ZE_centerRoomPosition = {x=1953,y=1011,z=7}
ZE_rX_rY = {49,36}

ZE_STATUS = 13300

ZOMBIE = {
['horned mutant'] = {20,1},
['vile centurion'] = {15,2},
['daidalost'] = {10,4},
['mongrel man'] = {5,8},
['propell zombie'] = {2,16},
['scrathclaw'] = {1,32}
}
ZOMBIES = {}
for k, v in pairs(ZOMBIE) do
table.insert(ZOMBIES, k)
end

function chooseMonster()
local monster = false
for k, v in pairs(ZOMBIE) do
monster = monster or (math.random(100) <= v[1] and k or false)
end
return monster or chooseMonster()
end

function isWalkable(pos, creature, proj, pz)
if getTileThingByPos({x=pos.x,y=pos.y,z=pos.z,stackpos=0}).itemid == 0 then return false end
if getTopCreature(pos).uid > 0 and creature then return false end
if getTileInfo(pos).protection and pz then return false, true end
local n = not proj and 3 or 2
for i = 0, 255 do
pos.stackpos = i
local tile = getTileThingByPos(pos)
if tile.itemid ~= 0 and not isCreature(tile.uid) then
if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
return false
end
end
end
return true
end

local _f = doTeleportThing
function doTeleportThing(cid, newpos, pushmove, ignoreBlocking)
return (ignoreBlocking or isWalkable(newpos, true, true, false) or false) and _f(cid, newpos, pushmove)
end

function getPlayerZombiesEventStatus(cid)
return getCreatureStorage(cid, ZE_STATUS)
end

function setPlayerZombiesEventStatus(cid, value)
doCreatureSetStorage(cid, ZE_STATUS, value)
end

function getZombiesEventPlayers()
local players = {}
for _, cid in pairs(getPlayersOnline()) do
if getPlayerZombiesEventStatus(cid) == 1 then
table.insert(players, cid)
end
end
return players
end

function kickPlayerFromZombiesArea(cid)
doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
doTeleportThing(cid, ZE_kickPosition, true, true)
doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
return setPlayerZombiesEventStatus(cid, 0)
end

function loseOnZombieArena(cid)
local players, msg = getZombiesEventPlayers(), ''
doCreatureSetStorage(cid, ZE_STATUS+1, 0)
kickPlayerFromZombiesArea(cid)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You are dead.')
if(#getZombiesEventPlayers() <= 1) then
local winner = getZombiesEventPlayers()[1] or players[1]
if winner then
if ZE_REWARDS.random then
local i = math.random(#ZE_REWARDS.rew/2)
doPlayerAddItem(winner, ZE_REWARDS.rew[i*2-1], ZE_REWARDS.rew[i*2], true)
else
for i = 1, #ZE_REWARDS.rew/2 do
doPlayerAddItem(winner, ZE_REWARDS.rew[i*2-1], ZE_REWARDS.rew[i*2], true)
end
end
doPlayerSendTextMessage(winner, MESSAGE_STATUS_CONSOLE_BLUE, 'You won zombie event.')
msg = getCreatureName(winner) .. ' won Zombie Event'
kickPlayerFromZombiesArea(winner)
if getSpectators(ZE_centerRoomPosition, ZE_rX_rY[1], ZE_rX_rY[2]) then
for _, v in ipairs(getSpectators(ZE_centerRoomPosition, ZE_rX_rY[1], ZE_rX_rY[2])) do
if isMonster(v) then
doRemoveThing(v)
end
end
end
else
msg = 'Zombie event finished! No one win!'
end
doSetStorage(ZE_STATUS, 0)
end
return (msg ~= '' and doBroadcastMessage(msg) or true)
end

function addPlayerToZombiesArea(cid)
doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
doTeleportThing(cid, ZE_enterPosition, true, true)
doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
if getPlayerAccess(cid) < ZE_ACCESS_TO_IGNORE_ARENA then
setPlayerZombiesEventStatus(cid, 1)
end
end

function spawnNewZombie(fromPosition, n)
local n, pos = n or 0, {x = ZE_centerRoomPosition.x + math.random(-ZE_rX_rY[1],ZE_rX_rY[1]), y = ZE_centerRoomPosition.y + math.random(-ZE_rX_rY[2],ZE_rX_rY[2]), z = ZE_centerRoomPosition.z}
if isWalkable(pos, true, true, true) then
local monster = chooseMonster()
local cid = doCreateMonster((monster == '' and 'horned mutant' or monster), pos, false, false, false)
doSendMagicEffect(pos, CONST_ME_MORTAREA)
return (isMonster(cid) and registerCreatureEvent(cid, 'zombieEventDeath') and registerCreatureEvent(cid, 'zombieEventThink')) and (fromPosition and doSendDistanceShoot(fromPosition, pos, CONST_ANI_SUDDENDEATH) or true)
end
return (n < 200 and spawnNewZombie(fromPosition, n+1) or true)
end

function getExhausted(cid, storage)
return os.time() >= getCreatureStorage(cid, storage) and true or false
end

function setExhausted(cid, storage, cooldown)
return doCreatureSetStorage(cid, storage, os.time() + cooldown)
end
]]></config>

<event type='death' name='zombieEventDeath' event='script'><![CDATA[
domodlib('zombieEvent_conf')
function onDeath(cid)
for i = 1, math.random(2) do
spawnNewZombie(getThingPos(cid))
end
doSendMagicEffect(getThingPos(cid), CONST_ME_MORTAREA)
return doCreatureSay(cid, 'I\'ll be back!', TALKTYPE_ORANGE_1)
end
]]></event>

<event type='think' name='zombieEventThink' event='script'><![CDATA[
domodlib('zombieEvent_conf')
function onThink(cid)
local name, target = getCreatureName(cid):lower(), getCreatureTarget(cid)
if isMonster(cid) and isInArray(ZOMBIES, name) and ZOMBIE[name] and isPlayer(getCreatureTarget(cid)) then
if getExhausted(target, ZE_STATUS+1) and getDistanceBetween(getThingPos(target), getThingPos(cid)) <= 1 and math.random(100) <= ZOMBIE[name][2] then
doSendAnimatedText(getThingPos(target), 'INFECTED!', COLOR_LIGHTGREEN)
setExhausted(target, ZE_STATUS+1, 3)
doPlayerSendTextMessage(target, MESSAGE_STATUS_CONSOLE_BLUE, 'You are infected. You can cure, just say "disable infection" or use antidote potion.')
return addEvent(function()
if getExhausted(target, ZE_STATUS+1) then
return false
end
doCreatureAddHealth(target, getCreatureMaxHealth(target))
return loseOnZombieArena(target) end,
3000,
target)
end
end
return true
end
]]></event>

<talkaction words='disable' event='script'><![CDATA[
domodlib('zombieEvent_conf')
function onSay(cid, words, param, channel)
if getExhausted(cid, ZE_STATUS+1) or param ~= 'infection' then
return false
end
doSendAnimatedText(getThingPos(cid), 'CURE!', COLOR_LIGHTBLUE)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You use an antidote on infection.')
return doCreatureSetStorage(cid, ZE_STATUS+1, 0)
end
]]></talkaction>

<event type='statschange' name='zombieEventStatsChange' event='script'><![CDATA[
domodlib('zombieEvent_conf')
function onStatsChange(target, cid, changetype, combat, value)
if isMonster(cid) and isPlayer(target) and isInArray(ZOMBIES, getCreatureName(cid):lower()) and changetype == STATSCHANGE_HEALTHLOSS and math.abs(value) >= getCreatureHealth(target) then
doCreatureAddHealth(target, getCreatureMaxHealth(target))
return loseOnZombieArena(target) and false
end
return true
end
]]></event>

<globalevent name='zombieStart' type='start' event='script'><![CDATA[
domodlib('zombieEvent_conf')
function onStartup()
return doSetStorage(ZE_STATUS, 0)
end
]]></globalevent>

<moveevent type='stepIn' uniqueid='3000' event='script'><![CDATA[
domodlib('zombieEvent_conf')
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local msg = ''
if isPlayer(cid) then
if getCreatureCondition(cid, CONDITION_INFIGHT) and getPlayerAccess(cid) <= ZE_ACCESS_TO_IGNORE_ARENA then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You are in PZ!')
end
if getPlayerAccess(cid) > ZE_ACCESS_TO_IGNORE_ARENA then
if getStorage(ZE_STATUS) ~= 1 then
doSetStorage(ZE_STATUS, 1)
doBroadcastMessage('Zombie Arena Event is started. If you want join to event say !zombie join or enter the teleport in depot. We wait on '..ZE_MAX_PLAYERS..' players.')
end
return addPlayerToZombiesArea(cid)
elseif #getZombiesEventPlayers() < ZE_MAX_PLAYERS and getStorage(ZE_STATUS) == 1 then
setPlayerZombiesEventStatus(cid, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You are player of number '..#getZombiesEventPlayers()..', which join to event.')
if #getZombiesEventPlayers() == ZE_MAX_PLAYERS then
doSetStorage(ZE_STATUS, 2)
spawnNewZombie()
for _, v in ipairs(getZombiesEventPlayers()) do
addPlayerToZombiesArea(cid)
end
msg = 'Zombie Event is started.'
else
msg = getCreatureName(cid) .. ' has entered a Zombie Arena. We still need ' .. ZE_MAX_PLAYERS - players_on_arena_count .. ' players.'
end
return (msg ~= '' and doBroadcastMessage(msg) or true)
else
return doTeleportThing(cid, fromPosition, true, true) and doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Arena is full.')
end
end
return true
end
]]></moveevent>

<talkaction words='!zombie' event='script'><![CDATA[
domodlib('zombieEvent_conf')
function onSay(cid, words, param, channel)
local msg = ''
if param:lower() == 'join' then
if getCreatureCondition(cid, CONDITION_INFIGHT) and getPlayerAccess(cid) <= ZE_ACCESS_TO_IGNORE_ARENA then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You are in PZ!')
end
if getPlayerAccess(cid) > ZE_ACCESS_TO_IGNORE_ARENA then
if getStorage(ZE_STATUS) ~= 1 then
doSetStorage(ZE_STATUS, 1)
doBroadcastMessage('Zombie Arena Event is started. If you want join to event say !zombie join or enter the teleport in depot. We wait on '..ZE_MAX_PLAYERS..' players.')
end
return addPlayerToZombiesArea(cid)
elseif #getZombiesEventPlayers() < ZE_MAX_PLAYERS and getStorage(ZE_STATUS) == 1 then
doCreatureSetNoMove(cid, true)
setPlayerZombiesEventStatus(cid, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You are player of number '..#getZombiesEventPlayers()..', which join to event.')
if #getZombiesEventPlayers() == ZE_MAX_PLAYERS then
doSetStorage(ZE_STATUS, 2)
spawnNewZombie()
for _, v in ipairs(getZombiesEventPlayers()) do
addPlayerToZombiesArea(cid)
doCreatureSetNoMove(v, false)
end
msg = 'Zombie Event is started.'
else
msg = getCreatureName(cid) .. ' has entered a Zombie Arena. We still need ' .. ZE_MAX_PLAYERS - players_on_arena_count .. ' players.'
end
return (msg ~= '' and doBroadcastMessage(msg) or true)
else
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Arena is full.')
end
elseif param:lower() == 'leave' then
if getStorage(ZE_STATUS) < 2 then
setPlayerZombiesEventStatus(cid, 0)
return doCreatureSetNoMove(cid, false)
end
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You are on arena.')
end
return true
end
]]></talkaction>

<globalevent name="zombieTime" time="23:01" event="script"><![CDATA[
domodlib("zombieEvent_conf")
function onTime(time)
doSetStorage(ZE_STATUS, 1)
return doBroadcastMessage('Zombie Arena Event is started. If you want join to event say !zombie join or enter the teleport in depot. We wait on '..ZE_MAX_PLAYERS..' players.')
end
]]></globalevent>

<event type="login" name="zombieEventLogin" event="buffer"><![CDATA[
registerCreatureEvent(cid, 'zombieEventStatsChange')
]]></event>
</mod>




Adn this the Error

[14/12/2011 23:00:31] [Error - MoveEvents Interface]
[14/12/2011 23:00:31] bufferImagen enviadanStepIn
[14/12/2011 23:00:31] Description:
[14/12/2011 23:00:31] [string "loadBuffer"]:25: attempt to perform arithmetic on global 'players_on_arena_count' (a nil value)
[14/12/2011 23:00:31] stack traceback:
[14/12/2011 23:00:31] [string "loadBuffer"]:25: in function <[string "loadBuffer"]:2>ç
 
Back
Top