Itutorial
Legendary OT User
- Joined
- Dec 23, 2014
- Messages
- 2,339
- Solutions
- 68
- Reaction score
- 1,024
I noticed there are a lot of stairs that don't work in TFS. Usually they are facing south, or just a whole stair type in general. So I made this script to make them act like normal stairs.
It is pretty simple to understand, you just put the item id's of the stairs that when you walk on them should put you upstairs. Then, make sure the that item id is put in the correct array for which way the stair is facing.
Here is the code.
If enough people benefit from this I will take the time to put all stair id's that I find that don't work and will add them in for everyone.
It is pretty simple to understand, you just put the item id's of the stairs that when you walk on them should put you upstairs. Then, make sure the that item id is put in the correct array for which way the stair is facing.
Here is the code.
Code:
local stairs_north = {18234, 3685} -- add stairs that should move you north and up a floor
local stairs_south = {3683} -- add stairs that should move you south and up a floor
local stairs_east = {3679} -- east & up a floor
local stairs_west = {3681} -- west & up a floor
function onStepIn(creature, item, position, fromPosition)
player = Player(creature)
if not player then
creature:teleportTo(fromPosition)
return true
end
if fromPosition.z < position.z then return true end
local north = {x = position.x, y = position.y - 1, z = position.z - 1}
local south = {x = position.x, y = position.y + 1, z = position.z - 1}
local east = {x = position.x + 1, y = position.y, z = position.z - 1}
local west = {x = position.x - 1, y = position.y, z = position.z - 1}
if isInArray(stairs_north, item.itemid) then
player:teleportTo(north)
elseif isInArray(stairs_south, item.itemid) then
player:teleportTo(south)
elseif isInArray(stairs_east, item.itemid) then
player:teleportTo(east)
elseif isInArray(stairs_west, item.itemid) then
player:teleportTo(west)
end
return true
end
If enough people benefit from this I will take the time to put all stair id's that I find that don't work and will add them in for everyone.