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

Lua 2 problems: Quest & NPC

Nerglexo

N E X O
Joined
Dec 31, 2009
Messages
1,120
Reaction score
218
Location
Sweden
I've 2 problems with the server I'm making, it's 10.76 (TFS 1.x)

1. How do I do a quest?
Since when I tried you can open the "chest" and see all the items, it doesn't be like "You have found a knight armor."
2. NPC problem, how do I do so the NPC can respond/understand 2 different words?
Like this,
NPC: Are you interested in promotion?
Then I want so I can answer both "yes and promotion" - Because right now I can only say "promotion" to get it.

Any ideas?
 
Hint:
Code:
if msgcontains(msg, "yes") or msgcontains(msg, "yes!!") then
    -- do something
elseif msgcontains(msg, "no") or msgcontains(msg, "nooooo!!") then
    -- do something else instead
end

Code:
if msgcontains(msg, "yes") and msgcontains(msg, "promotion") then
    -- do something
end

I'll give you an example of the logical operators
Code:
Using the and operator both operands must be true in order for the condition to return true
and
true and true = true
true and false = false
false and false = false

Using the or operator either operand can be true in order for the condition to return true
or
true or true = true
true or false = true
false or false = false

The not operator just returns the opposite of the return value true becomes false and false becomes true
not
not true = false
not false = true

Happy coding :)
 
Last edited by a moderator:
I've 2 problems with the server I'm making, it's 10.76 (TFS 1.x)

1. How do I do a quest?
Since when I tried you can open the "chest" and see all the items, it doesn't be like "You have found a knight armor."
2. NPC problem, how do I do so the NPC can respond/understand 2 different words?
Like this,
NPC: Are you interested in promotion?
Then I want so I can answer both "yes and promotion" - Because right now I can only say "promotion" to get it.

Any ideas?
First 2 lines of actions.xml:
https://github.com/otland/forgottenserver/blob/master/data/actions/actions.xml
Defines that quest chests are only chests with IDs: 1740, 1747, 1748, 1749

and this script:
https://github.com/otland/forgottenserver/blob/master/data/actions/scripts/quests/quests.lua
defines that quest box must have Unique ID between 1001 and 22700

AND THEN IT IS FUCKED UP... :)
https://github.com/otland/forgottenserver/blob/master/data/actions/scripts/quests/quests.lua
I think that this line ( https://github.com/otland/forgottenserver/blob/master/data/actions/scripts/quests/quests.lua#L7 ):
PHP:
local itemType = ItemType(item.itemid)
should be:
PHP:
local itemType = ItemType(item.uid)

It also does not support 'advanced quest box' (that I made in 2008 and it was in every old TFS). It ignores items inside box. It only get UID of chest and give item with this UID as 'id of item'.

EDIT:
I made report here:
https://github.com/otland/forgottenserver/issues/1539
 
First 2 lines of actions.xml:
https://github.com/otland/forgottenserver/blob/master/data/actions/actions.xml
Defines that quest chests are only chests with IDs: 1740, 1747, 1748, 1749

and this script:
https://github.com/otland/forgottenserver/blob/master/data/actions/scripts/quests/quests.lua
defines that quest box must have Unique ID between 1001 and 22700

AND THEN IT IS FUCKED UP... :)
https://github.com/otland/forgottenserver/blob/master/data/actions/scripts/quests/quests.lua
I think that this line ( https://github.com/otland/forgottenserver/blob/master/data/actions/scripts/quests/quests.lua#L7 ):
PHP:
local itemType = ItemType(item.itemid)
should be:
PHP:
local itemType = ItemType(item.uid)

It also does not support 'advanced quest box' (that I made in 2008 and it was in every old TFS). It ignores items inside box. It only get UID of chest and give item with this UID as 'id of item'.

EDIT:
I made report here:
https://github.com/otland/forgottenserver/issues/1539
Thanks for the help, I made it work with the quests :)
 
Back
Top