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

Action Multifloor Ladder

Godely

Member
Joined
Aug 19, 2007
Messages
233
Reaction score
16
This is made for 0.3.5pl1, but I think that for the 0.2 versions it's really similar.

Have you ever tried to do this on your map?

testing1.jpg


Well, I know that many of you did. Splendid mappers are always doing those stuff, and putting some random IDs and bla-bla-bla: but in the end, we see the most beautiful map ever, isn't that true?

But when you stop to think, the only point of doing it is just to showoff, right? Because you'd never be able to climb all those ladders... well, until now.

testing2f.jpg


testing3u.jpg


This won't happen by magic. You have to put your hands to work. Let's go?​

Go to actions and open the folder scripts. If your folder is similar to mine, you'll find another folder called other. Open it. There you'll find a script called teleport.lua. -- If you do not find this script, or you don't have the folder other, try going to actions.xml, press ctrl + f and search for teleport.lua. You surely will see where is the destination folder :)

Have you opened teleport.lua? You'll find something like this:

Code:
	if(isInArray(UP_FLOORS, item.itemid)) then
		fromPosition.z = fromPosition.z - 1
		fromPosition.y = fromPosition.y + 1

		fromPosition.stackpos = STACKPOS_GROUND
		if(item.actionid == 100 or getThingFromPos(fromPosition, false).itemid == 0) then
			fromPosition.y = fromPosition.y - 2
		end
	else
		fromPosition.z = fromPosition.z + 1
	end

You probably are gonna see it in the middle of the file. Just change it to:

Code:
	if(isInArray(UP_FLOORS, item.itemid)) then
		fromPosition.z = fromPosition.z - 1
		fromPosition.y = fromPosition.y + 1

		fromPosition.stackpos = STACKPOS_GROUND
		if(item.actionid == 100 or getThingFromPos(fromPosition, false).itemid == 0) then
			fromPosition.y = fromPosition.y - 1
		elseif item.actionid >= 102 and item.actionid <= 107 then
			pfloor = item.actionid - 101
			fromPosition.z = fromPosition.z - pfloor
		end
	else
		fromPosition.z = fromPosition.z + 1
	end

Now, on your map, put how many ladders as you want, one above the other. Now, count how many floors above do you have, e.g.:

testing4.jpg


As you can see in the black number, the character will go up 5 floors. So, in the first ladder, the bottom one, you will do:

testing5.jpg


Did you understand? You'll have to set the actionid of the first ladder to 100 + number_of_floors_to_go_up.

Now, the last detail, and I know that by now the pros must be asking "and to go down?"

Well, this is really ordinary, and we don't need to change any script. Just go to your map and add the id 459 to the bottom of each ladder, beginning by the second floor:

testing6v.jpg



To the professional scripters:
I know this tutorial is way over explained, but there're some people that keep posting errors and errors, and this time I tried to make like this so everyone will have the opportunity to set this function the way it has to be set.

The pro lua scripters now that this is a really ordinary script, but I believe it has a great functionality. Also, I know realized that there's another way to make this without using any actionids, but it'd have to check if there's a ladder above the one you are using, and I was too lazy to make this. But soon I will :)
 
Code:
		elseif item.actionid >= 102 and item.actionid <= 107 then
			pfloor = item.actionid - 101
			fromPosition.z = fromPosition.z - pfloor
		end
Basically, that's the script.
 
Can you add also if it should place you north or south of to ladder?
Cip made ladders wrong placing you south, but most maps are made this way.
But there are some situations where you wnt to place ladder on outside wall or sth like that, and place char on north later.
please <cute eyes> ;d
 
Thanks for the comments!

@zakius

Code:
if(isInArray(UP_FLOORS, item.itemid)) then
		fromPosition.z = fromPosition.z - 1
		fromPosition.y = fromPosition.y + 1

		fromPosition.stackpos = STACKPOS_GROUND
		if(item.actionid == 100 or getThingFromPos(fromPosition, false).itemid == 0) [I][B]or (item.actionid >= 202 and item.actionid <= 207) then[/B][/I]
			fromPosition.y = fromPosition.y - 1
		[B][I]elseif (item.actionid >= 102 and item.actionid <= 107) or (item.actionid >= 202 and item.actionid <= 207) then[/I][/B]
[B][I]				if item.actionid > 200 then
					pfloor = item.actionid - 201
				else
					pfloor = item.actionid - 101
				end
			fromPosition.z = fromPosition.z - pfloor
			end[/I][/B]
		end
	else
		fromPosition.z = fromPosition.z + 1
	end

Try adding/changing this things in bold and italic to the function or even copying all of it above, and I bet it'll work. Now keep in mind that, if you want the player to go to the north of the ladder, you must add 200 + number_of_floors_to_go_up to the actionid of your bottom ladder. That's the only idea I had, I'm really lazy now haha.


@Dean

Can you post here or send me a PM with an example of your 7.6 teleport.lua file?
 
Last edited:
Not working for me.

Im trying it on a simpel war ot.
Help me pls. i just get errors.
Code:
local UP_FLOORS = {1386, 3678, 5543, 8599, 10035}
local DRAW_WELL = 1369

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.itemid == DRAW_WELL and item.actionid ~= 100) then
		return false
	end

	if(isInArray(UP_FLOORS, item.itemid)) then
		fromPosition.z = fromPosition.z - 1
		fromPosition.y = fromPosition.y + 1

		fromPosition.stackpos = STACKPOS_GROUND
		if(item.actionid == 100 or getThingFromPos(fromPosition, false).itemid == 0) then
			fromPosition.y = fromPosition.y - 2
		end
	else
		fromPosition.z = fromPosition.z + 1
	end

	local pos, dir = getCreaturePosition(cid), SOUTH
	if(pos.x < fromPosition.x) then
		dir = EAST
	elseif(pos.x == fromPosition.x) then
		if(pos.y == fromPosition.y) then
			dir = getCreatureLookDirection(cid)
		elseif(pos.y > fromPosition.y) then
			dir = NORTH
		end
	elseif(pos.x > fromPosition.x) then
		dir = WEST
	end

	doTeleportThing(cid, fromPosition, false)
	doCreatureSetLookDirection(cid, dir)
	return true
end
 
Can you post the errors?

PS.: This script you posted above is the normal one, you didn't update it lol
 
Dunno why script wasn't working for me. After some time fighting with it I made it a bit different, but now it works good.
Lua:
local UP_FLOORS = {1386, 3678, 5543, 8599, 10035}
local DRAW_WELL = 1369

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.itemid == DRAW_WELL and item.actionid ~= 100) then
		return false
	end

	if(isInArray(UP_FLOORS, item.itemid)) then
		if(item.actionid >= 200 and item.actionid <= 207) then
			fromPosition.y = fromPosition.y - 1
			fromPosition.z = fromPosition.z - (item.actionid-200)
		elseif (item.actionid >= 102 and item.actionid <= 107) then
			fromPosition.z = fromPosition.z - (item.actionid-100)
			fromPosition.y = fromPosition.y + 1
		else
			fromPosition.y = fromPosition.y + 1
			fromPosition.z = fromPosition.z - 1
		end
		fromPosition.stackpos = STACKPOS_GROUND
		local pos, dir = getCreaturePosition(cid), SOUTH
		if(pos.x < fromPosition.x) then
			dir = EAST
		elseif(pos.x == fromPosition.x) then
			if(pos.y == fromPosition.y) then
			dir = getCreatureLookDirection(cid)
			elseif(pos.y > fromPosition.y) then
			dir = NORTH
			end
		elseif(pos.x > fromPosition.x) then
			dir = WEST
		end
	end
	doTeleportThing(cid, fromPosition, false)
	doCreatureSetLookDirection(cid, dir)
	return true
end
No aid if you want normal tibian ladder, aid 100+ how much floors up for longer tibian one, aid 200+ floors up for the one to north(if it have to be +1 floor use 201)
 
Last edited:
I knonw i just did post my old. to show you.

Here is the console bug.
namnls23y.png
 
Last edited:
Back
Top