MA
pedido

Verificação De Full Mana E Health

Por Mattziin, 29 de ago. de 2012 em Scripts

script
27
2.7k
LuckOakeL
29 de agosto de 2012 às 20:43

@SkyLigh

 

Tá, já percebemos que não funciona. Mas ao invés de simplesmente falar que não funciona, me corrija.

 

@Topic

 

Tenta assim:

 

 

local interval = 0

local heals = {

['hp'] = 800,

['mana'] = 800,

}

local php = getCreatureMaxHealth(cid)

local mhp = getCreatureMaxMana(cid)

 

----

local interval = 1000

local function rot(cid,n,old)

local tb_rot = {{0,2},{6,5},{1,3},{7,4},false}

if isPlayer(cid) == FALSE or tb_rot[n] == nil or old.x ~= getCreaturePosition(cid).x or old.y ~= getCreaturePosition(cid).y then

return false

end

 

if tb_rot[n] == false then

while getCreatureHealth(cid) ~= php and getCreatureMana(cid) ~= mhp do

doCreatureAddHealth(cid, heals['hp'])

doCreatureAddMana(cid, heals['mana'])

doSendMagicEffect(getCreaturePosition(cid), 3)

addEvent(rot, interval,cid,2,old)

end

doPlayerSendCancel(cid, "Life e Mana completos.")

return false

end

n = n+1

addEvent(rot, interval,cid,n,old)

end

 

function onSay(cid, words, param)

if isInArray(cid) == TRUE then

return FALSE

end

addEvent(rot, interval,cid,1,getCreaturePosition(cid))

return FALSE

end

 

Editado Agosto 29 por LuckOake

MulizeuM
29 de agosto de 2012 às 20:43
local interval = 0
local heals = {
['hp'] = 800,
['mana'] = 800,
}
----
local interval = 1000
local function rot(cid,n,old)
  local tb_rot = {{0,2},{6,5},{1,3},{7,4},false}			   
  if isPlayer(cid) == FALSE or tb_rot[n] == nil or old.x ~= getCreaturePosition(cid).x or old.y ~= getCreaturePosition(cid).y then
							  return false
  end
  if tb_rot[n] == false then
							  doCreatureAddHealth(cid, heals['hp'])
							  doCreatureAddMana(cid, heals['mana'])
							  doSendMagicEffect(getCreaturePosition(cid), 3)
							  addEvent(rot, interval,cid,2,old)
							  return false
  end
  n = n+1
  addEvent(rot, interval,cid,n,old)
end
function onSay(cid, words, param)
															 if isInArray(cid) == TRUE then
																			    return FALSE
															 end
															 if getPlayerMaxMana(cid) and getCreatureMaxHealth(cid) then
															 doPlayerSendCancel(cid,"Your life and mana full")
															 end
															 addEvent(rot, interval,cid,1,getCreaturePosition(cid))

															 return FALSE
end

MattziinM
29 de agosto de 2012 às 20:50

Luck esta a mesma coisa lek , o ot trava !

e

mulizeu esta a mesma coisa , ele continua a encher e diz "you life and mana full" :S

Editado Agosto 29 por Mattziin

SkyLighS
29 de agosto de 2012 às 20:56
local interval = 0
local heals = {
['hp'] = 800,
['mana'] = 800,
}
----
local interval = 1000
local function rot(cid,n,old)
  local tb_rot = {{0,2},{6,5},{1,3},{7,4},false}						 
  if isPlayer(cid) == FALSE or tb_rot[n] == nil or old.x ~= getCreaturePosition(cid).x or old.y ~= getCreaturePosition(cid).y then
															  return false
  end
  if tb_rot[n] == false then
															  doCreatureAddHealth(cid, heals['hp'])
															  doCreatureAddMana(cid, heals['mana'])
															  doSendMagicEffect(getCreaturePosition(cid), 3)
															  addEvent(rot, interval,cid,2,old)
															  return false
  end
  n = n+1
  addEvent(rot, interval,cid,n,old)
end
function onSay(cid, words, param)
																															 if isInArray(cid) == TRUE then
																																							    return FALSE
																															 end
																															 if getPlayerMaxMana(cid) and getCreatureMaxHealth(cid) then
																															 doPlayerSendCancel(cid,"Your life and mana full")
																															 end
																															 addEvent(rot, interval,cid,1,getCreaturePosition(cid))

																															 return FALSE
end
if getCreatureMaxHealth(cid) then
if getPlayerMaxMana(cid) then
doPlayerSendTextMessage(cid, 22 ,"Desculpe Voce ja tem a mana full")
end
return true
end

MulizeuM
29 de agosto de 2012 às 21:09

Mais ele contua a encher mana e life vazia ou cheia??

 

se for cheia é so por isso

 

 

local interval = 0
local heals = {
['hp'] = 800,
['mana'] = 800,
}
----
local interval = 1000
local function rot(cid,n,old)
  local tb_rot = {{0,2},{6,5},{1,3},{7,4},false}						  
  if isPlayer(cid) == FALSE or tb_rot[n] == nil or old.x ~= getCreaturePosition(cid).x or old.y ~= getCreaturePosition(cid).y then
															  return false
  end
  if tb_rot[n] == false then
															  doCreatureAddHealth(cid, heals['hp'])
															  doCreatureAddMana(cid, heals['mana'])
															  doSendMagicEffect(getCreaturePosition(cid), 3)
															  addEvent(rot, interval,cid,2,old)
															  return false
  end
  n = n+1
  addEvent(rot, interval,cid,n,old)
end
function onSay(cid, words, param)
																															 if isInArray(cid) == TRUE then
																																							    return FALSE
																															 end
																															 if getPlayerMaxMana(cid) and getCreatureMaxHealth(cid) then
																															   return doPlayerSendCancel(cid,"Your life and mana full")
																															 end
																															 addEvent(rot, interval,cid,1,getCreaturePosition(cid))

																							   return FALSE
end

MattziinM
29 de agosto de 2012 às 21:18

SkyLight

ficou a mesma coisa lek :S

 

Mulizeu

Agora ele nao enche , ele diz q ta full sendo q nao estar !

Editado Agosto 29 por Mattziin

VodkartV
29 de agosto de 2012 às 21:22
function onSay(cid, words, param)
events = {}
function rot(cid, formula)
 if not isCreature(cid) then return LUA_ERROR end
 if getCreatureHealth(cid) < getCreatureMaxHealth(cid) or getCreatureMana(cid) < getCreatureMaxMana(cid) then
 doCreatureAddHealth(cid, getCreatureHealth(cid) < getCreatureMaxHealth(cid) and formula.hp or 0)
 doCreatureAddMana(cid, getCreatureMana(cid) < getCreatureMaxMana(cid) and formula.mana or 0)
 doSendMagicEffect(getCreaturePosition(cid), 3)
 events[getPlayerGUID(cid)] = addEvent(rot, 1000, cid, formula)
end
return true
end
local x = {hp = 800, mana = 800}
rot(cid, x)
return true
end

MattziinM
29 de agosto de 2012 às 21:34

Vodkart

 

Lek eu te amo funfou :D s2s2s2s2s2

 

Só q nao aparece a mensagem "Vc estar full" quando estar full.

 

poderia adicionar uma função de falar sem ser o doPlayerSendCancel ? :)

Editado Agosto 29 por Mattziin

VodkartV
29 de agosto de 2012 às 21:40
function onSay(cid, words, param)
events = {}
function rot(cid, formula)
 if not isCreature(cid) then return LUA_ERROR end
 if getCreatureHealth(cid) < getCreatureMaxHealth(cid) or getCreatureMana(cid) < getCreatureMaxMana(cid) then
 doCreatureAddHealth(cid, getCreatureHealth(cid) < getCreatureMaxHealth(cid) and formula.hp or 0)
 doCreatureAddMana(cid, getCreatureMana(cid) < getCreatureMaxMana(cid) and formula.mana or 0)
 doSendMagicEffect(getCreaturePosition(cid), 3)
 events[getPlayerGUID(cid)] = addEvent(rot, 1000, cid, formula)
end
return true
end
local x = {hp = 800, mana = 800}
if getCreatureHealth(cid) == getCreatureMaxHealth(cid) and getCreatureMana(cid) == getCreatureMaxMana(cid) then
doPlayerSendTextMessage(cid, 22 , "Desculpe mais sua mana e hp ja esta full") return true
end
rot(cid, x)
return true
end

Editado Agosto 29 por Vodkart

MattziinM
29 de agosto de 2012 às 21:45

Vodkart

Mano Deu Certo , muito obrigado mesmo.

 

Skylight, Mozuli e luckoake

obrigado por tentarem me ajuda :)

 

 

Podem fechar o topico.

 

O Vodkart vc poderia me ajuda aqui tambem ? http://www.xtibia.com/forum/topic/193003-script-pra-uma-sword/page__fromsearch__1

Editado Agosto 29 por Mattziin

SkyLighS
29 de agosto de 2012 às 21:52

duvida sanada

reportado

MattziinM
29 de agosto de 2012 às 22:22

Eta esqueci de dizer , vodkart mais esse dai quando ele anda continua enchendo , eu queria um q se ele andar para na hora entendeu?

ou entao um que se algum player te atacar ele para de healar na hora.

 

 

tem como buga com essa talkactions se bota na hotckey e fica falando direto ela ela enche muito rapido e buga , nao existe uma maneira de tirar isso nao ?

Editado Setembro 2 por Mattziin