Boa tarde, estou precisando de ajuda sobre esse erro no console, se alguém puder me ajudar ;s
o erro do console sempre acontece quando apanho de alguma criatura.
está dizendo que a chave ou variável "getStorageValue" tem valor nulo.
"Deus é amor, mas matou 99,99999% de todos os seres viventes do mundo com o diluvio.
Deus é misericórdia, mas condena as pessoas ao tormento eterno do inferno.
Deus é pai, mas abandonou seus filhos a servidão.
Deus é vida, mas condenou a humanidade a morte.
Deus é o senhor. Senhor das guerras, da morte, do ódio.
Ninguém que ame a humanidade, mataria 99,99999% da população, não só de humanos, bem como dos demais animais, por amor. Isso não é amor, é doença, psicose de um sádico que gosta de ver sua 'criação' sofrer e ainda quer 'pagar' de misericordioso, de deus amor.
Não quero seu amor; não quero sua misericórdia, não quero ser seu filho, não quero sua vida, não quero que seja meu senhor.
Tu és um psicótico, doente, hipócrita, assassino; não me venha querer se passar por bondoso, amoroso, misericordioso."
58 minutos atrás, Poccnn disse:está dizendo que a chave ou variável "getStorageValue" tem valor nulo.
sim, só que não achei o erro, já fiz a troca do "self" instancia da criatura pelo método do player porem n obtive sucesso.
como esta o seu código?
Em 05/01/2021 em 12:24, Starliks disse:sim, só que não achei o erro, já fiz a troca do "self" instancia da criatura pelo método do player porem n obtive sucesso.
Eu não entendo como funciona o sistema 1.0+, mas pelo o que eu saiba tem que ser chamado o objeto para poder ter acesso a sua funções.
No caso o metodo self deva ser uma referencia generica que requer uma chamada de metodo mais objetiva.
player = Player(self)
monstro = Monster(self)
npc = Npc(self)
"Deus é amor, mas matou 99,99999% de todos os seres viventes do mundo com o diluvio.
Deus é misericórdia, mas condena as pessoas ao tormento eterno do inferno.
Deus é pai, mas abandonou seus filhos a servidão.
Deus é vida, mas condenou a humanidade a morte.
Deus é o senhor. Senhor das guerras, da morte, do ódio.
Ninguém que ame a humanidade, mataria 99,99999% da população, não só de humanos, bem como dos demais animais, por amor. Isso não é amor, é doença, psicose de um sádico que gosta de ver sua 'criação' sofrer e ainda quer 'pagar' de misericordioso, de deus amor.
Não quero seu amor; não quero sua misericórdia, não quero ser seu filho, não quero sua vida, não quero que seja meu senhor.
Tu és um psicótico, doente, hipócrita, assassino; não me venha querer se passar por bondoso, amoroso, misericordioso."
18 horas atrás, nociam disse:
function Creature:onChangeOutfit(outfit)
return true
end
function Creature:onAreaCombat(tile, isAggressive)
return RETURNVALUE_NOERROR
end
function Creature:onTargetCombat(target)
target:registerEvent("ItemSetsHealth")
target:registerEvent("UpgradeSystemHealth")
target:registerEvent("UpgradeSystemDeath")
if self:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 1 then
if target:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 1 then
return RETURNVALUE_NOERROR
elseif target:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 0 then
self:sendCancelMessage("You cannot attack someone that is on your team.")
return false
end
elseif self:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 1 then
if target:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 1 then
return RETURNVALUE_NOERROR
elseif target:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 0 then
self:sendCancelMessage("You cannot attack someone that is on your team.")
return false
end
end
end
Vamos fazer um teste e descobrir o valor dessa storage, pois parece ser global, então só fazendo testa para saber o valor dela.
Para ficar mais rápido e simples o teste, vai em Data/Creaturescripts/Scripts e abre o arquivo login.lua, e embaixo de:
function onLogin(player)
Adicione a linha:
print("Storage STORAGEVALUE_WAR_GREENPLAYER_BOOL = " .. Game.getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) .. "\n Storage STORAGEVALUE_WAR_REDPLAYER_BOOL = " .. Game.getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL))
Após isso, inicie o servidor e me manda print da distro assim que fizer login com o player, pois essa linha que falei para adicionar vai mostrar os valores dessas duas storages na distro.
23 horas atrás, Yan18 disse:Vamos fazer um teste e descobrir o valor dessa storage, pois parece ser global, então só fazendo testa para saber o valor dela.
Para ficar mais rápido e simples o teste, vai em Data/Creaturescripts/Scripts e abre o arquivo login.lua, e embaixo de:
function onLogin(player)
Adicione a linha:
print("Storage STORAGEVALUE_WAR_GREENPLAYER_BOOL = " .. Game.getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) .. "\n Storage STORAGEVALUE_WAR_REDPLAYER_BOOL = " .. Game.getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL))
Após isso, inicie o servidor e me manda print da distro assim que fizer login com o player, pois essa linha que falei para adicionar vai mostrar os valores dessas duas storages na distro.
Seria isso ?
2 horas atrás, Starliks disse:
Isso exatamente, e o erro que deu ali é porque alguma ou as duas storages estão sem valor, ou seja, estão como nil, o que significa que os valores estão zerados. E como estão sem valores, vai dar erro no arquivo creature.lua, que é justamente o erro que aponta, o valor da storage está nil. Tem que ver onde e qual arquivo que seta o valor dessas storages globais e ver o porque não está setando, se tem alguma condição específica para isso.
Mas, vamos fazer um tratamento para caso seja valor nil. Substitua o código por esse:
function Creature:onChangeOutfit(outfit) return true end function Creature:onAreaCombat(tile, isAggressive) return RETURNVALUE_NOERROR end function Creature:onTargetCombat(target) target:registerEvent("ItemSetsHealth") target:registerEvent("UpgradeSystemHealth") target:registerEvent("UpgradeSystemDeath") if (self:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == nil or self:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == nil) or (target:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == nil or target:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == nil) then --print("There was an error, please verify the value of the storage [STORAGEVALUE_WAR_GREENPLAYER_BOOL] or [STORAGEVALUE_WAR_REDPLAYER_BOOL] because it them are nil.") return false end if self:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 1 then if target:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 1 then return RETURNVALUE_NOERROR elseif target:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 0 then self:sendCancelMessage("You cannot attack someone that is on your team.") return false end elseif self:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 1 then if target:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 1 then return RETURNVALUE_NOERROR elseif target:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 0 then self:sendCancelMessage("You cannot attack someone that is on your team.") return false end end end
Fiz uma verificação que se alguma dessas storages forem estiverem nil, vai retornar falso e informar o erro para você na distro.
19 minutos atrás, Yan18 disse:Isso exatamente, e o erro que deu ali é porque alguma ou as duas storages estão sem valor, ou seja, estão como nil, o que significa que os valores estão zerados. E como estão sem valores, vai dar erro no arquivo creature.lua, que é justamente o erro que aponta, o valor da storage está nil. Tem que ver onde e qual arquivo que seta o valor dessas storages globais e ver o porque não está setando, se tem alguma condição específica para isso.
Mas, vamos fazer um tratamento para caso seja valor nil. Substitua o código por esse:
function Creature:onChangeOutfit(outfit) return true end function Creature:onAreaCombat(tile, isAggressive) return RETURNVALUE_NOERROR end function Creature:onTargetCombat(target) target:registerEvent("ItemSetsHealth") target:registerEvent("UpgradeSystemHealth") target:registerEvent("UpgradeSystemDeath") if (Game.getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == nil) or (Game.getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == nil) then print("There was an error, please verify the value of the storage [STORAGEVALUE_WAR_GREENPLAYER_BOOL] or [STORAGEVALUE_WAR_REDPLAYER_BOOL] because it them are nil.") return false end if self:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 1 then if target:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 1 then return RETURNVALUE_NOERROR elseif target:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 0 then self:sendCancelMessage("You cannot attack someone that is on your team.") return false end elseif self:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 1 then if target:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 1 then return RETURNVALUE_NOERROR elseif target:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 0 then self:sendCancelMessage("You cannot attack someone that is on your team.") return false end end end
Fiz uma verificação que se alguma dessas storages forem estiverem nil, vai retornar falso e informar o erro para você na distro.
Agora o personagem esta apanhando dos mobs, porém cada ataque q ele sofre acontece esse erro.
5 minutos atrás, Starliks disse:
Eu editei depois, mas você pegou a primeira versão que testei kk. E isso não é erro, é uma mensagem do tratamento que eu fiz. Substitua o código pela minha correção no meu post acima.
2 horas atrás, Starliks disse:
Eu estava dando uma olhada na fonte de onde você pegou esse script, e parece que estava faltando uma verificação.
Substitui o código por esse:
function Creature:onChangeOutfit(outfit) return true end function Creature:onAreaCombat(tile, isAggressive) return RETURNVALUE_NOERROR end function Creature:onTargetCombat(target) target:registerEvent("ItemSetsHealth") target:registerEvent("UpgradeSystemHealth") target:registerEvent("UpgradeSystemDeath") --[[if (self:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == nil) or (self:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == nil) then print("There was an error, please verify the value of the storage [STORAGEVALUE_WAR_GREENPLAYER_BOOL] or [STORAGEVALUE_WAR_REDPLAYER_BOOL] because it them are nil.") return false end]]-- if self:isPlayer() then if self:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 1 then if target:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 1 then return RETURNVALUE_NOERROR elseif target:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 0 then self:sendCancelMessage("You cannot attack someone that is on your team.") return false end elseif self:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 1 then if target:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 1 then return RETURNVALUE_NOERROR elseif target:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 0 then self:sendCancelMessage("You cannot attack someone that is on your team.") return false end end end end
Testa e fala se deu problema.
2 horas atrás, Yan18 disse:Eu estava dando uma olhada na fonte de onde você pegou esse script, e parece que estava faltando uma verificação.
Substitui o código por esse:
function Creature:onChangeOutfit(outfit) return true end function Creature:onAreaCombat(tile, isAggressive) return RETURNVALUE_NOERROR end function Creature:onTargetCombat(target) target:registerEvent("ItemSetsHealth") target:registerEvent("UpgradeSystemHealth") target:registerEvent("UpgradeSystemDeath") --[[if (self:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == nil) or (self:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == nil) then print("There was an error, please verify the value of the storage [STORAGEVALUE_WAR_GREENPLAYER_BOOL] or [STORAGEVALUE_WAR_REDPLAYER_BOOL] because it them are nil.") return false end]]-- if self:isPlayer() then if self:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 1 then if target:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 1 then return RETURNVALUE_NOERROR elseif target:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 0 then self:sendCancelMessage("You cannot attack someone that is on your team.") return false end elseif self:getStorageValue(STORAGEVALUE_WAR_REDPLAYER_BOOL) == 1 then if target:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 1 then return RETURNVALUE_NOERROR elseif target:getStorageValue(STORAGEVALUE_WAR_GREENPLAYER_BOOL) == 0 then self:sendCancelMessage("You cannot attack someone that is on your team.") return false end end end endTesta e fala se deu problema.
Muito obg , deu certo s2, me ajudou d+
28 minutos atrás, Starliks disse:Muito obg , deu certo s2, me ajudou d+
De nada, que bom que deu certo ?.