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

doItemSetAttribute

ConAn Edujawa

Member
Joined
Feb 23, 2015
Messages
457
Reaction score
17
hello guys i try to make this add manaticks to items don't have manaticks use this code but don't work its add +2000 to all items
Lua:
    local temp = getItemAttribute(itemEx.uid, "manaticks")
if temp < 1000 then
doItemSetAttribute(itemEx.uid, "manaticks",2000)
end

if items have 2 sec manaticks will be 4 i want it work with items manaticks < 1000 or 0
0.4
 
Last edited:
add a print, and find out what the issue is.

print(temp)
if used on items with 2000 manatick or items 0 manaticks got 0 in consol

edite
i was use local temp = getItemAttribute(itemEx.uid, "manaticks") or 0
when removed or 0 got this error
Lua:
[13:49:48.469] [Error - Action Interface]
[13:49:48.469] data/actions/scripts/manatick.lua:onUse
[13:49:48.469] Description:
[13:49:48.469] data/actions/scripts/manatick.lua:12: attempt to compare nil with number
line 12 is if temp < 1000 then
 
Last edited:
if used on items with 2000 manatick or items 0 manaticks got 0 in consol

edite
i was use local temp = getItemAttribute(itemEx.uid, "manaticks") or 0
when removed or 0 got this error
Lua:
[13:49:48.469] [Error - Action Interface]
[13:49:48.469] data/actions/scripts/manatick.lua:onUse
[13:49:48.469] Description:
[13:49:48.469] data/actions/scripts/manatick.lua:12: attempt to compare nil with number
line 12 is if temp < 1000 then

a) item has no attribute manaticks
b) item can't be found.

since return value of getItemAttribute(...) is nil you are left with temp = nil
when tfs tries to execute if nil < 1000 you get that error.

Are you ever setting manaticks attribute anywhere?

EDIT:
you could do the following:

Lua:
if not temp or temp < 1000 then
      doItemSetAttribute(itemEx.uid, "manaticks",2000)
      return true
end

EDIT 2:
I don't think I understand what you want to do, reading original post;
Code:
hello guys i try to make this add manaticks to items don't have manaticks use this code but don't work its add +2000 to all items
...
if items have 2 sec manaticks will be 4 i want it work with items manaticks < 1000 or 0
 
a) item has no attribute manaticks
b) item can't be found.

since return value of getItemAttribute(...) is nil you are left with temp = nil
when tfs tries to execute if nil < 1000 you get that error.

Are you ever setting manaticks attribute anywhere?

EDIT:
you could do the following:

Lua:
if not temp or temp < 1000 then
      doItemSetAttribute(itemEx.uid, "manaticks",2000)
      return true
end

EDIT 2:
I don't think I understand what you want to do, reading original post;
Code:
hello guys i try to make this add manaticks to items don't have manaticks use this code but don't work its add +2000 to all items
...
if items have 2 sec manaticks will be 4 i want it work with items manaticks < 1000 or 0
i use this mod
i try to make if items have manaticks don't add manaticks and if items don't have manatick add manaticks
 
Back
Top