GO

Item que heala

Por Gokussj5, 12 de abr. de 2016 em Scripts

15
1.9k
Gokussj5G
12 de abril de 2016 às 13:17

Olá Xtibianos bom vim aqui perdir um script que quando o player clicka nesse item aqui > "7716"  ele vira o item "7717" dai ele fica parada sem pode se move no local que ta o item 7716 ele fica lá dentro por 10 minutos quando acaba heala mana e hp comepleto e dps de sair volta ao o normal, pfv podem me ajuda: (PARA TFS 0.3.6 8.60)

miguel223M
12 de abril de 2016 às 23:25

Em actions.xml, adicione a seguinte linha: 

 

      <action itemid="7716" script="regitem.lua"/>

 

Em actions/scripts/, crie um arquivo chamado regitem.lua e adicione:

 

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

 

if getPlayerStorageValue(cid, 12543) <= os.time() then

setPlayerStorageValue(cid, 12543, os.time() + 10*60)

setPlayerStorageValue(cid, 12544, 1)

doPlayerSendTextMessage(cid, 22, "Voce usou um regeneration item. Durante 10 min, voce invocara forcas e, depois, restaurara sua vida e mana maximas. Ate la, aguarde.")

doRemoveItem(item.uid, 1)

doCreateItem(7717, 1, fromPosition)

else

doPlayerSendCancel(cid, "Voce ainda esta invocando forcas jogador. Nao podera usar outro regeneration item ate acabar esta invocacao.")

end

 

return true

end

 

Em creaturescripts/scripts/, crie um arquivo chamado regitem.lua e adicione:

 

 

 

function onThink(cid, interval)

 

if getPlayerStorageValue(cid, 12544) == 1 then

if getPlayerStorageValue(cid, 12543) <= os.time() then

doRemoveItem(getThingFromPos(getPlayerPosition(cid)).itemid == 7717, 1)

doCreateItem(7716, 1, getPlayerPosition(cid))

setPlayerStorageValue(cid, 12544, 0)

doTeleportThing(cid, {x=getPlayerPosition(cid).x, y =getPlayerPosition(cid).y +1 , z=getPlayerPosition(cid).z}) 

doCreatureAddHealth(cid, getCreatureMaxHealth(cid))
doCreatureAddMana(cid, getCreatureMaxMana(cid))

doPlayerSendTextMessage(cid, 22, "Voce terminou de invocar forcas. Regenerou toda sua vida e mana")

end

end

 

return true

end

 

function onWalk(cid, fromPosition, toPosition)

 

if isPlayer(cid) then

if getPlayerStorageValue(cid, 12544) == 1 then

if getPlayerStorageValue(cid, 12543) > os.time() then

return false

end

end

end

 

return true

end

 

function onTarget(cid, target)

 

if isPlayer(cid) or isPlayer(target) then

 

if getPlayerStorageValue(cid, 12544) == 1 then

if getPlayerStorageValue(cid, 12543) > os.time() then

return false

end

end

 

if getPlayerStorageValue(target, 12544) == 1 then

if getPlayerStorageValue(target, 12543) > os.time() then

return false

end

end

 

end

 

return true

end

 

function onCombat(cid, target)

 

if isPlayer(cid) or isPlayer(target) then

 

if getPlayerStorageValue(cid, 12544) == 1 then

if getPlayerStorageValue(cid, 12543) > os.time() then

return false

end

end

 

if getPlayerStorageValue(target, 12544) == 1 then

if getPlayerStorageValue(target, 12543) > os.time() then

return false

end

end

 

end

return true

end

 

function onLogout(cid)

 

if getPlayerStorageValue(cid, 12544) == 1 then

if getPlayerStorageValue(cid, 12543) > os.time() then

return false

end

end

 

return true

end

 

Em login.lua, adicione:

 

registerCreatureEvent(cid, "regw")
registerCreatureEvent(cid, "regt")

registerCreatureEvent(cid, "regl")

registerCreatureEvent(cid, "regta")

registerCreatureEvent(cid, "regc")

 

Em creaturescripts.xml, adicione:

 

<event type="walk" name="regw" event="script" value="regitem.lua"/>

<event type="think" name="regt" event="script" value="regitem.lua"/>

<event type="logout" name="regl" event="script" value="regitem.lua"/>

<event type="target" name="regta" event="script" value="regitem.lua"/>

<event type="combat" name="regc" event="script" value="regitem.lua"/>

 

Editado Abril 13 por miguel223

Gokussj5G
13 de abril de 2016 às 20:53

Cara o script funfo normal mais o processo não ocorreu como tava lá era para realiza esse processo aqui https://www.facebook.com/qdbztibia/videos/736137419856715/

miguel223M
13 de abril de 2016 às 22:08

O que ele nao está fazendo? Eu puis pra se andar, o char voltar pra posição inicial e nao poder ser atacado nem atacar.

Gokussj5G
13 de abril de 2016 às 22:12

O principal não esta healando e quando o player clica fica com a outfit do player e no luga do player entra na capsule de regeneração ela entra nele passa 10 minutos e não faz nada

miguel223M
13 de abril de 2016 às 22:20

Amigo, você devia ter avisado que não eh um item de corpo né. Como eu ia saber? Tentarei arrumar, mas ve se explica melhor da proxima vez. Fazer o mesmo trabalho duas x eh foda...

Gokussj5G
13 de abril de 2016 às 22:22

E metade da culpa foi minha tambem mil desculpa senhor, tem como fazer as função semelhante a o vídeo que eu postei?

miguel223M
13 de abril de 2016 às 22:30

Pronto, testa ai.

Gokussj5G
13 de abril de 2016 às 22:40

[13/04/2016 22:40:19] [Error - Action Interface] 
[13/04/2016 22:40:19] data/actions/scripts/regitem.lua:onUse
[13/04/2016 22:40:19] Description: 
[13/04/2016 22:40:19] attempt to index a number value
[13/04/2016 22:40:19] stack traceback:
[13/04/2016 22:40:19]     [C]: in function 'doCreateItem'
[13/04/2016 22:40:20]     data/actions/scripts/regitem.lua:8: in function <data/actions/scripts/regitem.lua:1>

deu esse bug que ele removeu o item mais não healo

miguel223M
13 de abril de 2016 às 22:48

Tenta de novo.

Gokussj5G
13 de abril de 2016 às 23:01

e funfo mais pq ele só usa uma vez?

miguel223M
13 de abril de 2016 às 23:04

Como assim? Não aparece o item do lugar de volta, ou o carinha nao consegue clicar de novo?

Gokussj5G
13 de abril de 2016 às 23:08

Deu esse bug aqui

 

[13/04/2016 23:05:45] [Error - CreatureScript Interface] 
[13/04/2016 23:05:45] data/creaturescripts/scripts/regitem.lua:onThink
[13/04/2016 23:05:45] Description: 
[13/04/2016 23:05:45] (luaDoRemoveItem) Item not found

o bug e só no caso da substituição do item pela outfit e o player o resto de boas

Sem título.png

570efb93517b3_Semttulo.thumb.png.7f2732ada4833b0633ebb01e3b4483cc.png

Editado Abril 13 por Gokussj5

Gokussj5G
15 de abril de 2016 às 17:48

@UP
@UP

Gokussj5G
17 de abril de 2016 às 12:36

@UP
@UP
@UP
@UP