• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

MoveEvent HuntArea System

hugq

Member
Joined
Mar 17, 2010
Messages
166
Reaction score
9
Hello. I want to release useful Hunting Room System for Orshabaal Open Tibia Servers (Evo maps, Global Tibia maps), easy to config.
Don't forgot about REP++

Free for edit. (Need function onDeath when player died with storage 654321 then run stopEvent(pauseKick) :])
Enjoy!

Code:


Image how to setup.
2eczzu9.jpg


Basic area:
View attachment map.7z
 
Last edited:
The exhaustion when stepping on the tile doesn't work and it doesn't kick the person from the room after 10 minutes have passed.
 
The exhaustion when stepping on the tile doesn't work and it doesn't kick the person from the room after 10 minutes have passed.
You should stepping on the tile on normal player with groupid 1 (look on your lib exhaustion.lua there is

Code:
if(getPlayerFlagValue(cid, PLAYERFLAG_HASNOEXHAUSTION)) then
return false
end
and on my laptop everything working even kick person - maybe you set incorect v[6] and v[7] on your map, check this on my map (annex)
 
Hello
I have problem, because when I step in tile of id : 10201 then respawn only 1 monster.

[13:43:37.445] [Error - MoveEvents Interface]
[13:43:37.445] domodlib('HuntAreaFunctions')

[13:43:37.445] function onStepIn(cid, item, position, fromPosition)
[13:43:37.445] local b = monsters[item.actionid]
[13:43:37.445] if(isPlayer(cid) and exhaustion.check(cid, item.actionid)) then
[13:43:37.445] doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE
, "You should wait " .. exhaustion.get(cid, item.actionid) .. " seconds.")
[13:43:37.445] elseif (isPlayer(cid)) then
[13:43:37.445] exhaustion.set(cid, item.actionid, 10)
[13:43:37.445] doSummonCreature(b[1], b[2])
[13:43:37.445] doSendMagicEffect(b[2], CONST_ME_TELEPORT)
[13:43:37.445] end
[13:43:37.445] end:eek:nStepIn
[13:43:37.445] Description:
[13:43:37.445] (luaDoCreateMonster) Cannot create monster: Diabolic Imp

Please help.

Me mod.xml

<?xml version="1.0" encoding="UTF-8"?>
<mod name="HuntArea System" version="Tested only on 0.4" author="Hugq" contact="[email protected]" enabled="yes">

<config name="HuntAreaFunctions"><![CDATA[
config = {
-- Teleport AID = v[1], v[2], v[3], v[4], v[5], v[6], v[7] ;]
[10001] = {{x = 4713, y = 2902, z = 7}, {x = 4714, y = 2900, z = 7}, {x = 4714, y = 2905, z = 7}, 10, 8, 2, 2},
[10002] = {{x = 1026, y = 1020, z = 7}, {x = 1027, y = 1018, z = 7}, {x = 1027, y = 1023, z = 7}, 10, 8, 2, 2}
}

monsters = {
-- Tile AID = b[1], b[2] ;]
[10201] = {"Diabolic Imp", {x = 4716, y = 2902, z = 7}},
[10202] = {"Frost Dragon", {x = 1029, y = 1020, z = 7}}
}

function getCreaturesInRange(position, radiusx, radiusy, showMonsters, showPlayers, showSummons)
local creaturesList = {}
for x = -radiusx, radiusx do
for y = -radiusy, radiusy do
if not (x == 0 and y == 0) then
local creature = getTopCreature({x = position.x+x, y = position.y+y, z = position.z})
if (creature.type == 1 and showPlayers) or (creature.type == 2 and showMonsters and (not showSummons or (showSummons and getCreatureMaster(creature.uid) == (creature.uid)))) then
table.insert(creaturesList, creature.uid)
end
end
end
end

local creature = getTopCreature(position)
if (creature.type == 1 and showPlayers) or (creature.type == 2 and showMonsters and (not showSummons or (showSummons and getCreatureMaster(creature.uid) == (creature.uid)))) then
if not(table.find(creaturesList, creature.uid)) then
table.insert(creaturesList, creature.uid)
end
end
return creaturesList
end
]]></config>

<movevent type="StepIn" actionid="10001-10002" event="script"><![CDATA[
domodlib('HuntAreaFunctions')

function onStepIn(cid, item, position, fromPosition)

local v = config[item.actionid]

function kickEvent(cid, item, position, fromPosition)
if (getCreaturesInRange(v[2], v[6], v[7], FALSE, TRUE) ~= 0 and getCreatureStorage(cid, 654321) > 0) then
doTeleportThing(cid, v[3])
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
doCreatureSetStorage(cid, 654321, -1)
doCreatureSay(cid, "You have been kicked out from hunting room.", TALKTYPE_ORANGE_1, false, cid, getThingPos(cid))
end
end

if getPlayerLevel(cid) >= v[5] then
if(getPlayerItemCount(cid, 2157) > 0) then
local players = getCreaturesInRange(v[2], v[6], v[7], FALSE, TRUE)
if #players == 0 then
local creatures = getCreaturesInRange(v[2], v[6], v[7], TRUE, FALSE)
for i = 1, #creatures do
doRemoveCreature(creatures)
end
doSendMagicEffect(position, CONST_ME_TELEPORT)
doTeleportThing(cid, v[1])
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
doPlayerRemoveItem(cid, 2157, 1)
doCreatureSay(cid, "Now you have " .. v[4] .. " minutes for hunting monsters, else you will be kicked out.", TALKTYPE_ORANGE_1, false, cid, getThingPos(cid))
pauseKick = addEvent(kickEvent, v[4] * 60 * 1000, cid)
doCreatureSetStorage(cid, 654321, 1)
return TRUE
else
doCreatureSay(cid, "There is someone else in the room.", TALKTYPE_ORANGE_1, false, cid, fromPosition)
end
else
doCreatureSay(cid, "You don't have enought golden nugget.", TALKTYPE_ORANGE_1, false, cid, fromPosition)
end
else
doCreatureSay(cid, "You must be at least level " .. v[5] .. " or higher to enter.", TALKTYPE_ORANGE_1, false, cid, fromPosition)
end
doTeleportThing(cid, fromPosition)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
return TRUE
end
]]></movevent>

<movevent type="StepIn" actionid="10101-10102" event="script"><![CDATA[
domodlib('HuntAreaFunctions')

function onStepIn(cid, item, position, fromPosition)
if isPlayer(cid) then
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
doSendMagicEffect(fromPosition, CONST_ME_TELEPORT)
doCreatureSetStorage(cid, 654321, -1)
stopEvent(pauseKick)
end
end]]></movevent>

<movevent type="StepIn" actionid="10201-10202" event="script"><![CDATA[
domodlib('HuntAreaFunctions')

function onStepIn(cid, item, position, fromPosition)
local b = monsters[item.actionid]
if(isPlayer(cid) and exhaustion.check(cid, item.actionid)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You should wait " .. exhaustion.get(cid, item.actionid) .. " seconds.")
elseif (isPlayer(cid)) then
exhaustion.set(cid, item.actionid, 10)
doSummonCreature(b[1], b[2])
doSendMagicEffect(b[2], CONST_ME_TELEPORT)
end
end]]></movevent>
</mod>
 
Hello
I have problem, because when I step in tile of id : 10201 then respawn only 1 monster.



Please help.

Me mod.xml

Are you set correct all positions? Maybe chceck on orginal script with my map.
 
Maybe this for exhaustion:
Code:
function onStepIn(cid, item, position, fromPosition)
	local b = monsters[item.actionid]
	if(isPlayer(cid)) then
if(getPlayerStorageValue(cid, 546546) >= os.time()) then
    doPlayerSendCancel(cid, "You have to wait 10 seconds to create another monster")
	elseif (isPlayer(cid)) then
			doSummonCreature(b[1], b[2])
		doSendMagicEffect(b[2], CONST_ME_TELEPORT)
	    setPlayerStorageValue(cid, 546546, os.time() + 10)
end
end
end]]></movevent>
 
Back
Top