Ir para conteúdo

Subir telhado com corda


Posts Recomendados

E ai galera, suave?

Estava andando de boa pela net UHASHUASUH' quando me deparo com esse script.

Não vi nada ainda por aqui então vamos la!

 

Vá em Actions/Scripts/Tools/rope.lua e substitua o que tem la, por isso:

 

 

 

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


[spoiler]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.[/spoiler]



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

 

 

Como configurar:

 

 

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.

 

 

Em Vermelho são os tiles de telhado que o player pode subir.

Em azul são as bordas.

Em verde é o tempo que o player terá que esperar pra usar a corda novamente.

 

Pra quem não entendeu, aqui tem um vídeo explicando:

 

http://www.youtube.c...e&amp;v=BUdXGYL9Ad4

 

 

Créditos: Wake

Editado por PsyMcKenzie
Link para o comentário
Compartilhar em outros sites

  • 2 weeks later...

Legal o script^^, mais a corda continua funcionando normal? digo: continua servindo paro subir buracos como de costume?, se não der conflito com a função normal da corda vou usar e talvez te dou REP++, vlw

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...