• 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 Npc let you choose an item

Zazeros

Member
Joined
Feb 13, 2012
Messages
67
Reaction score
17
0.4

Hello guys, I was trying to do by my own but I don't even have a clue how to do it, and if it is possible

In a task, like: kill 50 monsters, the npc will give an reward (exp and item).
What I want to know is if there is a way to make the player choose an reward, like this:
The npc gives the task, player kills 50 monsters and return to npc, then, (in my head) pops a window showing to the player two choices of itens, like: you prefer this sword, atk x, def y or this boots, speed z. Something like that.

I dont know if this is possible, and if it not, what could I do to be more or less like this, this choice for a reward
 
Solution
0.4

Hello guys, I was trying to do by my own but I don't even have a clue how to do it, and if it is possible

In a task, like: kill 50 monsters, the npc will give an reward (exp and item).
What I want to know is if there is a way to make the player choose an reward, like this:
The npc gives the task, player kills 50 monsters and return to npc, then, (in my head) pops a window showing to the player two choices of itens, like: you prefer this sword, atk x, def y or this boots, speed z. Something like that.

I dont know if this is possible, and if it not, what could I do to be more or less like this, this choice for a reward
Can do it with only text on 0.4

-- psuedo code from memory.. cuz I'm not home right now to grab an npc...
0.4

Hello guys, I was trying to do by my own but I don't even have a clue how to do it, and if it is possible

In a task, like: kill 50 monsters, the npc will give an reward (exp and item).
What I want to know is if there is a way to make the player choose an reward, like this:
The npc gives the task, player kills 50 monsters and return to npc, then, (in my head) pops a window showing to the player two choices of itens, like: you prefer this sword, atk x, def y or this boots, speed z. Something like that.

I dont know if this is possible, and if it not, what could I do to be more or less like this, this choice for a reward
Can do it with only text on 0.4

-- psuedo code from memory.. cuz I'm not home right now to grab an npc file
Lua:
if talkstate[cid] == 0 and msgcontains(msg, "mission") then
    selfSay(npc, "I see you've finished your mission. Would you like sword (atk:47 def:24) or boots (arm: 4 speed: 20) for your reward?")
    talkstate[cid] = 1

elseif talkstate[cid] == 1 then
    if msgcontain(msg, "sword") then
        -- sword stuff
    elseif msgcontain(msg, "boots") then
        -- boot stuff
    else
        -- ask again? cancel? randomise?
    end
    talkstate[cid] =  0

end
 
Solution
Back
Top