Postado Maio 27, 2012 13 anos Em action.xml: <action uniqueid="1334" script="NOME_SCRIPT.lua"/> em action/script: function onUse(cid, item, fromPosition, itemEx, toPosition) local pos = getCreaturePosition(cid) local storage = 9977 -- storage, se mudou aki mude no creaturescripts local health = 10 -- vida que vai healar por segundo local Und = 1334 -- unique id do item (adicione o uniqueid no map) local delay = 1 -- delay por heal (segundos) local effect = 12 -- efeito (nao precisa mecher) function foder() if getCreatureHealth(cid) == getCreatureMaxHealth(cid) and getPlayerStorageValue(cid,storage) == 1 then doPlayerSendTextMessage(cid,4,"Seu hp esta cheio.") doPlayerSetStorageValue(cid,storage,-1) doCreatureSetNoMove(cid,false) elseif getCreatureHealth(cid) < getCreatureMaxHealth(cid) and getPlayerStorageValue(cid,storage) == 1 then doCreatureSetNoMove(cid,true) addEvent(doCreatureAddHealth,delay*1000,cid,health) addEvent(doSendMagicEffect,delay*1000,pos,12) addEvent(foder,1000) end end if getPlayerStorageValue(cid,storage) == 1 then doPlayerSendTextMessage(cid,4,"Voce esta sendo healado, espere.") elseif item.uid == Und and getCreatureHealth(cid) == getCreatureMaxHealth(cid) and getPlayerStorageValue(cid,storage) == -1 then doPlayerSendTextMessage(cid,4,"Seu hp esta full.") elseif item.uid == Und and getCreatureHealth(cid) < getCreatureMaxHealth(cid) and getPlayerStorageValue(cid,storage) == -1 then doPlayerSendTextMessage(cid,4,"Heal.") doPlayerSetStorageValue(cid,storage,1) addEvent(foder,100) end return TRUE end Agora para não bugar, em creaturescript/scripts: function onLogout(cid) local storage = 9977 if getPlayerStorageValue(cid,storage) == 1 then doPlayerSetStorageValue(cid,storage,-1) doCreatureSetNoMove(cid,false) end return TRUE end Agora em creaturescript/creaturescript.xml: <event type="logout" name="Healing" event="script" value="NOME_SCRIPT.lua"/> Bem, axo que não vai ter bugs.. Não esqueça de adicionar o UniqueID 1334 no mapa, no tile que você quer que heale.
Postado Maio 27, 2012 13 anos Autor Não deu =/ Como Criar Um Trainer Room! http://tibiaking.com...__fromsearch__1
Postado Maio 27, 2012 13 anos \data\movements\scripts\healing.lua local config = { health = 10, delay = 5, storage = 2454 } function onStepIn(cid, item, position, fromPosition) setPlayerStorageValue(cid, config.storage, -1) Heal(cid) return TRUE end function onStepOut(cid, item, position, fromPosition) setPlayerStorageValue(cid, config.storage, 1) return TRUE end function Heal(cid) if getPlayerStorageValue(cid, config.storage) == -1 then doCreatureAddHealth(cid, config.health) doSendAnimatedText(getCreaturePosition(cid), "+ "..config.health.."", 30) addEvent(Heal, config.delay*1000, cid) end return TRUE end \data\movements\movements.xml <movevent type="StepIn" actionid="ACTION_ID" event="script" value="healing.lua"/> <movevent type="StepOut" actionid="ACTION_ID" event="script" value="healing.lua"/> OBS: Você deve adicionar uma actionId no tile que você quer que carregue, pelo map editor e ai substituir esse numero no ACTION_ID. Editado Maio 27, 2012 13 anos por Kimoszin (veja o histórico de edições)
Postado Maio 27, 2012 13 anos t = { heal = 10, pos = { {x = 186, y = 56, z = 7}, {x = 186, y = 57, z = 7}, {x = 187, y = 56, z = 7}, {x = 187, y = 57, z = 7} } } function onThink(cid, interval, lastExecution) for _, k in ipairs(t.pos) do doSendMagicEffect(k, 56) local x = getTopCreature(k).uid if x > 0 and isPlayer(x) then doSendAnimatedText(getCreaturePosition(x), "+"..t.heal, 30) doCreatureAddHealth(x, t.heal) end end return TRUE end [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
Postado Maio 28, 2012 13 anos Autor \data\movements\scripts\healing.lua local config = { health = 10, delay = 5, storage = 2454 } function onStepIn(cid, item, position, fromPosition) setPlayerStorageValue(cid, config.storage, -1) Heal(cid) return TRUE end function onStepOut(cid, item, position, fromPosition) setPlayerStorageValue(cid, config.storage, 1) return TRUE end function Heal(cid) if getPlayerStorageValue(cid, config.storage) == -1 then doCreatureAddHealth(cid, config.health) doSendAnimatedText(getCreaturePosition(cid), "+ "..config.health.."", 30) addEvent(Heal, config.delay*1000, cid) end return TRUE end \data\movements\movements.xml <movevent type="StepIn" actionid="ACTION_ID" event="script" value="healing.lua"/> <movevent type="StepOut" actionid="ACTION_ID" event="script" value="healing.lua"/> OBS: Você deve adicionar uma actionId no tile que você quer que carregue, pelo map editor e ai substituir esse numero no ACTION_ID. Mano deu certo so que eu saio dos Treiner ele continua Healando nao para Nunka, se Puder arrumar isso para min agradeço Como Criar Um Trainer Room! http://tibiaking.com...__fromsearch__1
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.