• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

(LuaInterface::luaGetThingPosition) Thing not found help-me

danielkz

New Member
Joined
Mar 16, 2020
Messages
2
Reaction score
0
please could someone help me with this script tou with this error use The OTX server version: (2.12)


Code:
local t = {
storage = 689678,  -- storage, so mude se tiver usando pra outra coisa.
tempo = 300 --
}
local config = {
pos = {x=getCreaturePos(cid), y=getCreaturePos(cid), z=getCreaturePos(cid)}, -- posição da aegis dimension
tempo = 1, -- tempo pra voltar
effect1 = 30, -- efeito ao morrer
effect2 = 30, -- efeito ao retornar a vida
storage = 19332
}

---local vocs = 111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,475}
local vocs = {111-126,475}


function onStatsChange(cid, attacker, type, combat, value)
if(not(isInArray(vocs, getPlayerVocation(cid)))) then
end
if getPlayerStorageValue(cid, t.storage) < os.time() then
if type == STATSCHANGE_HEALTHLOSS and value >= getCreatureHealth(cid) then
setPlayerStorageValue(cid, t.storage, os.time() + t.tempo)
doCreatureSay(cid, "REVIVE!", 19)
--if getPlayerStorageValue(cid, config.storage) > 0 then
--if getPlayerVocation(cid) == vocs then

--doPlayerSetStorageValue(cid, config.storage, (getPlayerStorageValue(cid, config.storage)-1))
addEvent(doTeleportThing, 1000*config.tempo, cid, getThingPos(cid), true)
addEvent(doSendMagicEffect, 1000*config.tempo, getThingPos(cid), config.effect2)
doSendMagicEffect(getThingPos(cid), config.effect1)
--doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
--doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
doCreatureAddHealth(cid, (35*getCreatureMaxHealth(cid))/100)
doCreatureAddMana(cid, (35*getCreatureMaxMana(cid))/100)
doTeleportThing(cid, config.pos)
if isCreature(attacker) then
doPlayerSendTextMessage(cid, 27, "Passiva Ativada - Recarga 300 Segundos")
end
if isPlayer(attacker) and isCreature(cid) then
--doPlayerSendTextMessage(attacker, 27, "You killed ".. getCreatureName(cid) .."!")
end
for i = 1,config.tempo  do
addEvent(function()
if isCreature(cid) then
doPlayerSendTextMessage(cid,25,"You'll be back in " .. config.tempo -i +1 .. " second(s)")
end
end, 1000*i)
end


return false
end
end
return true
end
 
Last edited by a moderator:
Solution
Lua:
local t = {
  storage = 689678,  -- storage, so mude se tiver usando pra outra coisa.
  tempo = 300 --
}
local config = {
  pos = {x=getCreaturePos(cid), y=getCreaturePos(cid), z=getCreaturePos(cid)}, -- posição da aegis dimension
  tempo = 1, -- tempo pra voltar
  effect1 = 30, -- efeito ao morrer
  effect2 = 30, -- efeito ao retornar a vida
  storage = 19332
}

---local vocs = 111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,475}
local vocs = {111-126,475}


function onStatsChange(cid, attacker, type, combat, value)
  if(not(isInArray(vocs, getPlayerVocation(cid)))) then
  end
  if getPlayerStorageValue(cid, t.storage) < os.time() then
    if type == STATSCHANGE_HEALTHLOSS and value >= getCreatureHealth(cid) then...
Lua:
local t = {
  storage = 689678,  -- storage, so mude se tiver usando pra outra coisa.
  tempo = 300 --
}
local config = {
  pos = {x=getCreaturePos(cid), y=getCreaturePos(cid), z=getCreaturePos(cid)}, -- posição da aegis dimension
  tempo = 1, -- tempo pra voltar
  effect1 = 30, -- efeito ao morrer
  effect2 = 30, -- efeito ao retornar a vida
  storage = 19332
}

---local vocs = 111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,475}
local vocs = {111-126,475}


function onStatsChange(cid, attacker, type, combat, value)
  if(not(isInArray(vocs, getPlayerVocation(cid)))) then
  end
  if getPlayerStorageValue(cid, t.storage) < os.time() then
    if type == STATSCHANGE_HEALTHLOSS and value >= getCreatureHealth(cid) then
      setPlayerStorageValue(cid, t.storage, os.time() + t.tempo)
      doCreatureSay(cid, "REVIVE!", 19)
      --if getPlayerStorageValue(cid, config.storage) > 0 then
      --if getPlayerVocation(cid) == vocs then

      --doPlayerSetStorageValue(cid, config.storage, (getPlayerStorageValue(cid, config.storage)-1))
      addEvent(doTeleportThing, 1000*config.tempo, cid, getThingPos(cid), true)
      addEvent(doSendMagicEffect, 1000*config.tempo, getThingPos(cid), config.effect2)
      doSendMagicEffect(getThingPos(cid), config.effect1)
      --doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
      --doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
      doCreatureAddHealth(cid, (35*getCreatureMaxHealth(cid))/100)
      doCreatureAddMana(cid, (35*getCreatureMaxMana(cid))/100)
      doTeleportThing(cid, config.pos)
      if isCreature(attacker) then
        doPlayerSendTextMessage(cid, 27, "Passiva Ativada - Recarga 300 Segundos")
      end
      if isPlayer(attacker) and isCreature(cid) then
        --doPlayerSendTextMessage(attacker, 27, "You killed ".. getCreatureName(cid) .."!")
      end
      for i = 1,config.tempo  do
        addEvent(function()
        if isCreature(cid) then
          doPlayerSendTextMessage(cid,25,"You'll be back in " .. config.tempo -i +1 .. " second(s)")
        end
        end, 1000*i)
      end


      return false
    end
  end
  return true
end


I see that you probably posted this as plain text and a mod was kind enough to code block it. But still not readable. Here is pretty printed and syntax highlighted for anyone who wants to actually read it.
Post automatically merged:

Lua:
local config = {
  pos = {x=getCreaturePos(cid), y=getCreaturePos(cid), z=getCreaturePos(cid)}, -- posição da aegis dimension
  tempo = 1, -- tempo pra voltar
  effect1 = 30, -- efeito ao morrer
  effect2 = 30, -- efeito ao retornar a vida
  storage = 19332
}

This is already a problem because cid is not defined here. On top of that, getCreaturePos(cid) is always going to give it the same result, and yet you're assigning it to three different variables. Simply put: even if that function worked here x y and z would be identical. That's clearly wrong.

I don't have time to look further right now, but this script is really really broken.
 
Last edited:
Solution
Back
Top