What's new

Movements Hunting Room

Status
Not open for further replies.

Lopus

Advanced User
Joined
Jun 17, 2011
Messages
206
Reaction score
9
Testowany na 0.3.6 - 854
Zaczynamy w data/movements/scripts tworz?c tam plik o nazwie hunting.lua i wklejaj?c:
PHP:
local config = {
wejscie = {
time = 7, --w sekundach
storage = 1234 --storage zapisujace czas
},
[8000] = {tps={'x',2}, czas_expa = 10, wielkosc_pokoju = {3,3}, centrum_pokoju = {x=31773,y=32399,z=7},
id={}, czas=4, mon='cyclop smith', p={x=31773,y=32401,z=7}}, --od lewej - wielkosc pokoju w sqm (pozycje 'x', pozycje 'y'), pozycje centrum pokoju, ile trzeba odczeka? do kolejnego summona, nazwa moba, pozycja summona
[8001] = {tps={'x',2}, czas_expa = 10, wielkosc_pokoju = {3,3}, centrum_pokoju = {x=31787,y=32399,z=7},
id={}, czas=4, mon='tortoise', p={x=31787,y=32401,z=7}},
[8002] = {tps={'x',2}, czas_expa = 10, wielkosc_pokoju = {3,3}, centrum_pokoju = {x=31802,y=32399,z=7},
id={}, czas=4, mon='beholder', p={x=31802,y=32401,z=7}},
[8003] = {tps={'x',2}, czas_expa = 10, wielkosc_pokoju = {3,3}, centrum_pokoju = {x=31773,y=32386,z=7},
id={}, czas=4, mon='chicken', p={x=31773,y=32388,z=7}},
[8004] = {tps={'x',2}, czas_expa = 10, wielkosc_pokoju = {3,3}, centrum_pokoju = {x=31787,y=32386,z=7},
id={}, czas=4, mon='elf arcanist', p={x=31787,y=32388,z=7}},
[8005] = {tps={'x',2}, czas_expa = 10, wielkosc_pokoju = {2,2}, centrum_pokoju = {x=1784,y=1135,z=7},
id={}, czas=4, mon='Wiwerna', p={x=1782,y=1136,z=7}},
[8006] = {tps={'x',2}, czas_expa = 10, wielkosc_pokoju = {3,3}, centrum_pokoju = {x=31773,y=32374,z=7},
id={}, czas=4, mon='dwarf guard', p={x=31773,y=32376,z=7}},
[8007] = {tps={'x',2}, czas_expa = 10, wielkosc_pokoju = {3,3}, centrum_pokoju = {x=31787,y=32374,z=7},
id={}, czas=4, mon='dworc venomsniper', p={x=31773,y=32376,z=7}},
[8008] = {tps={'x',2}, czas_expa = 10, wielkosc_pokoju = {3,3}, centrum_pokoju = {x=31802,y=32374,z=7},
id={}, czas=4, mon='beholder', p={x=31802,y=32376,z=7}},
}
function onStepIn(cid, item, pos, frompos, topos)
local v = config[item.actionid]
if v then
if item.itemid == 1387 then
local m, s, x = '', getSpectators(config[item.actionid].centrum_pokoju, config[item.actionid].wielkosc_pokoju[1], config[item.actionid].wielkosc_pokoju[2]), 0
if os.time() < getPlayerStorageValue(cid, config.wejscie.storage) then
return doTeleportThing(cid, frompos) and doCreatureSay(cid, 'Nie mo?esz wej?? na aren? jeszcze przez '..getPlayerStorageValue(cid, config.wejscie.storage) - os.time()..' sekund.', TALKTYPE_ORANGE_1)
end
if s ~= nil then
for i = 1, #s do
if isPlayer(s[i]) then
doTeleportThing(cid, frompos)
return doCreatureSay(cid, 'Kto? znajduje si? w pokoju!', TALKTYPE_ORANGE_1)
elseif getCreatureName(s[i]):lower() == v.mon:lower() then
doRemoveThing(s[i])
end
end
end
if #v.id > 1 then
for i = 1, #v.id/2 do
x = (getPlayerItemCount(cid, v.id[i*2-1]) >= v.id[i*2] and x + 1 or x)
m = m .. getItemNameById(v.id[i*2-1]) .. (i < #v.id/2 and ' ' or '.')
end
end
if x == #v.id/2 then
for i = 1, #v.id/2 do
doPlayerRemoveItem(cid, v.id[i*2-1], v.id[i*2])
end
doPlayerSetStorageValue(cid, config.wejscie.storage, os.time() + v.czas)
local poss = ('_'..frompos.x + (v.tps[1] == 'x' and v.tps[2] or 0)..'_'..frompos.y + (v.tps[1] == 'y' and v.tps[2] or 0)..'_'..frompos.z)
doPlayerSetStorageValue(cid, config.wejscie.storage+1, poss)
doCreateMonster(v.mon, v.p)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE _ORANGE, 'Za '..v.czas_expa..' minut zostaniesz wyrzucony z expa.')
doTeleportThing(cid, v.centrum_pokoju)
return addEvent(function()
if isPlayer(cid) and getPlayerStorageValue(cid, config.wejscie.storage+1) ~= -1 then
doTeleportThing(cid, frompos)
doPlayerSetStorageValue(cid, config.wejscie.storage+1, -1)
doPlayerSetStorageValue(cid, config.wejscie.storage-1, -1)
end end,
v.czas_expa * 60 * 1000,
cid, frompos, config, item.actionid)
end
doTeleportThing(cid, frompos)
return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Nie masz wystarczaj?co du?o '..m)
elseif item.itemid == 5023 then
local l = getPlayerStorageValue(cid, config.wejscie.storage+1):explode('_')
doTeleportThing(cid, {x=l[2],y=l[3],z=l[4]})
doPlayerSetStorageValue(cid, config.wejscie.storage, os.time() + config.wejscie.time)
return doPlayerSetStorageValue(cid, config.wejscie.storage+1, -1)
end
if os.time() < getPlayerStorageValue(cid, config.wejscie.storage) then
return doPlayerSendCancel(cid, 'Nie mo?esz przywo?a? kolejnego potwora jeszcze przez '..getPlayerStorageValue(cid,config.wejscie.storag e)-os.time()..' sekund.')
end
local s = getSpectators(v.centrum_pokoju, v.wielkosc_pokoju[1], v.wielkosc_pokoju[2])
if s ~= nil then
for i = 1, #s do
if getCreatureName(s[i]):lower() == v.mon:lower() then
return doPlayerSendCancel(cid, 'Musisz zabi? poprzednio stworzonego potwora ('..v.mon:lower()..') by wezwa? kolejnego.')
end
end
end
doPlayerSetStorageValue(cid, config.wejscie.storage, os.time() + v.czas)
return doCreateMonster(v.mon, v.p)
end
return true
end
Do movements.xml dodajemy:
PHP:
<movevent type="StepIn" fromaid="8001" toaid="8007" event="script" value="hunting.lua"/>
Idziemy do data/creaturescripts/scripts i tworzymy plik logout.lua i wklejamy:
PHP:
local config = {
storage = 1234
}
function onLogout(cid)
if isPlayer(cid) and getPlayerStorageValue(cid, config.storage+1) ~= -1 then
local l = getPlayerStorageValue(cid, config.storage+1):explode('_')
doTeleportThing(cid, {x=l[2],y=l[3],z=l[4]})
doPlayerSetStorageValue(cid, config.storage, getPlayerStorageValue(cid, config.storage+1))
return doPlayerSetStorageValue(cid, config.storage+1, -1) and true
end
return true
end
Do creaturescripts.xml dodajemy:
PHP:
<event type="logout" name="Logout" event="script" value="logout.lua"/>
Do login.lua dodajemy:
PHP:
registerCreatureEvent(cid, "Logout")
 
Status
Not open for further replies.
Top