Ir para conteúdo

Featured Replies

Postado

Pessoal, eu estava dando uma mexida numa talk, que tinha no meu serv dei uma aprimorada nela, porem não conseguir fazer com que o player ganhe hp em um determinado tempo, que no caso seria 10% a mais da total, eu tentei ajeitar mas acho que escrevi a função errada, ou sei lá , ela tá funcionando perfeitamente, a unica coisa que falta nela é o aumento de hp e mana em 10% do total em um determinado tempo, que já tá na script em local tempo.

Spoiler

local tempo = 60 * 1000
local config = {
--[vocation id] = { level, nova voc, looktype, efeito}
[1] = { 1, 2, 398, 13, 30, 10},
[2] = { 80, 3, 399, 13, 30, 10}
}
function onSay(cid, words, param, channel)
local from,to = {x=1001, y=705, z=7},{x=1031, y=737, z=7} -- começo e final do mapa
local from2,to2 = {x=1011, y=705, z=6},{x=1031, y=738, z=6} -- começo e final do mapa
local from3,to3 = {x=1012, y=706, z=5},{x=1032, y=739, z=5} -- começo e final do mapa
local from4,to4 = {x=985, y=598, z=7},{x=1044, y=652, z=7} -- começo e final do mapa
local from5,to5 = {x=986, y=615, z=6},{x=1039, y=647, z=7} -- começo e final do mapa
local from6,to6 = {x=990, y=616, z=5},{x=1040, y=647, z=5} -- começo e final do mapa
if isInRange(getCreaturePosition(cid), from, to) or isInRange(getCreaturePosition(cid), from2, to2) or isInRange(getCreaturePosition(cid), from3, to3) or isInRange(getCreaturePosition(cid), from4, to4) or isInRange(getCreaturePosition(cid), from5, to5) or isInRange(getCreaturePosition(cid), from6, to6) then
doPlayerSendCancel(cid, "Você não pode se Transformar nesta área!") return true
end
doPlayerSay(cid, "transformar")
local voc = config[getPlayerVocation(cid)]
if voc then
if getPlayerLevel(cid) >= voc[1] then
    registerCreatureEvent(cid, "stordeath")
    setPlayerStorageValue(cid, voc_stor, getPlayerVocation(cid))
    doPlayerSetVocation(cid, voc[2])
    addEvent(doPlayerSetVocation,tempo,cid,getPlayerStorageValue(cid, voc_stor))
    addEvent(setPlayerStorageValue,tempo,cid,voc_stor,0)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Você Transformou!")
local outfit = {lookType = voc[3]}
    doSetCreatureOutfit(cid, outfit, tempo)
doSendMagicEffect(getCreaturePosition(cid), voc[4])
local efeito = voc[5]

local function meffect(cid,t)
    if isPlayer(cid) and t ~= 0 then
        doSendMagicEffect(getThingPos(cid), efeito)
        addEvent(meffect, 1000, cid, (t - 1))
    end
end
meffect(cid,(tempo/1000))
setCreatureMaxHealthPercent(cid, 100 + voc[6])
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Você precisa estar no level " .. voc[1] .. " para transformar.")
end
else
doPlayerSendCancel(cid, "Você não pode se Transformar!")
end
return true
end

Desde já agradeço pela contribuição !!

REP+

Resolvido por xWhiteWolf

Ir para solução
  • Respostas 10
  • Visualizações 518
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • tenta assim local from,to = {x=1001, y=705, z=7},{x=1031, y=737, z=7} -- começo e final do mapa local from2,to2 = {x=1011, y=705, z=6},{x=1031, y=738, z=6} -- começo e final do mapa local from

Postado

Tenta usar este:

 

local tempo = 60 * 1000
local config = {
--[vocation id] = { level, nova voc, looktype, efeito}
[1] = { 1, 2, 398, 13, 30, 10},
[2] = { 80, 3, 399, 13, 30, 10}
}
function onSay(cid, words, param, channel)
local from,to = {x=1001, y=705, z=7},{x=1031, y=737, z=7} -- começo e final do mapa
local from2,to2 = {x=1011, y=705, z=6},{x=1031, y=738, z=6} -- começo e final do mapa
local from3,to3 = {x=1012, y=706, z=5},{x=1032, y=739, z=5} -- começo e final do mapa
local from4,to4 = {x=985, y=598, z=7},{x=1044, y=652, z=7} -- começo e final do mapa
local from5,to5 = {x=986, y=615, z=6},{x=1039, y=647, z=7} -- começo e final do mapa
local from6,to6 = {x=990, y=616, z=5},{x=1040, y=647, z=5} -- começo e final do mapa
if isInRange(getCreaturePosition(cid), from, to) or isInRange(getCreaturePosition(cid), from2, to2) or isInRange(getCreaturePosition(cid), from3, to3) or isInRange(getCreaturePosition(cid), from4, to4) or isInRange(getCreaturePosition(cid), from5, to5) or isInRange(getCreaturePosition(cid), from6, to6) then
doPlayerSendCancel(cid, "Você não pode se Transformar nesta área!") return true
end
doPlayerSay(cid, "transformar")
local voc = config[getPlayerVocation(cid)]
if voc then
if getPlayerLevel(cid) >= voc[1] then
	local heal1 = getCreatureMaxHealth(cid)/10
	local life = getCreatureMaxHealth(cid)+heal1
	local mana1 = getCreatureMaxMana(cid)/10
	local mana = getCreatureMaxMana(cid)+mana1
	addEvent(setCreatureMaxMana, tempo, mana)
	addEvent(setCreatureMaxHealth, tempo, life)
    registerCreatureEvent(cid, "stordeath")
    setPlayerStorageValue(cid, voc_stor, getPlayerVocation(cid))
    doPlayerSetVocation(cid, voc[2])
    addEvent(doPlayerSetVocation,tempo,cid,getPlayerStorageValue(cid, voc_stor))
    addEvent(setPlayerStorageValue,tempo,cid,voc_stor,0)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Você Transformou!")
local outfit = {lookType = voc[3]}
    doSetCreatureOutfit(cid, outfit, tempo)
doSendMagicEffect(getCreaturePosition(cid), voc[4])
local efeito = voc[5]
local function meffect(cid,t)
    if isPlayer(cid) and t ~= 0 then
        doSendMagicEffect(getThingPos(cid), efeito)
        addEvent(meffect, 1000, cid, (t - 1))
    end
end
meffect(cid,(tempo/1000))
setCreatureMaxHealthPercent(cid, 100 + voc[6])
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Você precisa estar no level " .. voc[1] .. " para transformar.")
end
else
doPlayerSendCancel(cid, "Você não pode se Transformar!")
end
return true
end

Creio que funcione!

Postado
  • Autor

Eu tentei maniw, creio que a script tá 100% só que n tá funcionando, n da erro nem nada, manjo mais ou menos em script, e sei que n tá errada. mas n adiciona nada de hp e mana. pode me ajudar?

a disto n deu nem um erro... tudo tranquilo as outras funções funcionaram normal menos a da hp e da mana.

Postado

Tenta essa :

 

Spoiler

local tempo = 60 * 1000
local config = {
--[vocation id] = { level, nova voc, looktype, efeito}
[1] = { 1, 2, 398, 13, 30, 10},
[2] = { 80, 3, 399, 13, 30, 10}
}
function onSay(cid, words, param, channel)
local from,to = {x=1001, y=705, z=7},{x=1031, y=737, z=7} -- começo e final do mapa
local from2,to2 = {x=1011, y=705, z=6},{x=1031, y=738, z=6} -- começo e final do mapa
local from3,to3 = {x=1012, y=706, z=5},{x=1032, y=739, z=5} -- começo e final do mapa
local from4,to4 = {x=985, y=598, z=7},{x=1044, y=652, z=7} -- começo e final do mapa
local from5,to5 = {x=986, y=615, z=6},{x=1039, y=647, z=7} -- começo e final do mapa
local from6,to6 = {x=990, y=616, z=5},{x=1040, y=647, z=5} -- começo e final do mapa
if isInRange(getCreaturePosition(cid), from, to) or isInRange(getCreaturePosition(cid), from2, to2) or isInRange(getCreaturePosition(cid), from3, to3) or isInRange(getCreaturePosition(cid), from4, to4) or isInRange(getCreaturePosition(cid), from5, to5) or isInRange(getCreaturePosition(cid), from6, to6) then
doPlayerSendCancel(cid, "Você não pode se Transformar nesta área!") return true
end
doPlayerSay(cid, "transformar")
local voc = config[getPlayerVocation(cid)]
if voc then
if getPlayerLevel(cid) >= voc[1] then
    registerCreatureEvent(cid, "stordeath")
    setPlayerStorageValue(cid, voc_stor, getPlayerVocation(cid))
    doPlayerSetVocation(cid, voc[2])
    addEvent(doPlayerSetVocation,tempo,cid,getPlayerStorageValue(cid, voc_stor))
    addEvent(setPlayerStorageValue,tempo,cid,voc_stor,0)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Você Transformou!")
local outfit = {lookType = voc[3]}
    doSetCreatureOutfit(cid, outfit, tempo)
doSendMagicEffect(getCreaturePosition(cid), voc[4])
local efeito = voc[5]

local function meffect(cid,t)
    if isPlayer(cid) and t ~= 0 then
        doSendMagicEffect(getThingPos(cid), efeito)
        addEvent(meffect, 1000, cid, (t - 1))
    end
end
meffect(cid,(tempo/1000))
setCreatureMaxHealthPercent(cid, 100 + voc[1])
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Você precisa estar no level " .. voc[1] .. " para transformar.")
end
else
doPlayerSendCancel(cid, "Você não pode se Transformar!")
end
return true
end



 

Postado
  • Autor

maniw nessa parte --- setCreatureMaxHealthPercent(cid, 100 + voc[1])  onde tem voc[1] é para ser executado aquela coluna, no caso o voc[1] ia ser as vocações desse forma /\ não a porcentagem da ultima coluna, eu creio que esse  setCreatureMaxHealthPercent não exista, eu só fiz uma tentativa com ele, mas pelo que entendi o erro da primeira script que me responderam, é que não foi indentificada a creatura, -- pois da tipo um erro na distro depois que passa o tempo, creature not font algo assim.

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo