What's new

Mods Raa Hunting Rooms

Status
Not open for further replies.

Raa

Senior User
Joined
Aug 9, 2009
Messages
715
Reaction score
50
Age
29
Chcia?bym z wami si? dzi? czym? podzieli?, a mianowicie chodzi o moje wykonanie jak?e popularnego systemu, jakim jest "Hunting Rooms".

Opis:
Zabiera wymagany przedmiot
(Je?li go nie masz, to nie wejdziesz)

-Tylko jeden gracz mo?e si? znajdowa? w pokoju

-Je?li jest zaj?te, a kto? pr?buje wej?? wy?wietla si? komunikat.

-Jak kto? wyjdzie z pokoju musi odczeka? X sekund aby ponownie wej??
(ale drugi gracz mo?e wej?? od razu)

-Gracz ma okre?lony czas na expienie, po up?ywie tego czas zostaje wyrzucony z pokoju

-Mo?na wyj?? przed czasem je?li si? tylko chce

-Potwora si? wybiera komend? np. "!area demon"

-Dodawanie nowych aren jest b. proste, nie trzeba ustala? ich pozycji. Wystarczy ustawi? aid.




No nic.
Foto:
jtds.jpg


Skrypt: [LUA]<?xml version="1.0" encoding="utf-8"?>
<mod name="Raa Hunting Area" version="1.0" author="Rabbcio" contact="raaevo24.pl" enabled="yes">
<config name="RaaHunting_Area"><![CDATA[

atileaid = 7555

MONSTER_NAME_STORAGE = 3155
FROM_WAVE_TIME = 15
MONSTER_COUNT = 4

GOLD_NUGGET_ID = 2157
GOLD_NUGGET_NAME = 'gold nugget'
GOLD_NUGGETS_MAX = 6
ARENA_LENGHT_X = 7
LENGHT_FROM_PLAYER_X = -3
CENTER_POS_FROM_PLAYER_X = 0
ARENA_LENGHT_Y = 7
LENGHT_FROM_PLAYER_Y = -9
CENTER_POS_FROM_PLAYER_Y = -6

function cleanArea(pos)
local startpos={x=pos.x+LENGHT_FROM_PLAYER_X, y=pos.y+LENGHT_FROM_PLAYER_Y, z=pos.z}
local endpos={x=startpos.x+ARENA_LENGHT_X, y=startpos.y+ARENA_LENGHT_Y, z=startpos.z}
for xx=startpos.x, endpos.x do
for yy=startpos.y, endpos.y do
local npos={x=xx, y=yy, z=pos.z}
if getTopCreature(npos).uid ~= 0 then
doRemoveCreature(getTopCreature(npos).uid)
end
end
end
return true
end

function checkPlayerIsIn(pos)
local startpos={x=pos.x+LENGHT_FROM_PLAYER_X, y=pos.y+LENGHT_FROM_PLAYER_Y, z=pos.z}
local endpos={x=startpos.x+ARENA_LENGHT_X+1, y=startpos.y+ARENA_LENGHT_Y+1, z=startpos.z}
for xx=startpos.x, endpos.x do
for yy=startpos.y, endpos.y do
local npos={x=xx, y=yy, z=pos.z}
if getTopCreature(npos).uid ~= 0 then
if isPlayer(getTopCreature(npos) == true) then
return true
end
end
end
end
return false
end

function teleportToArea(cid)
local ppos = getCreaturePosition(cid)
local npos = {x=ppos.x+CENTER_POS_FROM_PLAYER_X, y=ppos.y+CENTER_POS_FROM_PLAYER_Y, z=ppos.z}
doTeleportThing(cid, npos, false, false)
end

function setBackTeleport(cid, count, pos)
if cid <= 1 then
return true
end
local tpos= getTownTemplePosition(getPlayerTown(cid))
doTeleportThing(cid, tpos, false, false)
return true
end

function getGoldNuggetPos(pos)
return {x=pos.x, y=pos.y-1, z=pos.z}
end

function makeWave(cid, count)
local monsterName=getPlayerStorageValue(cid, MONSTER_NAME_STORAGE)
for i=1, count do
if monsterName~=-1 then
monster = doCreateMonster(monsterName, getPlayerPosition(cid), false)
registerCreatureEvent(monster.uid, monsterdeath)
end
end
end
]]></config>

<talkaction words='!area' event='script'><![CDATA[
domodlib('RaaHunting_Area')
function onSay(cid, words, param, channel)
local ppos = getCreaturePosition(cid)
local tile = getTileItemById(ppos, 426)
local nugget = getTileItemById(getGoldNuggetPos(ppos), GOLD_NUGGET_ID)

local monsterName=getPlayerStorageValue(cid, MONSTER_NAME_STORAGE)


doPlayerSendCancel(cid, monsterName)
--------------------CHECK------------------
if not tile or tile.actionid ~= atileaid then
return true
end
if nugget.type == 0 then
doPlayerSendCancel(cid, "Put "..GOLD_NUGGET_NAME.."s to right place. [1 "..GOLD_NUGGET_NAME.." - 10 min]")
return true
end
if param=='' or not getMonsterInfo(param) then
doPlayerSendCancel(cid, "Invalid params. Say !area monster_name.")
return true
end
if checkPlayerIsIn(ppos) == true then
doPlayerSendCancel(cid, "This hunting area is already in use.")
return true
end

if nugget.type > GOLD_NUGGETS_MAX then
doPlayerSendCancel(cid, "A lot of "..GOLD_NUGGET_NAME.."s. ["..GOLD_NUGGETS_MAX.." max]")
return true
end

-------------------------------------------
doRemoveItem(nugget.uid, nugget.type)
setPlayerStorageValue(cid, MONSTER_NAME_STORAGE, param)
cleanArea(ppos)
teleportToArea(cid)
local tm=nugget.type*10
doPlayerSendTextMessage(cid, 22, "You have "..tm.." minutes to hunt "..getPlayerStorageValue(cid, MONSTER_NAME_STORAGE)..".")
local time = nugget.type*1000*60*10
addEvent(setBackTeleport, time, cid, nugget.type, ppos)
return true
end
]]>
</talkaction>
<moveevent type='stepIn' actionid='7555' event='script'><![CDATA[
domodlib('RaaHunting_Area')
function onStepIn(cid, item, position, fromPosition)
if checkPlayerIsIn(position) then
doPlayerSendCancel(cid, "This hunting area is already in use.")
doTeleportThing(cid, fromPosition, false, false)
return true
end
doPlayerSendTextMessage(cid, 22, "Put "..GOLD_NUGGET_NAME.."s(1 "..GOLD_NUGGET_NAME.." - 10min) to counter, and say '!area monster_name'.")
return true
end
]]></moveevent>

<moveevent type='stepIn' actionid='7556' event='script'><![CDATA[
domodlib('RaaHunting_Area')
function onStepIn(cid, item, position, fromPosition)
if exhaustion.make(cid, 5111, FROM_WAVE_TIME) then
makeWave(cid, MONSTER_COUNT)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You must wait "..exhaustion.get(cid, 5111).." secs.")
end
return true
end
]]></moveevent>
<event type="death" name="monsterdeath" event="script"><![CDATA[
domodlib('RaaHunting_Area')
function onDeath(cid, corpse, deathList)
doRemoveItem(corpse.uid)
end
]]>
</event>
</mod>[/LUA]
Skrypt wrzucamy do folderu mods i nazywamy go jak nam si? chce.
Mapa:

ps.
Skrypt w niekt?rych miejscach jest nieco ym. prymitywny, mo?liwe te?, ?e niedoko?czony, ale nie jest to ju? moja sprawa.
 
Status
Not open for further replies.
Top