• 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 Set a different greeting message if player level is higher than X.

Joined
Dec 7, 2016
Messages
22
Reaction score
6
As the title says, I want to set a different greeting message to an NPC depending on what level he/she is.

I'm finishing the dialogs of the npc Oressa and if the player level is lower than 8 she says:
Lua:
Welcome to the temple of Dawnport, child. If you need healing, I can help you. Ask me about a vocation if you need counsel.
If it is equal to or higher than 8 she says:
Lua:
Welcome, young adventurer. Tell me if you need help in choosing your vocation, or if you have decided on the vocation you want to choose.

Is it possible to achieve this on TFS 1.X+? If so, how?
 
Do you have the npc script?
Kinda hard to do anything without that.
 
Do you have the npc script?
Kinda hard to do anything without that.
Already solved my problem, someone on discord helped me out.

Here is the code should someone need it:
Lua:
local function greetCallback(cid)
    local player = Player(cid)
    if player:getLevel() >= 8 then
        npcHandler:setMessage(MESSAGE_GREET, "Welcome, young adventurer. Tell me if you need help in \z
                                                {choosing} your {vocation}, or if you have {decided} on the {vocation} you want to choose.")
    else
        npcHandler:setMessage(MESSAGE_GREET, "Welcome to the temple of Dawnport, child. \z
                                                If you need {healing}, I can help you. Ask me about a {vocation} if you need counsel.")
    end
    return true
end

npcHandler:setCallback(CALLBACK_GREET, greetCallback)

Thanks for taking some time to try to help me tho.
 
Back
Top