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

Rope Roof System

Wake

Member
Joined
Oct 1, 2012
Messages
130
Reaction score
12
Location
São Paulo - Brazil
Rope Roof
Details: Hey, why not let the players climb the rooftops? This will further expand the strategy in Wars, and your server will make innovative and different!
Movie:
[video=youtube;BUdXGYL9Ad4]http://www.youtube.com/watch?feature=player_embedded&v=BUdXGYL9Ad4[/video]

Go to Actions/Scripts/Tools/rope.lua

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
 
roofs_tile = {6172,3348,920,926,927,929,936,937,939,946,947,948 ,956,957,958} -- Piso de telhados aceitos
 
roofs_border = {6160,6161,6162,6163,6164,6165,6166,6167,6168,6168,6169,6170,6171,921,922,923,924,925,928,930,931,932,933,934,935,938,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,3298,3299,3300,3301,3302,3303,3304,3305,3306,3307,3308,3309,3349,3350,3351,3352,3353,3354,3355,3356,3357,3358, 3359,3360,1268,1055,5045,5047,5048,5049,5050,5051, 5052,5053,5054}
 
timeDelay = 180 -- Tempo pra ser usado a corda novamente.
 
 
if(toPosition.x == CONTAINER_POSITION) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
return true
end
local creature = toPosition
creature.stackpos = 253
local pid_creature = getThingFromPos(creature,FALSE).uid
toPosition.stackpos = STACKPOS_GROUND
local itemGround = getThingFromPos(toPosition,FALSE)
if(isInArray(SPOTS, itemGround.itemid)) then
doTeleportThing(cid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z - 1}, false)
return true
elseif tonumber(cid) == tonumber(pid_creature) then
verificacao_telhado = {[0]={x=toPosition.x,y=toPosition.y-1,z=toPosition.z},[1]={x=toPosition.x+1,y=toPosition.y,z=toPosition.z},
[2]={x=toPosition.x,y=toPosition.y+1,z=toPosition.z},[3]={x=toPosition.x-1,y=toPosition.y,z=toPosition.z}}
local position_tp = verificacao_telhado[getCreatureLookDirection(cid)]
position_tp.stackpos=0
local position_cid = getCreaturePosition(cid)
position_cid.stackpos=0
local meu_tile = getThingFromPos(position_cid,FALSE).itemid 
local position_ver_down = verificacao_telhado[getCreatureLookDirection(cid)]
position_ver_down.stackpos=0
local ver_down = getThingFromPos(position_ver_down,FALSE)
--//\\--
local pos = position_tp
pos.z = pos.z-1
local coisa = getThingFromPos(pos,FALSE)
 
local pos2 = getCreaturePosition(cid)
pos2.stackpos=0
pos2.z = pos2.z-1
local coisa2 = getThingFromPos(pos2,FALSE)
if not (isInArray(roofs_tile,meu_tile)) or (isInArray(roofs_border,coisa.itemid) or isInArray(roofs_border,coisa2.itemid)) then 
local chance_special = {[1]=10,[2]=15,[3]=25,[4]=40}
local time_segundos = {[0]=320,[1]=240,[2]=220,[3]=180,[4]=120}
local chance = 50 
if os.time() >= getPlayerStorageValue(cid,"rope") then
if getPlayerStorageValue(cid,86574) == -1 then
setPlayerStorageValue(cid,86574,1)
addEvent(setPlayerStorageValue,2000,cid,86574,-1)
else
doPlayerSendCancel(cid,"You are exausted.")
doSendMagicEffect(getCreaturePosition(cid),2)
return TRUE
end
if math.random(1,100) >= 100-chance then
local coisa = getThingFromPos(position_tp,FALSE)
position_cid.z=position_cid.z-1 
local ver_up = getThingFromPos(position_cid,FALSE)
local top_z = 7 
local ative = 0
for i=0,3 do
coisa = getThingFromPos(position_tp,FALSE).itemid 
if isWalkable(position_tp, true, true, true) and isInArray(roofs_tile,coisa) or isInArray(roofs_border,coisa) then 
if position_tp.z < top_z then
top_z=position_tp.z
ative = 1
setPlayerStorageValue(cid,"rope",os.time()+timeDelay)
end
end
position_tp.z=position_tp.z-1
end
if top_z ~= 0 and ative == 1 then
doSendMagicEffect(getCreaturePosition(cid),2)
doTeleportThing(cid,{x=position_tp.x,y=position_tp .y,z=top_z})
return TRUE
else
doPlayerSendCancel(cid,"Desculpa, mas é quase impossivel subir aqui.")
end
else
doSendAnimatedText(getCreaturePosition(cid),"MISS" ,215)
doPlayerSendCancel(cid,"You missed the roof!")
doSendMagicEffect(getCreaturePosition(cid),2)
if getPlayerStorageValue(cid,42319) == -1 then
setPlayerStorageValue(cid,42319,1)
addEvent(setPlayerStorageValue,10000,cid,42319,-1)
end
return TRUE
end
else
doPlayerSendTextMessage(cid,MESSAGE_STATUS_SMALL," You are exausted, please wait ".. getPlayerStorageValue(cid,"rope")-os.time() .." seconds for use the rope.")
return TRUE
end
end
if (ver_down.uid == 0 or isInArray(roofs_border,ver_down.itemid)) then
if getCreatureLookDirection(cid) == 0 then position_tp.y=position_tp.y-1 end
position_tp.z=getCreaturePosition(cid).z
for i=0,3 do
position_tp.z=position_tp.z+1
tp_ground = getThingFromPos(position_tp,FALSE) 
if tp_ground.uid ~= 0 then 
if isWalkable(position_tp, true, true, true) then
doTeleportThing(cid,position_tp)
return TRUE
else
return FALSE
end
end
end
else
doPlayerSendTextMessage(cid,MESSAGE_STATUS_SMALL," Sorry, you can not use the rope here!")
return TRUE
end
 
------------------------------------------------------
elseif(isInArray(ROPABLE, itemEx.itemid)) then
local hole = getThingFromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
if(hole.itemid > 0) then
doTeleportThing(hole.uid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z}, false)
else
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
end
return true
end
return false
end
 
function isWalkable(pos, creature, proj, pz)-- by Nord
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
if getTopCreature(pos).uid > 0 and creature then return false end
if getTileInfo(pos).protection and pz then return false, true end
local n = not proj and 3 or 2
for i = 0, 255 do
pos.stackpos = i
local tile = getTileThingByPos(pos)
if tile.itemid ~= 0 and not isCreature(tile.uid) then
if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
return false
end
end
end
return true
end

Or CREATE new file with new id.

Good bye
 
Last edited:
error fixed:

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

roofs_tile = {6172,3348,920,926,927,929,936,937,939,946,947,948 ,956,957,958} -- Piso de telhados aceitos

roofs_border = {6160,6161,6162,6163,6164,6165,6166,6167,6168,6168,6169,6170,6171,921,922,923,924,925,928,930,931,932,933,934,935,938,941,942,943,944,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,3298,3299,3300,3301,3302,3303,3304,3305,3306,3307,3308,3309,3349,3350,3351,3352,3353,3354,3355,3356,3357,3358, 3359,3360,1268,1055,5045,5047,5048,5049,5050,5051, 5052,5053,5054}

timeDelay = 180 -- Tempo pra ser usado a corda novamente.


if(toPosition.x == CONTAINER_POSITION) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
return true
end
local creature = toPosition
creature.stackpos = 253
local pid_creature = getThingFromPos(creature,FALSE).uid
toPosition.stackpos = STACKPOS_GROUND
local itemGround = getThingFromPos(toPosition,FALSE)
if(isInArray(SPOTS, itemGround.itemid)) then
doTeleportThing(cid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z - 1}, false)
return true
elseif tonumber(cid) == tonumber(pid_creature) then
verificacao_telhado = {[0]={x=toPosition.x,y=toPosition.y-1,z=toPosition.z},[1]={x=toPosition.x+1,y=toPosition.y,z=toPosition.z},
[2]={x=toPosition.x,y=toPosition.y+1,z=toPosition.z},[3]={x=toPosition.x-1,y=toPosition.y,z=toPosition.z}}
local position_tp = verificacao_telhado[getCreatureLookDirection(cid)]
position_tp.stackpos=0
local position_cid = getCreaturePosition(cid)
position_cid.stackpos=0
local meu_tile = getThingFromPos(position_cid,FALSE).itemid 
local position_ver_down = verificacao_telhado[getCreatureLookDirection(cid)]
position_ver_down.stackpos=0
local ver_down = getThingFromPos(position_ver_down,FALSE)
--//\\--
local pos = position_tp
pos.z = pos.z-1
local coisa = getThingFromPos(pos,FALSE)

local pos2 = getCreaturePosition(cid)
pos2.stackpos=0
pos2.z = pos2.z-1
local coisa2 = getThingFromPos(pos2,FALSE)
if not (isInArray(roofs_tile,meu_tile)) or (isInArray(roofs_border,coisa.itemid) or isInArray(roofs_border,coisa2.itemid)) then 
local chance_special = {[1]=10,[2]=15,[3]=25,[4]=40}
local time_segundos = {[0]=320,[1]=240,[2]=220,[3]=180,[4]=120}
local chance = 50 
if os.time() >= getPlayerStorageValue(cid,"rope") then
if getPlayerStorageValue(cid,86574) == -1 then
setPlayerStorageValue(cid,86574,1)
addEvent(setPlayerStorageValue,2000,cid,86574,-1)
else
doPlayerSendCancel(cid,"You are exausted.")
doSendMagicEffect(getCreaturePosition(cid),2)
return TRUE
end
if math.random(1,100) >= 100-chance then
local coisa = getThingFromPos(position_tp,FALSE)
position_cid.z=position_cid.z-1 
local ver_up = getThingFromPos(position_cid,FALSE)
local top_z = 7 
local ative = 0
for i=0,3 do
coisa = getThingFromPos(position_tp,FALSE).itemid 
if isWalkable(position_tp, true, true, true) and isInArray(roofs_tile,coisa) or isInArray(roofs_border,coisa) then 
if position_tp.z < top_z then
top_z=position_tp.z
ative = 1
setPlayerStorageValue(cid,"rope",os.time()+timeDelay)
end
end
position_tp.z=position_tp.z-1
end
if top_z ~= 0 and ative == 1 then
doSendMagicEffect(getCreaturePosition(cid),2)
doTeleportThing(cid,{x=position_tp.x,y=position_tp .y,z=top_z})
return TRUE
else
doPlayerSendCancel(cid,"Desculpa, mas é quase impossivel subir aqui.")
end
else
doSendAnimatedText(getCreaturePosition(cid),"MISS" ,215)
doPlayerSendCancel(cid,"You missed the roof!")
doSendMagicEffect(getCreaturePosition(cid),2)
if getPlayerStorageValue(cid,42319) == -1 then
setPlayerStorageValue(cid,42319,1)
addEvent(setPlayerStorageValue,10000,cid,42319,-1)
end
return TRUE
end
else
doPlayerSendTextMessage(cid,MESSAGE_STATUS_SMALL," You are exausted, please wait ".. getPlayerStorageValue(cid,"rope")-os.time() .." seconds for use the rope.")
return TRUE
end
end
if (ver_down.uid == 0 or isInArray(roofs_border,ver_down.itemid)) then
if getCreatureLookDirection(cid) == 0 then position_tp.y=position_tp.y-1 end
position_tp.z=getCreaturePosition(cid).z
for i=0,3 do
position_tp.z=position_tp.z+1
tp_ground = getThingFromPos(position_tp,FALSE) 
if tp_ground.uid ~= 0 then 
if isWalkable(position_tp, true, true, true) then
doTeleportThing(cid,position_tp)
return TRUE
else
return FALSE
end
end
end
else
doPlayerSendTextMessage(cid,MESSAGE_STATUS_SMALL," Sorry, you can not use the rope here!")
return TRUE
end

------------------------------------------------------
elseif(isInArray(ROPABLE, itemEx.itemid)) then
local hole = getThingFromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
if(hole.itemid > 0) then
doTeleportThing(hole.uid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z}, false)
else
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
end
return true
end
return false
end

function isWalkable(pos, creature, proj, pz)-- by Nord
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
if getTopCreature(pos).uid > 0 and creature then return false end
if getTileInfo(pos).protection and pz then return false, true end
local n = not proj and 3 or 2
for i = 0, 255 do
pos.stackpos = i
local tile = getTileThingByPos(pos)
if tile.itemid ~= 0 and not isCreature(tile.uid) then
if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
return false
end
end
end
return true
end
 
Last edited:
paste your errors.

Use is for 9.6:

Lua:
--[[ Rope Chance
ID: 4
]]

function onUse(cid, item, fromPosition, itemEx, toPosition)

--############################################# CONFIGURE AQUI #######################################################--

roofs_tile = {6172,3348,920,926,927,929,936,937,939,946,947,948,956,957,958}       -- Piso de telhados aceitos
roofs_border = {6160,6161,6162,6163,6164,6165,6166,6167,6168,6168,6169,6170,6171,   -- Lista de todas as bordas de telhados aceitas
                921,922,923,924,925,928,930,931,932,933,934,935,938,941,942,943,944,
                945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,962,963,964,
                3298,3299,3300,3301,3302,3303,3304,3305,3306,3307,3308,3309,
                3349,3350,3351,3352,3353,3354,3355,3356,3357,3358,3359,3360,1268,1055,5045,5047,5048,5049,5050,5051,5052,5053,5054}
timeDelay = 180  -- Tempo pra ser usado a corda novamente.

--######################################################################################################################--



	if(toPosition.x == CONTAINER_POSITION) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
		return true
	end
    local creature = toPosition
    creature.stackpos = 253
    local pid_creature = getThingFromPos(creature).uid
	toPosition.stackpos = STACKPOS_GROUND
	local itemGround = getThingFromPos(toPosition)
    if(isInArray(SPOTS, itemGround.itemid)) then
		doTeleportThing(cid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z - 1}, false)
		return true
	elseif tonumber(cid) == tonumber(pid_creature) then
           verificacao_telhado = {[0]={x=toPosition.x,y=toPosition.y-1,z=toPosition.z},[1]={x=toPosition.x+1,y=toPosition.y,z=toPosition.z},
                                   [2]={x=toPosition.x,y=toPosition.y+1,z=toPosition.z},[3]={x=toPosition.x-1,y=toPosition.y,z=toPosition.z}}
           local position_tp = verificacao_telhado[getCreatureLookDirection(cid)]
           position_tp.stackpos=0
           local position_cid = getCreaturePosition(cid)
           position_cid.stackpos=0
           local meu_tile = getThingFromPos(position_cid).itemid
           local position_ver_down = verificacao_telhado[getCreatureLookDirection(cid)]
           position_ver_down.stackpos=0
           local ver_down = getThingFromPos(position_ver_down)
           --//\\--
           local pos = position_tp
           pos.z = pos.z-1
           local coisa = getThingFromPos(pos)
           
           local pos2 = getCreaturePosition(cid)
           pos2.stackpos=0
           pos2.z = pos2.z-1
           local coisa2 = getThingFromPosition(pos2,false)
           if not (isInArray(roofs_tile,meu_tile)) or (isInArray(roofs_border,coisa.itemid) or isInArray(roofs_border,coisa2.itemid))  then 
              local chance_special = {[1]=10,[2]=15,[3]=25,[4]=40}
              local time_segundos = {[0]=320,[1]=240,[2]=220,[3]=180,[4]=120}
              local chance = 5              
                 if os.time() >= getPlayerStorageValue(cid,"rope") then
                 if getPlayerStorageValue(cid,86574) == -1 then
                 setPlayerStorageValue(cid,86574,1)
                 addEvent(setPlayerStorageValue,2000,cid,86574,-1)
                 else
                    doPlayerSendCancel(cid,"You are exausted.")
                    doSendMagicEffect(getCreaturePosition(cid),2)
                    return TRUE
                 end
                 if math.random(90,100) >= 100-chance then
                    local coisa = getThingFromPos(position_tp)
                    position_cid.z=position_cid.z-1                                   
                    local ver_up = getThingFromPos(position_cid)
                    local top_z = 7  
                    local ative = 0
                    for i=0,3 do
                        coisa = getThingFromPos(position_tp).itemid         
                        if isWalkable(position_tp, true, true, true) and isInArray(roofs_tile,coisa) or isInArray(roofs_border,coisa) then  
                           if position_tp.z < top_z then
                              top_z=position_tp.z
                              ative = 1
                              setPlayerStorageValue(cid,"rope",os.time()+timeDelay)
                           end
                        end
                        position_tp.z=position_tp.z-1
                    end
                    if top_z ~= 0 and ative == 1 then
                       doSendMagicEffect(getCreaturePosition(cid),2)
                       doTeleportThing(cid,{x=position_tp.x,y=position_tp.y,z=top_z})
                       return TRUE
                    else
                       doPlayerSendCancel(cid,"Desculpa, mas é quase impossivel subir aqui.")
                    end
                 else
                    --doSendAnimatedText(getCreaturePosition(cid),"MISS",215)
                    doCreatureSay(itemEx.uid, "MISS", TALKTYPE_ORANGE_1)

		    doPlayerSendCancel(cid,"You missed the roof!")
                    doSendMagicEffect(getCreaturePosition(cid),2)
                    if getPlayerStorageValue(cid,42319) == -1 then
                       setPlayerStorageValue(cid,42319,1)
                       addEvent(setPlayerStorageValue,10000,cid,42319,-1)
                    end
                    return TRUE
                 end
              else
                 doPlayerSendTextMessage(cid,MESSAGE_STATUS_SMALL,"You are exausted, please wait ".. getPlayerStorageValue(cid,"rope")-os.time() .." seconds for use the rope.")
                 return TRUE
              end
           end
          if (ver_down.uid == 0 or isInArray(roofs_border,ver_down.itemid)) then
             if getCreatureLookDirection(cid) == 0 then position_tp.y=position_tp.y-1 end
                position_tp.z=getCreaturePosition(cid).z
                for i=0,3 do
                    position_tp.z=position_tp.z+1
                    tp_ground = getThingFromPos(position_tp) 
                    if tp_ground.uid ~= 0  then 
                       if isWalkable(position_tp, true, true, true) then
                          doTeleportThing(cid,position_tp)
                          return TRUE
                       else
                          return FALSE
                       end
                    end
                end
            else
                doPlayerSendTextMessage(cid,MESSAGE_STATUS_SMALL,"Sorry, you can not use the rope here!")
                return TRUE
            end
         
         ------------------------------------------------------
       elseif(isInArray(ROPABLE, itemEx.itemid)) then
          local hole = getThingFromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
		     if(hole.itemid > 0) then
                doTeleportThing(hole.uid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z}, false)
             else
		        doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
             end
             return true
        end
return false
end

function isWalkable(pos, creature, proj, pz)-- by Nord
	if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
	if getTopCreature(pos).uid > 0 and creature then return false end
	if getTileInfo(pos).protection and pz then return false, true end
	local n = not proj and 3 or 2
	for i = 0, 255 do
		pos.stackpos = i
		local tile = getTileThingByPos(pos)
		if tile.itemid ~= 0 and not isCreature(tile.uid) then
			if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
				return false
			end
		end
	end
	return true
end


Good Bye
 
Last edited by a moderator:
Use correct tags [lua*][/lua*]
Lua:
--[[ Rope Chance
ID: 4
]]

function onUse(cid, item, fromPosition, itemEx, toPosition)

--############################################# CONFIGURE AQUI ################################################## #####--

roofs_tile = {6172,3348,920,926,927,929,936,937,939,946,947,948 ,956,957,958} -- Piso de telhados aceitos
roofs_border = {6160,6161,6162,6163,6164,6165,6166,6167,6168,6168 ,6169,6170,6171, -- Lista de todas as bordas de telhados aceitas
921,922,923,924,925,928,930,931,932,933,934,935,93 8,941,942,943,944,
945,946,947,948,949,950,951,952,953,954,955,956,95 7,958,959,960,961,962,963,964,
3298,3299,3300,3301,3302,3303,3304,3305,3306,3307, 3308,3309,
3349,3350,3351,3352,3353,3354,3355,3356,3357,3358, 3359,3360,1268,1055,5045,5047,5048,5049,5050,5051, 5052,5053,5054}
timeDelay = 180 -- Tempo pra ser usado a corda novamente.

--################################################## ################################################## ##################--



if(toPosition.x == CONTAINER_POSITION) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
return true
end
local creature = toPosition
creature.stackpos = 253
local pid_creature = getThingFromPos(creature).uid
toPosition.stackpos = STACKPOS_GROUND
local itemGround = getThingFromPos(toPosition)
if(isInArray(SPOTS, itemGround.itemid)) then
doTeleportThing(cid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z - 1}, false)
return true
elseif tonumber(cid) == tonumber(pid_creature) then
verificacao_telhado = {[0]={x=toPosition.x,y=toPosition.y-1,z=toPosition.z},[1]={x=toPosition.x+1,y=toPosition.y,z=toPosition.z},
[2]={x=toPosition.x,y=toPosition.y+1,z=toPosition.z},[3]={x=toPosition.x-1,y=toPosition.y,z=toPosition.z}}
local position_tp = verificacao_telhado[getCreatureLookDirection(cid)]
position_tp.stackpos=0
local position_cid = getCreaturePosition(cid)
position_cid.stackpos=0
local meu_tile = getThingFromPos(position_cid).itemid
local position_ver_down = verificacao_telhado[getCreatureLookDirection(cid)]
position_ver_down.stackpos=0
local ver_down = getThingFromPos(position_ver_down)
--//\\--
local pos = position_tp
pos.z = pos.z-1
local coisa = getThingFromPos(pos)

local pos2 = getCreaturePosition(cid)
pos2.stackpos=0
pos2.z = pos2.z-1
local coisa2 = getThingFromPosition(pos2,false)
if not (isInArray(roofs_tile,meu_tile)) or (isInArray(roofs_border,coisa.itemid) or isInArray(roofs_border,coisa2.itemid)) then
local chance_special = {[1]=10,[2]=15,[3]=25,[4]=40}
local time_segundos = {[0]=320,[1]=240,[2]=220,[3]=180,[4]=120}
local chance = 5
if os.time() >= getPlayerStorageValue(cid,"rope") then
if getPlayerStorageValue(cid,86574) == -1 then
setPlayerStorageValue(cid,86574,1)
addEvent(setPlayerStorageValue,2000,cid,86574,-1)
else
doPlayerSendCancel(cid,"You are exausted.")
doSendMagicEffect(getCreaturePosition(cid),2)
return TRUE
end
if math.random(90,100) >= 100-chance then
local coisa = getThingFromPos(position_tp)
position_cid.z=position_cid.z-1
local ver_up = getThingFromPos(position_cid)
local top_z = 7
local ative = 0
for i=0,3 do
coisa = getThingFromPos(position_tp).itemid
if isWalkable(position_tp, true, true, true) and isInArray(roofs_tile,coisa) or isInArray(roofs_border,coisa) then
if position_tp.z < top_z then
top_z=position_tp.z
ative = 1
setPlayerStorageValue(cid,"rope",os.time()+timeDel ay)
end
end
position_tp.z=position_tp.z-1
end
if top_z ~= 0 and ative == 1 then
doSendMagicEffect(getCreaturePosition(cid),2)
doTeleportThing(cid,{x=position_tp.x,y=position_tp .y,z=top_z})
return TRUE
else
doPlayerSendCancel(cid,"Desculpa, mas é quase impossivel subir aqui.")
end
else
--doSendAnimatedText(getCreaturePosition(cid),"MISS" ,215)
doCreatureSay(itemEx.uid, "MISS", TALKTYPE_ORANGE_1)

doPlayerSendCancel(cid,"You missed the roof!")
doSendMagicEffect(getCreaturePosition(cid),2)
if getPlayerStorageValue(cid,42319) == -1 then
setPlayerStorageValue(cid,42319,1)
addEvent(setPlayerStorageValue,10000,cid,42319,-1)
end
return TRUE
end
else
doPlayerSendTextMessage(cid,MESSAGE_STATUS_SMALL," You are exausted, please wait ".. getPlayerStorageValue(cid,"rope")-os.time() .." seconds for use the rope.")
return TRUE
end
end
if (ver_down.uid == 0 or isInArray(roofs_border,ver_down.itemid)) then
if getCreatureLookDirection(cid) == 0 then position_tp.y=position_tp.y-1 end
position_tp.z=getCreaturePosition(cid).z
for i=0,3 do
position_tp.z=position_tp.z+1
tp_ground = getThingFromPos(position_tp)
if tp_ground.uid ~= 0 then
if isWalkable(position_tp, true, true, true) then
doTeleportThing(cid,position_tp)
return TRUE
else
return FALSE
end
end
end
else
doPlayerSendTextMessage(cid,MESSAGE_STATUS_SMALL," Sorry, you can not use the rope here!")
return TRUE
end

------------------------------------------------------
elseif(isInArray(ROPABLE, itemEx.itemid)) then
local hole = getThingFromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
if(hole.itemid > 0) then
doTeleportThing(hole.uid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z}, false)
else
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
end
return true
end
return false
end

function isWalkable(pos, creature, proj, pz)-- by Nord
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
if getTopCreature(pos).uid > 0 and creature then return false end
if getTileInfo(pos).protection and pz then return false, true end
local n = not proj and 3 or 2
for i = 0, 255 do
pos.stackpos = i
local tile = getTileThingByPos(pos)
if tile.itemid ~= 0 and not isCreature(tile.uid) then
if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
return false
end
end
end
return true
end
 
I use this system but I was wondering how exactly I could change the item that is being used for the "rope" (Originally 2120; I want it to be 8712) This system seems to only work with 2120 and nothing else. Help Please.

Thank You
~Sin
 
Back
Top