Hell i HATE the raids form the otserv (raids.xml)
so i created a raid function
not too unsefull but fun xD
You can use like this:
Or
Or... use raids.xml if you want more easy ;P
so i created a raid function
not too unsefull but fun xD
Lua:
function raid(mlist,postop,posdown,waves,messges)
waves = waves and waves or mlist.waves or {{100}}
messges =messges and messges or mlist.messges or {}
postop = postop or mlist.postop or error('pos?')
posdown = posdown or mlist.posdown or error('pos?')
function persqm(n,postop,posdown)
if not n then
return nil
end
local x = posdown.x-postop.x
local y = posdown.y-postop.y
local z = posdown.z-postop.z
z = z == 0 and 1 or z
y = y == 0 and 1 or y
x = x == 0 and 1 or x
return math.floor(x*y*z*n)
end
for i=1,#waves do
addEvent(function(mlist,postop,posdown,waves,messges)
local ll = 10^4
local mcount = persqm(mlist.monsterpersqm,postop,posdown) or mlist.monstercount or 10
if messges then
doBroadcastMessage(messges[1],messges[2] or 22)
end
if waves.f then
local r,e = pcall(waves.f,mlist,postop,posdown,waves,messges)
if not r and e then print(e) end
end
if waves[2] then
return
end
for i=1,mcount do
repeat
ll = ll-1
if ll <= 0 then
error('Overstack')
end
local repetir = true
local monst = mlist[math.random(1,#mlist)]
if monst.chance >= math.random(0,10000000) then
if not monst.countmax or monst.countmax ~= 0 then
local pos = {
x=postop.x ~= posdown.x and math.random(postop.x,posdown.x) or postop.x,
y=postop.y ~= posdown.y and math.random(postop.y,posdown.y) or postop.y,
z=postop.z ~= posdown.z and math.random(postop.z,posdown.z) or postop.z}
if doSummonCreature(monst.monster,pos) then
if monst.countmax then
monst.countmax = monst.countmax -1
end
doSendMagicEffect(pos,10)
repetir = false
end
end
end
until repetir
end
end,waves[i][1],mlist,postop,posdown,waves[i],messges[i])
end
end
You can use like this:
Lua:
mlist = {
monsterpersqm=0.30, -- or monstercount = 100
{monster='necromancer',chance=1200000,countmax=false}, -- 12%
{monster='warlock',chance=300000,countmax=5}, -- 3%
{monster='necropharus',chance=100000,countmax=1}, -- 1% -- boss
}
postop={x=252,y=196,z=7}
posdown= {x=338,y=269,z=7}
waves = {
--{int[,bool[,function]]} delay, ignore summon, function to execute
{100,true,f=function(...) for i,b in pairs(getPlayersOnline()) do doCreatureSay(b,'OMG!',3) end end}}
{15000},
{30000},
}
messges={
{'Human attack!!'}, -- execute in first wave
{'Run to the hills!!'}}, -- on second wave
raid(mlist,postop,posdown,waves,messges)
Or
Lua:
local mlist = {
{
postop={x=252,y=196,z=7},
posdown= {x=338,y=269,z=7},
monsterpersqm=0.03,
waves={{100,true},{30000},{60000},{1200000}},
messges={{'Dragon attack!'},{'HALP!!!11'}},
{monster='dragon lord',chance=2500000,countmax=false}, -- 25%
{monster='dragon',chance=6000000,countmax=false}, -- 60%
{monster='dragon hatchling',chance=9000000,countmax=false}, -- 90%
{monster='frost dragon',chance=1000000,countmax=false}, -- 10%
{monster='hydra',chance=1000000,countmax=5}, -- 10%
{monster='serpent spawn',chance=1000000,countmax=5}, -- 10%
{monster='undead dragon',chance=1000000,countmax=5}, -- 10%
-- boss
{monster='demodras',chance=800000,countmax=1},-- 8%
{monster='dracola',chance=200000,countmax=1}, -- 2%
}
raid(mlist)
Or... use raids.xml if you want more easy ;P
Last edited: