Função Getcreaturehealth

Fakezim
em Lixeira Pública

Fakezim

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 27/06/06Posts: 4Gênero: Masculino

Bom, minha dúvida é a seguinte :

Em qualquer script que eu use a função 'getCreatureHealth' ela não funciona, dá erro. E não é erro de escrita na função, e sim a própria função não funciona.

Será que existe alguma solução para isso? Nunca vi algo assim, a própria função parar de funcionar.

Eu tinha um Otserv 8.5, bem antiguinho, e atualmente resolvi abrir novamente um Otserv, mas 8.6.

Consegui arrumar quase tudo, porém, eu uso a função 'getCreatureHealth' em muitos scripts, e todos eles dão falha.

Então, se alguém souber a solução, aguardo respostas.

Erimyth

Salvem o mundo! ele é o unico que contem cerveja
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 12/11/08Posts: 518Gênero: Masculino

Fakezim

Entra em sua pasta \data\lib

 

Abre o seguinte arquivo: function.lua

 

vai abrir a lista de funções Lib do seu servidor

ali vc podera encontrar a função que sera usada para projetar o getcreaturehealth

 

caso Esta Função "getCreatureHealth" nao estiver na lista de functions.lua

encontre outra q tem o mesmo objetivo.

 

Abraços Boa Sorte.

SkyDangerous

Deus Kalec
avatar
Lorde
Lorde

INFOS

Grupo: LordeRegistrado: 17/01/09Posts: 2098Char no Tibia: Adra Sata

Tem certeza que não é erro de sintaxe?

Me segui lá (:

 

b906.png

http://ageofwar.servegame.com/

IP: ageofwar.servegame.com

TIBIA: 10.78

GLOBAL PERFECT CUSTOM

Fakezim

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 27/06/06Posts: 4Gênero: Masculino

Eremyth,

 

Realmente, não achei 'getCreatureHealth', então terei que pegar a function.lua de outro Otserv da mesma versão que o meu?

 

------------------

 

SkyDangerous,

 

Sim, tenho certeza. Porque outros scripts que estavam prontos, e funcionavam perfeitamente em meu antigo server, dava erro apenas nessa função. Eu até fiz outros scripts básicos pra testar se realmente era a função que estava dando erro, e confirmei que é sim a função.

Vinc

The white fox
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 30/10/11Posts: 625Gênero: Masculino

getcreaturehealth é uma funçao basica do ot,ela n fica na lib,se n me engano e nas sourcers

mais so pra comfirma posta um script que se feis com a funçao pra ve se n tem nenhum errinho

^w^

Demonbholder

avatar
Infante
Infante

INFOS

Grupo: InfanteRegistrado: 13/10/08Posts: 1551Char no Tibia: Demonbholder

Da pra burlar usando um statschange.

Oie :D

Fakezim

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 27/06/06Posts: 4Gênero: Masculino

O script é meio complexo, é uma parte de um sistema de pets, vou postar apenas o script que está dando o erro :

 

PETS = {
VERSION = "1.72",
PREFIX = "PET_",
CHANNELID = 1,
IDENTIFICATION = {
 [1] = {
  name = "Cat",
  price = 100,
  health = 100,
  evolve = {
to = 3,
at = 10,
  },
  check = true,
 },
 [2] = {
  name = "Dog",
  price = 100,
  health = 100,
  evolve = {
to = 4,
at = 10,
  },
  check = true,
 },
 [3] = {
  name = "Tiger",
  price = false,
  health = 300,
  check = false,
  info = "Evolves from Cat."
 },
 [4] = {
  name = "Lion",
  price = false,
  health = 300,
  check = false,
  info = "Evolves from Dog."
 },
 [5] = {
  name = "Husky",
  price = 150,
  health = 150,
  check = function(cid) return isPremium(cid) end,
  info = "Requires a premium account."
 },
 [6] = {
  name = "Wolf",
  price = 300,
  health = 200,
  evolve = {
to = 7,
at = 28,
  },
  check = function(cid) return getPlayerLevel(cid) >= 10 end,
  info = "Requires level 10."
 },
 [7] = {
  name = "War Wolf",
  price = false,
  health = 500,
  evolve = {
to = 8,
at = 55,
  },
  check = false,
  info = "Evolves from Wolf."
 },
 [8] = {
  name = "Werewolf",
  price = false,
  health = 1000,
  check = false,
  info = "Evolves from War Wolf."
 },
 [9] = {
  name = "Bear",
  price = 200,
  health = 300,
  check = function(cid) return isDruid(cid) and getPlayerLevel(cid) >= 10 end,
  info = "Only available to druids above level 10."
 },
 [10] = {
  name = "Panda",
  price = 200,
  health = 300,
  check = function(cid) return isDruid(cid) and getPlayerLevel(cid) >= 10 end,
  info = "Only available to druids above level 10."
 },
 [11] = {
  name = "Chicken",
  price = 50,
  health = 50,
  check = true,
 },
 [12] = {
  name = "Sheep",
  price = 50,
  health = 50,
  check = true,
 },
 [13] = {
  name = "Seagull",
  price = 100,
  health = 100,
  check = function(cid) return isPremium(cid) end,
  info = "Requires a premium account."
 },
 [14] = {
  name = "Parrot",
  price = 100,
  health = 100,
  check = function(cid) return isPremium(cid) end,
  info = "Requires a premium account."
 },
 [15] = {
  name = "Penguin",
  price = 100,
  health = 100,
  check = function(cid) return isPremium(cid) end,
  info = "Requires a premium account."
 },
 [16] = {
  name = "Elephant",
  price = 300,
  health = 300,
  check = function(cid) return isPremium(cid) and getPlayerLevel(cid) >= 10 end,
  info = "Only available to Premium accounts above level 10."
 },
 [17] = {
  name = "Dragon Hatchling",
  price = 1000,
  health = 300,
  evolve = {
to = 18,
at = 20,
  },
  check = function(cid) return isPremium(cid) and isSorcerer(cid) and getPlayerLevel(cid) >= 25 end,
  info = "Only available to Premium Sorcerers above level 25."
 },
 [18] = {
  name = "Dragon",
  price = false,
  health = 1000,
  check = false,
  info = "Evolves from Dragon Hatchling."
 },
 [19] = {
  name = "Monster Killer",
  price = 1000000,
  health = 3000000,
  check = function(cid) return isPremium(cid) and getPlayerLevel(cid) >= 15000 end,
  info = "Only avaible to Premium accounts above level 15000"
 },
}
}
STORAGE = {
PETTYPE = 10000,
PETUID = 10001,
LOSTHEALTH = 10002,
MAXHEALTH = 10003,
EXPERIENCE = 10004,
LEVEL = 10005,
}
function getExpNeeded(level)
return (50 * (level - 1)^3 - 150 * (level - 1)^2 + 400 * (level - 1)) / 3
end
petNames = {}
for i, v in ipairs(PETS.IDENTIFICATION) do
petNames[v.name:lower()] = i
end
function sendMessage(cid, message)
return doPlayerSendChannelMessage(cid, "", message, TALKTYPE_CHANNEL_O, PETS.CHANNELID)
end
function resetPlayerPet(cid)
setPlayerStorageValue(cid, STORAGE.PETTYPE, -1)
setPlayerStorageValue(cid, STORAGE.PETUID, -1)
setPlayerStorageValue(cid, STORAGE.LOSTHEALTH, 0)
setPlayerStorageValue(cid, STORAGE.MAXHEALTH, 0)
setPlayerStorageValue(cid, STORAGE.EXPERIENCE, 0)
setPlayerStorageValue(cid, STORAGE.LEVEL, 1)
end
function getPlayerPet(cid)
return getPlayerStorageValue(cid, STORAGE.PETUID)
end
function setPlayerPet(cid, pet)
return setPlayerStorageValue(cid, STORAGE.PETUID, pet)
end
function getPlayerPetType(cid)
return getPlayerStorageValue(cid, STORAGE.TYPE)
end
function setPlayerPetType(cid, type)
return setPlayerStorageValue(cid, STORAGE.TYPE, type)
end
function evolvePet(cid)
local pet = PETS.IDENTIFICATION[getPlayerPetType(cid)]
if pet.evolve then
 local petcid = getPlayerPet(cid)
 local pos
 if isCreature(petcid) then
  pos = getCreaturePosition(petcid)
  doRemoveCreature(petcid)
 end
 setPlayerPet(cid, 0)
 setPlayerPetType(cid, pet.evolve.to)
 setPlayerStorageValue(cid, STORAGE.MAXHEALTH, PETS.IDENTIFICATION[pet.evolve.to].health)
 setPlayerStorageValue(cid, STORAGE.LOSTHEALTH, 0)
 if pos then
  summonPet(cid, pos)
 end
 return true
end
return false
end
function addPetExp(cid, amount)
local totalExp = getPlayerStorageValue(cid, STORAGE.EXPERIENCE) + amount
setPlayerStorageValue(cid, STORAGE.EXPERIENCE, totalExp)
local level = getPlayerStorageValue(cid, STORAGE.LEVEL)
local leveled = false
while totalExp >= getExpNeeded(level + 1) do
 level = level + 1
 leveled = true
end
if leveled then
 local petType = getPlayerPetType(cid)
 setPlayerStorageValue(cid, STORAGE.LEVEL, level)
 sendMessage(cid, "Your "..PETS.IDENTIFICATION[petType].name.." has leveled up to level "..level..".")
 if PETS.IDENTIFICATION[petType].evolve then
  if level >= PETS.IDENTIFICATION[petType].evolve.at then
local position = getCreaturePosition(cid)
evolvePet(cid)
sendMessage(cid, "Your "..PETS.IDENTIFICATION[petType].name.." has evolved into a "..PETS.IDENTIFICATION[PETS.IDENTIFICATION[petType].evolve.to].name..".")
  end
 end
end
end
function addPet(cid, type)
if isCreature(getPlayerPet(cid)) then
 return false
end
resetPlayerPet(cid)
setPlayerPet(cid, 0)
setPlayerPetType(cid, type)
setPlayerStorageValue(cid, STORAGE.MAXHEALTH, PETS.IDENTIFICATION[type].health)
return true
end
function summonPet(cid, pos)
if isCreature(getPlayerPet(cid)) then
 return false
end
if getTilePzInfo(getCreaturePosition(cid)) or getTilePzInfo(pos) or doTileQueryAdd(cid, pos) ~= 1 then
 return false
end
local pet = doSummonCreature(PETS.PREFIX..PETS.IDENTIFICATION[getPlayerPetType(cid)].name, pos)
if isCreature(pet) then
 doSendMagicEffect(pos, CONST_ME_TELEPORT)
 doConvinceCreature(cid, pet)
 local maxHealth = getPlayerStorageValue(cid, STORAGE.MAXHEALTH)
 setCreatureMaxHealth(pet, maxHealth)
 doCreatureAddHealth(pet, maxHealth - getCreatureHealth(pet) - getPlayerStorageValue(cid, STORAGE.LOSTHEALTH))
 setPlayerPet(cid, pet)
 doCreatureSetSkullType(pet, SKULL_YELLOW)
 registerCreatureEvent(pet, "PetDeath")
 registerCreatureEvent(pet, "PetKill")
 registerCreatureEvent(pet, "PetAttack")
 return pet
end
return false
end
function canBuyPet(cid, id)
if getPlayerAccess(cid) >= 3 then
 return true
end
if not PETS.IDENTIFICATION[id].price then
 return false
end
if type(PETS.IDENTIFICATION[id].check) == "function" then
 return PETS.IDENTIFICATION[id].check(cid)
end
return PETS.IDENTIFICATION[id].check
end

 

Detalhe : Quando tiro a parte 'getCreatureHealth' o script funciona normalmente, porém, fica incompleto, e não executa parte do sistema. E isso é a parte base do sistema, existe outro script do sistema que também usa getCreatureHealth, mas essa é indispensável.

Demonbholder

avatar
Infante
Infante

INFOS

Grupo: InfanteRegistrado: 13/10/08Posts: 1551Char no Tibia: Demonbholder

Com monstros não é possível burlar.

 

Qual o erro que você está recebendo?

Oie :D

digo1040

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 12/01/11Posts: 59

A algum tempo atras eu tinha baixado um distro que não havia a função getCreatureHealth, procurei num editor hexadecimal e não achei essa função e nenhuma parecida, a solução foi trocar de distro.

As Vezes construímos sonhos em cima de grandes pessoas, o tempo pas-

sa e descobrimos que grande mesmo eram os sonhos e as pessoas pe-



quenas demais para torná-los reais!

Fakezim

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 27/06/06Posts: 4Gênero: Masculino

Demoonbholder

 

Ao executar o server aparece alguma coisa como : "attemp call global 'getCreatureHealth' ", aí mostra o script e a linha que dá erro

 

------------------------------------------

 

Digaao

 

Por acaso era o Slayer Yurots 8.6?

digo1040

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 12/01/11Posts: 59

É esse sim :D

 

Baixe algum outro distro, provavelmente você terá vários bugs mas não são difíceis de resolver :D

 

---Edit

Esse erro que aparece significa que não há a função no ot.

As Vezes construímos sonhos em cima de grandes pessoas, o tempo pas-

sa e descobrimos que grande mesmo eram os sonhos e as pessoas pe-



quenas demais para torná-los reais!

Fakezim

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 27/06/06Posts: 4Gênero: Masculino

Digaao

 

Ah sim, muito obrigado. Agora vou ter que ter paciência pra configurar todos scripts e configurações tuuuuudo denovo :(, kkkk, só faltava esse script pra eu começar a abrir meu OT, mas obrigado, vou baixar outro distro.