Falaé Galera do XTibia, venho hoje postar um script muito legal que um amigo meu fez!
Então, vamos a ele!!
#Informações:
Nome: Tibia Real Temperature 1.0
Autor: Pc98 ( I )
Versão Testada: Tibia 8.42~8.7 ( distro tfs, mas deve funcionar em outras, com pequenas alterações, ou nenhuma)
@Comentarios:
Um sistema de temperatura para o Tibia ( em graus Celsios ). Resumindo, cada area tem sua temperatura, e piora ou melhor , se a cave for muito profunda, ou a outfit for muito quente, ou mesmo se subir muito uma montanha.
Ex: a beggar; se andar com ela no deserto, começa a perder vida, ate morrer, ou tirar ela.
#Instalação:
@CreatureScripts:
Vá em Creaturescripts/Scripts e crie um arquivo chamado temp.lua e adicione:
function onThink(cid, interval)
if isPlayer(cid) and getPlayerAccess(cid) == 0 then
------------------------- CONFIG ----------------------
-- Como configurar: Modifique os numeros abaixo da direita para
-- determinar a temperatura da outfit...
outfit_temp = {
-- Female Outfits
[136] = 6,
[137] = 5,
[138] = 5,
[139] = 6,
[140] = 7,
[141] = 6,
[142] = 8,
[147] = 11,
[148] = 6,
[149] = 6,
[150] = 8,
[155] = 7,
[156] = 2,
[157] = 20,
[158] = 11,
[152] = 9,
[259] = 8,
[270] = 14,
[279] = 15,
[288] = 4,
[324] = 5,
[336] = 6,
[329] = 6,
[366] = 8,
-- Male Outfits
[128] = 6,
[129] = 5,
[130] = 5,
[131] = 6,
[132] = 7,
[133] = 6,
[134] = 8,
[143] = 11,
[144] = 6,
[145] = 6,
[151] = 8,
[152] = 7,
[153] = 20,
[154] = 14,
[251] = 11,
[268] = 9,
[273] = 8,
[278] = 14,
[279] = 15,
[289] = 4,
[325] = 5,
[335] = 6,
[328] = 6,
[367] = 8,
}
temp_base = 20
min_dano = 15 -- Dano por temperatura um pouco alta/baixa
max_dano = 100 -- Dano por temperatura muito alta/baixa
delay = 2000 -- tempo em milissigundos dos danos
sub_config = 1 -- Ativar temperatura subterranea? ( 0 - Nao ) ( 1 - SIM )
-----------------------------FIM DAS CONFIG ------------------------
temp_local = getPlayerStorageValue(cid, 121314)
pos = getCreaturePosition(cid)
if temp_local == -1 then temp_local = 0 end
temp_user = (temp_base + temp_local + outfit_temp[getCreatureOutfit(cid).lookType])
if sub_config == 1 then
----------------------- Subterraneo -------------------------------
sub = { -11, -10, -8,-5 ,-3 ,-55 , [7] = 0, 55, 5, 7, 10, 12, 15}
if pos.z ~= 7 then
temp_user = temp_user + sub[pos.z]
end
end
-------------------------------------------------------------------
setPlayerStorageValue(cid, 12345, temp_user)
if temp_user >= 40 and temp_user < 50 then
addEvent(Quente, delay, cid,min_dano)
elseif temp_user >=50 then
addEvent(Quente, delay, cid,max_dano)
elseif temp_user <= 10 and temp_user > 0 then
addEvent(Frio, delay, cid,min_dano)
elseif temp_user < 0 then
addEvent(Frio, delay, cid,max_dano)
end
end
end
function Quente(cid,dano,r)
doPlayerSendTextMessage(cid, 22, "Voce esta sentindo muito calor...")
doCreatureAddHealth(cid, -dano)
r = math.random(1,100)
if r <= 30 then
doCreateItem(2018, getCreaturePosition(cid))
end
end
function Frio(cid,dano)
doPlayerSendTextMessage(cid, 22, "Voce esta sentindo muito frio...")
doCreatureAddHealth(cid, -dano)
end
Agora vá em Creaturescript/Scripts/login.lua e adicione a seguinte linha:
registerCreatureEvent(cid, "temp")
Agora, vá em Creaturescripts.xml e adicione a seguinte linha:
<creaturescripts> <event type="think" name="temp" event="script" value="temp.lua"/> </creaturescripts>
@Movements:
Vá em Movements/scripts e crie dois arquivos, um com o nome de temp_tiles_areia.lua e o outro com o nome de temp_tiles_gelo.lua
Em temp_tiles_areia.lua adicione isso:
function onStepIn(cid, item, position, fromPosition)
if isPlayer(cid) then
setPlayerStorageValue(cid, 121314, 20)
end
return true
end
function onStepOut(cid, item, position, fromPosition)
pos = {x=position.x,y=position.y,z=position.z,stackpos=0}
ground = getThingFromPos(pos)
--------- Deserto Tiles -------------
deserto_tile = {231} -- Primeira ID "diferente do padrao de "ID=ID + 1 " ^^
deserto_tileid_min = 8315 -- Minimo ID do deserto
deserto_tileid_max = 8322 -- Maximo ID do deserto
for i=deserto_tileid_min, deserto_tileid_max, 1 do
table.insert(deserto_tile,i)
end
-------------------------------------
if not isInArray(deserto_tile,ground.id) then
setPlayerStorageValue(cid, 121314, 0)
end
return true
end
Em temp_tiles_gelo.lua adicione isso:
function onStepIn(cid, item, position, fromPosition)
if isPlayer(cid) then
setPlayerStorageValue(cid, 121314, -20)
end
return true
end
function onStepOut(cid, item, position, fromPosition)
pos = {x=position.x,y=position.y,z=position.z,stackpos=0}
ground = getThingFromPos(pos)
--- GELO tiles----
gelo_tile = {}
gelo_tileid_min = 6580
gelo_tileid_max = 6608
for i=gelo_tileid_min, gelo_tileid_max, 1 do
table.insert(gelo_tile,i)
end
---------------
if not isInArray(gelo_tile,ground.id) then
setPlayerStorageValue(cid, 121314, 0)
end
return true
end
Agora, adicione as seguintes linhas em Movements.xml:
<!-- Areia tiles -->
<movevent type="StepIn" itemid="231" event="script" value="temp_tiles_areia.lua"/>
<movevent type="StepOut" itemid="231" event="script" value="temp_tiles_areia.lua"/>
<movevent type="StepIn" fromid="8315" toid="8322" event="script" value="temp_tiles_areia.lua"/>
<movevent type="StepOut" fromid="8315" toid="8322" event="script" value="temp_tiles_areia.lua"/>
<!-- Gelo Tiles -->
<movevent type="StepIn" fromid="6580" toid="6608" event="script" value="temp_tiles_gelo.lua"/>
<movevent type="StepOut" fromid="6580" toid="6608" event="script" value="temp_tiles_gelo.lua"/>
#TalkActions:
Vá em Talkactions/Scripts e crie um arquivo com o nome temp.lua e adicione:
function onSay(cid, words, param) doPlayerSendCancel(cid,"Voce esta sentindo "..getPlayerStorageValue(cid, 12345).." Graus") end
Adicione esta linha em Talkactions.xml:
<talkaction words="/temp" event="script" value="temp.lua"/>
Isso ai, se vocês tiverem alguma duvida, postem aqui!!
Gostou?? Te Ajudei?? REP++ =D















