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

Npc errors tfs 1.1

knighters god

Active Member
Joined
Feb 14, 2009
Messages
166
Solutions
1
Reaction score
40
I just decided to try tfs 1.1 for the first time and moved from tfs 0.3.6 and was thinking of someone could help me with some npc errors. I get the same errors on all the custom npcs I moved from 8.6 to my new 10.77 server. Even with Varkhal. These errors are on all the npcs that responds to keywords so if you could try to explain what I should change in the script I could try to fix the rest myself.
Npc Varkhal:
http://pastebin.com/stN9H7hy
33kzosk.jpg


A story npc that also gives a key with actionId 1100:
http://pastebin.com/4dd9p9ty
2usefba.jpg


Npc mission that gives storageId after items got collected:
http://pastebin.com/peYaKKbY
sqj9cg.jpg


I will love you if you help me.
 
the coding style and functions are quite different from older versions to 1.x. It will take a while to convert them all. You'd basically have to just find any errors and replace the function with a new one with the same purpose. Reference this: https://otland.net/threads/lua-functions-list-tfs-1-0-updated-17-09-2014.222023/

You can switch getItemNameById(id) for getItemName(itemid) as can be found in lib/compat/compat.lua
You can switch getItemInfo() for a couple things using metatables:
Code:
local itemType = ItemType(itemId)
itemType:getName()
itemType:getPluralName()
itemType:getArticle()
itemType:getDescription()
ItemType is a class, so you're casting the itemId of the item to an ItemType object and setting itemType to it, so you can call metamethods on it, like above. I imagine there's some tutorials around on how to use meta tables and methods
As for the janitor:
Code:
if msgcontains(msg, "hellven" and talkState[talkUser] == 3) then

end
this has to be
Code:
if msgcontains(msg, "hellven") and talkState[talkUser] == 3 then

end
or if it isn't being used, you can just remove it. Line 40.
 
the coding style and functions are quite different from older versions to 1.x. It will take a while to convert them all. You'd basically have to just find any errors and replace the function with a new one with the same purpose. Reference this: https://otland.net/threads/lua-functions-list-tfs-1-0-updated-17-09-2014.222023/

You can switch getItemNameById(id) for getItemName(itemid) as can be found in lib/compat/compat.lua
You can switch getItemInfo() for a couple things using metatables:
Code:
local itemType = ItemType(itemId)
itemType:getName()
itemType:getPluralName()
itemType:getArticle()
itemType:getDescription()
ItemType is a class, so you're casting the itemId of the item to an ItemType object and setting itemType to it, so you can call metamethods on it, like above. I imagine there's some tutorials around on how to use meta tables and methods
As for the janitor:
Code:
if msgcontains(msg, "hellven" and talkState[talkUser] == 3) then

end
this has to be
Code:
if msgcontains(msg, "hellven") and talkState[talkUser] == 3 then

end
or if it isn't being used, you can just remove it. Line 40.
I'll give it my best shot to fix the errors with all you gave me. Thank you!
 
Back
Top