Jhon_
Well-Known Member
- Joined
- May 7, 2019
- Messages
- 58
- Reaction score
- 61
Can anyone here help me to change this script to work like the 7.4 rope? Can't use it if there is a monster/player/items over the spot where you use the rope?
LUA:
function onUseRope(player, item, fromPosition, target, toPosition)
local tile = Tile(toPosition)
if not tile then
return false
end
local itemType = ItemType(target.itemid)
if itemType and itemType:getGroup() == ITEM_GROUP_SPLASH then
target = tile:getGround()
end
if table.contains(ropeSpots, target.itemid) then
tile = Tile(toPosition:moveUpstairs())
if not tile then
return false
end
if tile:hasFlag(TILESTATE_PROTECTIONZONE) and player:isPzLocked() then
player:sendCancelMessage(RETURNVALUE_PLAYERISPZLOCKED)
return true
end
player:teleportTo(toPosition, false)
return true
end
if table.contains(holeId, target.itemid) then
toPosition.z = toPosition.z + 1
tile = Tile(toPosition)
if not tile then
return false
end
local thing = tile:getBottomCreature() or tile:getTopDownItem()
if not thing then
return true
end
if thing:isCreature() then
return thing:teleportTo(toPosition:moveUpstairs(), false)
elseif thing:isItem() and thing:getType():isMovable() then
return thing:moveTo(toPosition:moveUpstairs())
end
return true
end
return false
end