MoveEvent Hunting Room (No MOD's)

Omson

New Member
Joined
May 16, 2011
Messages
16
Reaction score
0
Location
Poland !
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 :D

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​



  • [*]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"/>


Beztytuup_xesnqqn.png


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

Red

Cyntara.org
Staff member
Global Moderator
Premium User
Joined
Aug 9, 2008
Messages
4,436
Solutions
1
Reaction score
889
Location
United States
It looks like a good script! Could you perhaps translate some of the polish messages to English? :)

Red
 

GodSebbe

Banned User, reason: To Sexy
Joined
Apr 16, 2011
Messages
846
Reaction score
122
Location
Sweden
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 :D

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​



  • [*]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, 'Walked for 10 minutes to a room')
	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, 'Someone is already in the room or you do not have 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, 'Good-bye and welcome back!')
		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"/>


Beztytuup_xesnqqn.png


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​

Tried my best to translate it with google translate :p
 

Vendeliko

Banned User
Joined
Dec 3, 2011
Messages
3,087
Reaction score
90
Location
Beside that guy with that thing but without that t
And for every single monster you need to make new files ?


Polish -> English translation
dragon.lua
Code:
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, 'You entered the room for 10 minutes')
    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, 'Time Up')
                return setGlobalStorageValue(storage_global, -1)
                    end end,
                    10 * 60 * 1000, -- How long can you exp?
                    cid, storage_global)
else
    doTeleportThing(cid, fromPosition)
    return doPlayerSendTextMessage(cid, 25, 'This room is taken or you do not have a VIP coin')
end
return true
end

createmonsterdragon.lua
Code:
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, 'Kill the other one first!') and doTeleportThing(cid, fromPosition) and true
        end
    else
        return true
    end
end

exitdragon.lua
Code:
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, 'Good bye but come back soon!')
        stopEvent(po_czasie)
        stopEvent(teleport)
        end
return true
end
 
OP
Omson

Omson

New Member
Joined
May 16, 2011
Messages
16
Reaction score
0
Location
Poland !
@UP

For each room you need to do separate files, making 27 rooms took me about 3 hours
 

Tachi

New Member
Joined
Aug 4, 2007
Messages
376
Reaction score
2
Location
USA, Missouri
@UP

For each room you need to do separate files, making 27 rooms took me about 3 hours

To bad it doesn't have it where it could have an array for the locations, and each different unique id would chose which location it would then use.
Like the id would be in an array, it'd pull the spot its at, Say second spot, and then it would look at the second array figure in locations and use it.. or w/e.... That way it could all be done within those 3 files, without having to duplicate them like crazy.......
 

Lbtg

Active Member
Joined
Nov 22, 2008
Messages
1,894
Reaction score
42
doesnt work for me on 0.3.6 or i made some mistakes :(

- - - Updated - - -

got bugs on 0.3.6 , could someone fix it works for 0.3.6 ? :)
 

Gubailovo

Member
Joined
Dec 19, 2013
Messages
191
Solutions
1
Reaction score
16
is there for 1.2?
Post automatically merged:

Lua Script Error: [MoveEvents Interface]
data/movements/scripts/hunt/dragon/dragon.lua:eek:nStepIn
LuaScriptInterface::luaAddEvent(). Argument #3 is unsafe
stack traceback:
[C]: at 0x7ff6b7bbebc0
 
Top