• 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!

A script that spawns a Warlock and teleports you to it.

Put action id 10000 on the warlock tile, 10001 on the behemoth tile, 10002 on the morgaroth tile and so on

data/movements/movements.xml:
Code:
<movevent type="StepIn" actionid="10000" toevent="script" value="Summon_tiles.lua" />
<movevent type="StepIn" actionid="10001" event="script" value="Summon_tiles.lua" />
<movevent type="StepIn" actionid="10002" event="script" value="Summon_tiles.lua" />
data/movements/scripts/Summon_tiles.lua:
Lua:
local tiles = {
	[10000] = {monster = "warlock", monsterPos = { x = 123, y = 321, z = 7 }, playerPos = { x = 123, y = 321, z = 7 }},
	[10001] = {monster = "behemoth", monsterPos = { x = 123, y = 321, z = 7 }, playerPos = { x = 123, y = 321, z = 7 }},
	[10002] = {monster = "morgaroth", monsterPos = { x = 123, y = 321, z = 7 }, playerPos = { x = 123, y = 321, z = 7 }},
			}

function onStepIn(cid, item, pos)
		
		local tile = tiles[item.actionid]

		if tile then
			doSummonCreature(tile.monster, tile.monsterPos)
			doTeleportThing(cid, tile.playerPos)
			doSendMagicEffect(tile.playerPos, CONST_ME_TELEPORT)
		end
	return TRUE
end
I have no idea if it will work xD
if you want more monster tiles just add:
Code:
[1000[COLOR="Red"]3[/COLOR]] = {monster = "bear", monsterPos = { x = 123, y = 321, z = 7 }, playerPos = { x = 123, y = 321, z = 7 }},
in the .lua file, and:
Code:
<movevent type="StepIn" actionid="1000[COLOR="Red"]3[/COLOR]" event="script" value="Summon_tiles.lua" />
in movements.xml

EDIT; I think you can replace
Code:
<movevent type="StepIn" actionid="10000" toevent="script" value="Summon_tiles.lua" />
<movevent type="StepIn" actionid="10001" event="script" value="Summon_tiles.lua" />
<movevent type="StepIn" actionid="10002" event="script" value="Summon_tiles.lua" />
with:
Code:
<movevent type="StepIn" actionid="10000-10002" event="script" value="Summon_tiles.lua" />
 
Last edited:
Code:
local tiles =  {
		[10000] = {monster = "Warlock", monsterPos = { x = 123, y = 321, z = 7 }, playerPos = { x = 123, y = 321, z = 7 }},
		[10001] = {monster = "Behemoth", monsterPos = { x = 123, y = 321, z = 7 }, playerPos = { x = 123, y = 321, z = 7 }},
		[10002] = {monster = "Morgaroth", monsterPos = { x = 123, y = 321, z = 7 }, playerPos = { x = 123, y = 321, z = 7 }}
		}

function onStepIn(cid, item, pos)
	doSummonCreature(tiles[item.actionid].monster, tile[item.actionid].monsterPos)
	doTeleportThing(cid, tile[item.actionid].playerPos)
	doSendMagicEffect(tile[item.actionid].playerPos, CONST_ME_TELEPORT)
return true
end
 
Code:
local tiles =  {
		[10000] = {monster = "Warlock", monsterPos = { x = 123, y = 321, z = 7 }, playerPos = { x = 123, y = 321, z = 7 }},
		[10001] = {monster = "Behemoth", monsterPos = { x = 123, y = 321, z = 7 }, playerPos = { x = 123, y = 321, z = 7 }},
		[10002] = {monster = "Morgaroth", monsterPos = { x = 123, y = 321, z = 7 }, playerPos = { x = 123, y = 321, z = 7 }}
		}

function onStepIn(cid, item, pos)
	doSummonCreature(tiles[item.actionid].monster, tile[item.actionid].monsterPos)
	doTeleportThing(cid, tile[item.actionid].playerPos)
	doSendMagicEffect(tile[item.actionid].playerPos, CONST_ME_TELEPORT)
return true
end
and what did you do? its same code. copy/paste?
 
I removed these lines:
Code:
                local tile = tiles[item.actionid]

                if tile then

Because I'm not sure that it would work, I'm not here to steal reputation or anything if that's what you think. I'm here to help.
 
Last edited:
im not saying 'steal rep' im just saying its same script + also i think you have to make a check "if tile then" <- not sure about this.
 
Not Tested

I have no idea if this will work properly. I can't test it at this moment, sorry.

Code:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition)
	local cfg = {
		[1000] = {
			monster = "Warlock",
			pos = {
				{ x = 100, y = 100, z = 7 }, -- Top Left Corner of Spawn Area
				{ x = 100, y = 100, z = 7 }, -- Bottom Right Corner of Spawn Area
				{ x = 100, y = 100, z = 7 } -- Where the Player is teleported
			}
		}
	}
	local v = cfg[item.actionid]
	if(isInRange(getCreaturePosition(v.monster), v.pos[1], v.pos[2])) then
		return false
	else
		doCreateMonster(v.monster,  math.random(v.pos[1], v.pos[2]))
		doTeleportThing(cid, v.pos[3])
	end
	return true
end
 
Code:
	if(isInRange(getCreaturePosition(v.monster), v.pos[1], v.pos[2])) then
		return false
	else
wtf
Code:
	if not isInRange(getCreaturePosition(v.monster), v.pos[1], v.pos[2]) then
and
Code:
local t = {
	[1000] = {
		monster = "Warlock",
		pos = {
			{x = 100, y = 100, z = 7}, -- Top Left Corner of Spawn Area
			{x = 100, y = 100, z = 7}, -- Bottom Right Corner of Spawn Area
			{x = 100, y = 100, z = 7} -- Where the Player is teleported
		}
	}
}
function onStepIn(cid, item, position, fromPosition)
	local v = t[item.actionid]
	if v and not isInRange(getCreaturePosition(v.monster), v.pos[1], v.pos[2]) then
		local a, b = v.pos[1], v.pos[2]
		local pos = {x=math.random(a.x, b.x), y=math.random(a.y, b.y), z=math.random(a.z, b.z)}
		while doCreateMonster(v.monster, pos, false) ~= RETURNVALUE_NOERROR do
			pos = {x=math.random(a.x, b.x), y=math.random(a.y, b.y), z=math.random(a.z, b.z)}
		end
		doTeleportThing(cid, v.pos[3])
	end
end
 
Last edited:
Back
Top