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

setStorage on Creature?

Solution
Inside the check, do I hedge to global storage? Where x is the monster id and value I want?

example
if x[monsterId] ...
Game.setStorageValue(x,10)

x is what you call the table, monsterId is the name of the value, 10 is the value.

Lua:
x = {}
x[monsterId] = 10
if x[monster:getId()] == 10 then
     print("true")
end

Game.setStorageValue(x[monster:getId()], 10)
You can't use Monster:setStorageValue() so you would have to use a global variable (ex Game.setStorageValue(x, value))
Create a table with the monster names (if you want it to be for all monsters) with a value or use the monsters unique id:

Lua:
x = {
    [1] = 1000, -- demon
}

local monsterId = monster:getId()
x[monsterId] = value


if x[monsterId] == value then
    ...
end
 
You can't use Monster:setStorageValue() so you would have to use a global variable (ex Game.setStorageValue(x, value))
Create a table with the monster names (if you want it to be for all monsters) with a value or use the monsters unique id:

Lua:
x = {
    [1] = 1000, -- demon
}

local monsterId = monster:getId()
x[monsterId] = value


if x[monsterId] == value then
    ...
end

Inside the check, do I hedge to global storage? Where x is the monster id and value I want?

example
if x[monsterId] ...
Game.setStorageValue(x,10)
 
Inside the check, do I hedge to global storage? Where x is the monster id and value I want?

example
if x[monsterId] ...
Game.setStorageValue(x,10)

x is what you call the table, monsterId is the name of the value, 10 is the value.

Lua:
x = {}
x[monsterId] = 10
if x[monster:getId()] == 10 then
     print("true")
end

Game.setStorageValue(x[monster:getId()], 10)
 
Solution
I don't understand why you set that global storage.

Anyway I just want to warn you that this can create an enormous table and take up unnecessary memory if used on too many monsters. I don't know what you're doing with it but you should have a way to clear it. Atm it will 8nly be cleared by reloading script type or restarting server. You might wanna add some timer running each minute or so depending on need to clear any old ids.
 
Back
Top