Hi I would like to present you the Hunting Rooms script, the script is not 100% my own, is made up of clippings from another forum, I noticed that there is not a tutorial, so I decided to write it I'd like to apologize here for my English, the text is translated by Google translator
Let's get started
1. In data/movements/scripts create a new folder called hunt
2. Second In this new folder hunt create 3 files
2. Second In this new folder hunt create 3 files
[*]dragon.lua
[*]createmonsterdragon.lua
[*]exitdragon.lua
2a. In the file dragon.lua paste :
PHP:
function onStepIn(cid, item, pos, fromPosition)
local storage_global = 16591 -- whenever the next room you need to change the value!
if getGlobalStorageValue(storage_global) == -1 then
doPlayerSendTextMessage(cid, 25, 'Wszedles na 10 minut do pomieszczenia')
setGlobalStorageValue(storage_global, 1)
doTeleportThing(cid, {x=32127, y=31860, z=8}) -- Position sqm see picture (welcome)
return addEvent(function()
if isPlayer(cid) and getGlobalStorageValue(storage_global) == 1 then
doTeleportThing(cid, {x=32127, y=31864, z=8}) -- Position sqm see picture (end exp)
doPlayerSendTextMessage(cid, 25, 'Czas minal')
return setGlobalStorageValue(storage_global, -1)
end end,
10 * 60 * 1000, -- How long exp
cid, storage_global)
else
doTeleportThing(cid, fromPosition)
return doPlayerSendTextMessage(cid, 25, 'Ktos juz sie znajduje w roomie lub nie posiadasz Vip Coin!')
end
return true
end
2b. In the file createmonsterdragon.lua paste :
PHP:
local function getCreaturesInRange(fromPosition, toPosition)
local x, y, z = 0, 0, 0
local creatures = {}
for x = fromPosition.x, toPosition.x do
for y = fromPosition.y, toPosition.y do
for z = fromPosition.z, toPosition.z do
local creature = getTopCreature({x = x, y = y, z = z}).uid
if(creature > 0) then
table.insert(creatures, creature)
end
end
end
end
return creatures
end
local function getMonstersInRange(fromPosition, toPosition)
local creatures = getCreaturesInRange(fromPosition, toPosition)
local monsters = {}
for _, creature in ipairs(creatures) do
if(isMonster(creature)) then
table.insert(monsters, creature)
end
end
return monsters
end
local SPECIAL_QUESTS = {2001}
local pos = {from = {x=32124, y=31855, z=8}, to = {x=32130, y=31861, z=8}} -- range of room needed to prevent the creation of more than one monster see a picture (x and y)
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local storage_global = 26545 -- whenever the next room you need to change the value!
if isPlayer(cid) and getGlobalStorageValue(storage_global) == -1 then
mons = getMonstersInRange(pos.from, pos.to)
m = 0
for i = 1, #mons do
if getCreatureName(mons[i]) == 'Dragonl' then -- Monster Name
m = m + 1
end
end
if m == 0 then
doCreateMonster('Dragon', {x=32128, y=31859, z=8}) -- Monster name and respawn ! See picture ( respawn )
return true
else
return doPlayerSendCancel(cid, 'Sorry, creature is now spawned.') and doTeleportThing(cid, fromPosition) and true
end
else
return true
end
end
2c. In the file exitdragon.lua paste :
PHP:
function onStepIn(cid, item, pos, fromPosition)
local storage_global = 16591 -- whenever the next room you need to change the value!
if isPlayer(cid) then
setGlobalStorageValue(storage_global, -1)
doTeleportThing(cid, {x=32127, y=31864, z=8}) -- Position sqm see picture (end exp)
doPlayerSendTextMessage(cid, 25, 'Zegnamy i zapraszamy ponownie!')
stopEvent(po_czasie)
stopEvent(teleport)
end
return true
end
3. In data/movements/movements.xml add :
PHP:
<movevent type="StepIn" uniqueid="2510" event="script" value="hunt/dragon/dragon.lua" />
<movevent type="StepIn" uniqueid="2511" event="script" value="hunt/dragon/createmonsterdragonl.lua"/>
<movevent type="StepIn" uniqueid="2512" event="script" value="hunt/dragon/exitdragon.lua"/>
Please see exactly how they are positioned UniqueID! This is very important!
In case of any problems, please post in the topic I will try to help, I want to emphasize that I am not perfectly set into a scripter so please bear with us, I can always take care of making room for the job. Please comment Regards Omson
Attachments
-
Bez tytułu.jpg15.5 KB · Views: 276 · VirusTotal