• 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!

Creature Script problem

jareczekjsp

Member
Joined
Jan 30, 2023
Messages
188
Reaction score
9
GitHub
Jarek123
Hello I have in console error like that
[15:24:11] [Error - CreatureScript Interface]
[15:24:11] In a timer event called from:
[15:24:11] domodlib('Loot_func')
[15:24:11] function onDeath(cid, corpse, deathList)
[15:24:11] local killer,pos = deathList[1],getCreaturePosition(cid)
[15:24:11] addEvent(corpseRetireItems,1,killer,pos)
[15:24:11] return true
[15:24:11] end:eek:nDeath
[15:24:11] Description:
[15:24:11] (luaGetCreatureStorage) Creature not found


Somebody meybe know what is that?
Post automatically merged:

this is my script :


function onDeath(cid, corpse, deathList)
if not isPlayer(cid) then
return true
end

local killer = deathList[1]
local playerName = getCreatureName(cid)
local playerLevel = getPlayerLevel(cid)

if not isCreature(killer) then
doBroadcastMessage("The player " .. playerName .. " [Level: " .. playerLevel .. "] was killed by an unknown entity.", 20)
return true
end

local killerName = getCreatureName(killer)

if isPlayer(killer) then
doBroadcastMessage("The player " .. playerName .. " [Level: " .. playerLevel .. "] was killed by the player " .. killerName .. " [Level: " .. getPlayerLevel(killer) .. "]", 20)
elseif isMonster(killer) then
doBroadcastMessage("The player " .. playerName .. " [Level: " .. playerLevel .. "] was killed by the monster " .. killerName .. ".", 20)
end
return true
end
Post automatically merged:

tfs 0.4
 
@jareczekjsp Use the [ CODE ] blocks instead so the code is formatted with indentations.
The problem is that you posted different script, this one seems okay.

You created some timer event that executes corpseRetireItems function in which I guess you're performing getCreatureStorageValue/getPlayerStorageValue on player that's no longer there.

For delayed execution you need to be woried that creature with such cid might no longer be in-game.
Either store all needed things before execution of event (once creature is there) and just pass them as parameter, or protect the logic with simple isPlayer(cid) on your callback function. It all depends on the use case so there's no single correct answer.

Also on TFS 0.4 deathList may also contain names of killers.
 
Last edited:
Back
Top