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

Multi teleports with storages

Cloow

Active Member
Joined
May 10, 2010
Messages
1,086
Reaction score
35
I have no idea if this is even possible, i've been testing some stuff but cant get it to work.
Anyway, when a player enter a certain tile the player will get teleported to the storage id it has.


This is the one I need help with, I guess "checkpoint) then" is where it gets the error
Lua:
local CHECKPOINT_TELEPORT = {
	[10001] = pos = {x = 1023, y = 1017, z = 6, stackpos = 1}},
	[10002] = pos = {x = 1023, y = 1017, z = 5, stackpos = 1}}
}
function onStepIn(cid, item, position, fromPosition)
	local checkpoint = CHECKPOINT_TELEPORT
        if(isPlayer(cid) and getCreatureStorage(cid, checkpoint) then
		doTeleportThing(cid, checkpoint.pos, false, true)
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
		doSendMagicEffect(checkpoint.pos, CONST_ME_TELEPORT)
	end
	return false
end
-----------------------------------------------------------------------------------

Lua:
function onStepIn(cid, item, position, fromPosition)
	local pos = getCreaturePosition(cid)
	if(isPlayer(cid) and getCreatureStorage(cid, 10001, < 1) then
		doCreatureSetStorage(cid, 10001, 1)
		doCreatureSay(cid, "You've reached Floor [1]", TALKTYPE_MONSTER)
		doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
	else
		doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
	end
	return true
end


This will remove floor 1 storage
Lua:
function onStepIn(cid, item, position, fromPosition)
	local pos = getCreaturePosition(cid)
	if(isPlayer(cid) and getCreatureStorage(cid, 10002, < 1) then
		doCreatureSetStorage(cid, 10002, 1)
		doSetStorage(10001, -1)
		doCreatureSay(cid, "You've reached Floor [2]", TALKTYPE_MONSTER)
		doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
	else
		doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
	end
	return true
end
 
Last edited:
Mean something like this?

Code:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local v,p = getThingPos(cid),{x=1071,y=1135,z=8}	
	if isPlayer(cid) then
		if getPlayerLevel(cid) >= 25000 then
			doTeleportThing(cid,p)
			doSendMagicEffect(p,10)
		else
			doTeleportThing(cid,fromPosition)
			doSendMagicEffect(p,10)
			doPlayerSendTextMessage(cid,27,'Only players of level 25.000 and higher are allowed to pass.')
		end
	end
	return true
end
 
Maybe this?
Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)

local config = {
	--[UID OF TP] = {storage = STORAGE NUMBER, position = {x=x, y=y, z=z}},
		[2250] = {storage = 10001, position = {x=746, y=1215, z=9}, msg = "You've reached Floor [1]"},
		[2251] = {storage = 10001, position = {x=746, y=1215, z=9}, msg = "You've reached Floor [2]"}
}

local tp = config[item.uid]
if tp then
	if isPlayer(cid) then
		if getCreatureStorage(cid, tp.storage) then
			doTeleportThing(cid, tp.position, false, true)
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
			doSendMagicEffect(tp.position, CONST_ME_TELEPORT)
		end
	end
end
return true
end
 
Maybe this?
Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)

local config = {
	--[UID OF TP] = {storage = STORAGE NUMBER, position = {x=x, y=y, z=z}},
		[2250] = {storage = 10001, position = {x=746, y=1215, z=9}, msg = "You've reached Floor [1]"},
		[2251] = {storage = 10001, position = {x=746, y=1215, z=9}, msg = "You've reached Floor [2]"}
}

local tp = config[item.uid]
if tp then
	if isPlayer(cid) then
		if getCreatureStorage(cid, tp.storage) then
			doTeleportThing(cid, tp.position, false, true)
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
			doSendMagicEffect(tp.position, CONST_ME_TELEPORT)
		end
	end
end
return true
end

Thanks alot :)




but theres one more thing
in floor 1 and 2 scripts the console says "unexpected symbol near '~='"
floor 1
Lua:
function onStepIn(cid, item, position, fromPosition)
	local pos = getCreaturePosition(cid)
	if(isPlayer(cid) and getCreatureStorage(cid, 10001, ~= 1) then
		doCreatureSetStorage(cid, 10001, 1)
		doCreatureSay(cid, "You've reached Floor [1]", TALKTYPE_MONSTER)
		doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
	else
		doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
	end
	return true
end
floor 2
Lua:
function onStepIn(cid, item, position, fromPosition)
	local pos = getCreaturePosition(cid)
	if(isPlayer(cid) and getCreatureStorage(cid, 10002, ~= 1) then
		doCreatureSetStorage(cid, 10002, 1)
		doCreatureSetStorage(cid, 10001, -1)
		doCreatureSay(cid, "You've reached Floor [2]", TALKTYPE_MONSTER)
		doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
	else
		doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
	end
	return true
end
 
getCreatureStorage() has only 2 params you have to do it like:
Lua:
getCreatureStorage(cid, 10002) ~= 1 then


kind regards, Evil Hero
 
getCreatureStorage() has only 2 params you have to do it like:
Lua:
getCreatureStorage(cid, 10002) ~= 1 then


kind regards, Evil Hero

Thank you :)

- - - Updated - - -

I have another script, Im not quite sure why this wont work.

It's INQ teleports, kill monster teleports creates and removes after x seconds.

Lua:
local monsters = 
{
	["Floor 1 [BOSS]"] = {teleportPos = {x = 1044, y = 1009, z = 7, stackpos = 1}, toPos = {x = 1023, y = 1017, z = 6}},
	["Floor 2 [BOSS]"] = {teleportPos = {x = 1005, y = 1013, z = 6, stackpos = 1}, toPos = {x = 1023, y = 1017, z = 5}},
	["Floor 3 [BOSS]"] = {teleportPos = {x = 1005, y = 1024, z = 5, stackpos = 1}, toPos = {x = 1023, y = 1017, z = 4}}
}
function onKill(cid, target, lastHit)	
local time = 60 -- in seconds
local t = monsters[getCreatureName(target)]	
	if(monsters[getCreatureName(target)]) then
		doCreateTeleport(1387, t.toPos, t.teleportPos)
		doSendMagicEffect(t.teleportPos, CONST_ME_POFF)
		doCreatureSay(cid, "The teleport to next floor will be removed in 60 seconds.", TALKTYPE_MONSTER, getCreaturePosition(target))
		addEvent(doRemoveTeleport, time * 1000, t.teleportPos)
	end
return true
end
function doRemoveTeleport(position)
	if(getTileThingByPos(position).itemid > 0) then
		doRemoveItem(getTileThingByPos(position).uid)
		doSendMagicEffect(position, CONST_ME_POFF)
	end
end

in login.lua
Lua:
registerCreatureEvent("tfm")

Lua:
	    <script>
        <event name="tfm"/>
    </script>

SjWo7.png
 
Lua:
	    <script>
        <event name="tfm"/>
    </script>

You don't have to insert it into the monster.xml file
remove it from the monster files else your console error will still occur.

You have to insert it into creaturescripts.xml:
Lua:
<event type="kill" name="tfm" event="script" value="file_name.lua"/>


kind regards, Evil Hero
 
Lua:
	    <script>
        <event name="tfm"/>
    </script>

You don't have to insert it into the monster.xml file
remove it from the monster files else your console error will still occur.

You have to insert it into creaturescripts.xml:
Lua:
<event type="kill" name="tfm" event="script" value="file_name.lua"/>


kind regards, Evil Hero

Haha, oh tought I had to register the monster >.<

- - - Updated - - -

Still getting the error and no teleport appears after death :eek:

2FprZG.png
 
Last edited:
try
Lua:
doCreateTeleport(1387, t.toPos, getCreaturePosition(target))
addEvent(doRemoveTeleport, time * 1000, getCreaturePosition(target))

and are you 100% sure you removed it from all monster files because this just occurs if you put it on a monster file.
 
Yep, im 100% I removed them.





current script
Lua:
 <event type="kill" name="tfm" event="script" value="tfm.lua"/>
Lua:
local monsters = 
{
	["Floor 1 [BOSS]"] = {toPos = {x = 1023, y = 1017, z = 6}},
	["Floor 2 [BOSS]"] = {toPos = {x = 1023, y = 1017, z = 5}},
	["Floor 3 [BOSS]"] = {toPos = {x = 1023, y = 1017, z = 4}}
}
function onKill(cid, target, lastHit)	
local time = 60 -- in seconds
local t = monsters[getCreatureName(target)]	
	if(monsters[getCreatureName(target)]) then
		doCreateTeleport(1387, t.toPos, getCreaturePosition(target))
		doSendMagicEffect(t.teleportPos, CONST_ME_POFF)
		doCreatureSay(cid, "The teleport to next floor will be removed in 60 seconds.", TALKTYPE_MONSTER, getCreaturePosition(target))
		addEvent(doRemoveTeleport, time * 1000, getCreaturePosition(target))
	end
return true
end
function doRemoveTeleport(position)
	if(getTileThingByPos(position).itemid > 0) then
		doRemoveItem(getTileThingByPos(position).uid)
		doSendMagicEffect(position, CONST_ME_POFF)
	end
end

login.lua
Lua:
registerCreatureEvent("tfm")

and still getting

".. login.lua:eek:nLogin description: <luaRegisterCreatureEvent> Creature not found"


Is there another function for "doTeleportThing"?
2FprZG.png


- - - Updated - - -

Maybe this?
Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)

local config = {
	--[UID OF TP] = {storage = STORAGE NUMBER, position = {x=x, y=y, z=z}},
		[2250] = {storage = 10001, position = {x=746, y=1215, z=9}, msg = "You've reached Floor [1]"},
		[2251] = {storage = 10001, position = {x=746, y=1215, z=9}, msg = "You've reached Floor [2]"}
}

local tp = config[item.uid]
if tp then
	if isPlayer(cid) then
		if getCreatureStorage(cid, tp.storage) then
			doTeleportThing(cid, tp.position, false, true)
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
			doSendMagicEffect(tp.position, CONST_ME_TELEPORT)
		end
	end
end
return true
end

I've been trying to remodify this script so many times now, still getting the doTeleport error.
8n250q.png

I think the function cant read 2 diffrent positions.

Heres my current script
Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) 
local config = {
	{storage = 10001, position = {x=1023, y=1017, z=6}, msg = "Floor [1]"}, 
	{storage = 10002, position = {x=1023, y=1017, z=5}, msg = "Floor [2]"}
}
if isPlayer(cid) then
	if getCreatureStorage(cid, config.storage) then
	doTeleportThing(cid, config.position)
	doSendMagicEffect(getCreaturePosition(cid),CONST_ME_TELEPORT)
	doSendMagicEffect(config.position, CONST_ME_TELEPORT)
		else
	doPlayerSendCancel(cid, "You can't go there right now")
	end
end
return true
end
 
Last edited:
XML:
<movevent type="StepIn" actionid="2250;2251" event="script" value="teleports.lua"/>
Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) 

local config = {
	--[UID OF TP] = {storage = STORAGE NUMBER, position = {x=x, y=y, z=z}},
		[2250] = {storage = 10001, position = {x=1023, y=1017, z=6}, msg = "Floor [1]"},
		[2251] = {storage = 10002, position = {x=1023, y=1017, z=5}, msg = "Floor [2]"}
}

local tp = config[item.uid]
if isPlayer(cid) then
if getCreatureStorage(cid, tp.storage) > 0 then
	doTeleportThing(cid, tp.position)
	doSendMagicEffect(getCreaturePosition(cid),CONST_ME_TELEPORT)
	doSendMagicEffect(tp.position, CONST_ME_TELEPORT)
	else
	doPlayerSendCancel(cid, "You can't go there right now")
	end
end
return true
end
 
XML:
<movevent type="StepIn" actionid="2250;2251" event="script" value="teleports.lua"/>
Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) 

local config = {
	--[UID OF TP] = {storage = STORAGE NUMBER, position = {x=x, y=y, z=z}},
		[2250] = {storage = 10001, position = {x=1023, y=1017, z=6}, msg = "Floor [1]"},
		[2251] = {storage = 10002, position = {x=1023, y=1017, z=5}, msg = "Floor [2]"}
}

local tp = config[item.uid]
if isPlayer(cid) then
if getCreatureStorage(cid, tp.storage) > 0 then
	doTeleportThing(cid, tp.position)
	doSendMagicEffect(getCreaturePosition(cid),CONST_ME_TELEPORT)
	doSendMagicEffect(tp.position, CONST_ME_TELEPORT)
	else
	doPlayerSendCancel(cid, "You can't go there right now")
	end
end
return true
end

Thanks, I wanted the the same teleport to take you to all locations so instead where UID is it's the same uid for all teleports.
Script runs and execute but when walking I have storageid 10001 I wont get teleported, but with 10002 it works.

Lua:
<movevent type="StepIn" actionid="10000" event="script" value="chp/start.lua"/>

Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) 
 
local config = {
	--[AID OF TP] = {storage = STORAGE NUMBER, position = {x=x, y=y, z=z}},
		[10000] = {storage = 10001, position = {x=1023, y=1017, z=6}, msg = "Floor [1]"},
		[10000] = {storage = 10002, position = {x=1023, y=1017, z=5}, msg = "Floor [2]"}
}
 
local tp = config[item.uid]
if isPlayer(cid) then
if getCreatureStorage(cid, tp.storage) >= 0 then
	doTeleportThing(cid, tp.position)
	doSendMagicEffect(getCreaturePosition(cid),CONST_ME_TELEPORT)
	doSendMagicEffect(tp.position, CONST_ME_TELEPORT)
	else
	doPlayerSendCancel(cid, "You can't go there right now")
	end
end
return true
end


These are the scripts where you obtain the storageid
fl1.lua
Lua:
function onStepIn(cid, item, position, fromPosition)
	local pos = getCreaturePosition(cid)
	if(isPlayer(cid) and getCreatureStorage(cid, 10001) ~= 1) then
		doCreatureSetStorage(cid, 10001, 1)
		doCreatureSay(cid, "You've reached Floor [1]", TALKTYPE_MONSTER)
		doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
	end
	return true
end
fl2.lua
Lua:
function onStepIn(cid, item, position, fromPosition)
	local pos = getCreaturePosition(cid)
	if(isPlayer(cid) and getCreatureStorage(cid, 10002) ~= 1) then
		doCreatureSetStorage(cid, 10002, 1)
		doCreatureSetStorage(cid, 10001, -1)
		doCreatureSay(cid, "You've reached Floor [2]", TALKTYPE_MONSTER)
		doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
	end
	return true
end


StorageDatabase
player_id key value
2 10001 -1
2 10002 1
----------------------------------------------------------------------------------------------------------
I also need help with another script

Lua:
local monsters = 
{
	["Floor 1 [BOSS]"] = {toPos = {x = 1023, y = 1017, z = 6}},
	["Floor 2 [BOSS]"] = {toPos = {x = 1023, y = 1017, z = 5}},
	["Floor 3 [BOSS]"] = {toPos = {x = 1023, y = 1017, z = 4}}
}
function onKill(cid, target, lastHit)	
local t = monsters[getCreatureName(target)]	
	if(monsters[getCreatureName(target)]) then
		doCreateTeleport(1387, t.toPos, getCreaturePosition(target))
		doCreatureSay(cid, "The teleport to next floor will be removed in 8 seconds.", TALKTYPE_MONSTER, getCreaturePosition(target)) 
		addEvent(doRemoveItem, 8 * 1000, getCreaturePosition(target))
	end
return true
end

It's like INQ teleports, when a monster dies a teleport creates where he died and removes after x seconds.
heres where I have the error
Lua:
addEvent(doRemoveItem, 8 * 1000, getCreaturePosition(target))

FEawOR.png

I get this error after 8 seconds
everything else works
 
Last edited:
Back
Top