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

Suxex

Member
Joined
Aug 13, 2007
Messages
391
Reaction score
5
Location
Halland - Getinge
Hello!
Here is a example of what I need:

Player: Hello
NPC: hi player
Player: mission
NPC do you wanna start this mission?
Player: yes
NPC: Are you sure?
Player: yes

So, my problem is, how do I script so that you are able to say "yes" twice in a row?
Please help me! :)
Thanks in advance!
 
Use several different values for talkstate, increasing it every time the conversation progesses towards a different topic!
 
Heres an example. Im getting really frustrated.. Can't get it to work. The NPC doesnt respond to the second "yes".

Code:
       if msgcontains(msg, 'outfit')then
  		if getPlayerStorageValue(cid, 8601) == -1 then
    local msgs={
            "Oh, my winged tiara? Those are traditionally awarded after having completed a difficult task for our guild, only to female aspirants though. Male warriors will receive a hooded cloak.",
            }
      doNPCTalkALot(msgs,9020)
    Topic[talkUser] = 0
		else
		end

        elseif msgcontains(msg, 'task') then
  		if getPlayerStorageValue(cid, 8601) == -1 then
    local msgs1={
            "So you are saying that you would like to prove that you deserve to wear such a hooded cloak?",
            }
      doNPCTalkALot(msgs1,9021)
    Topic[talkUser] = 1
		else

	end
        elseif msgcontains(msg, 'yes') and Topic[talkUser] == 1 then
  		if getPlayerStorageValue(cid, 8601) == -1 then 
    local msgs2={
            "Alright, I will give you a chance. Pay close attention to what I'm going to tell you now. ...",
            "Recently, one of our members moved to Liberty Bay out of nowhere, talking about some strange cult. That is not the problem, but he took my favourite crossbow with him. ...",
            "Please find my crossbow. It has my name engraved on it and is very special to me. ...",
            "Secondly, we need a lot of leather for new quivers. 100 pieces of lizard leather and 100 pieces of red dragon leather should suffice. ...",
            "Third, since we are giving out tiaras, we are always in need of enchanted chicken wings. Please bring me 5, that would help us tremendously. ...",
            "Lastly, for our arrow heads we need a lot of steel. Best would be one piece of royal steel, one piece of draconian steel and one piece of hell steel. ...",
            "Did you understand everything I told you and are willing to handle this task?",
            }
      doNPCTalkALot(msgs2,9022)
			setPlayerStorageValue(cid,8601,1)
    Topic[talkUser] = 0
		else
		end
        elseif msgcontains(msg, "yes") and Topic[talkUser] == 1 then
  		if getPlayerStorageValue(cid, 8601) == 1 then 
    local msgs3={
            "Great!",
            } 
      doNPCTalkALot(msgs3,9023)
			setPlayerStorageValue(cid,8601,2)
    Topic[talkUser] = 0
		else
		end
 
Ok, I give you an example, just so you can figure it out :D
LUA:
        if(msgcontains(msg, 'task') or msgcontains(msg, 'outfit')) and getPlayerStorageValue(cid, 8601) == -1 then
        npcHandler:say('So you are saying that you would like to prove that you deserve to wear such a hooded cloak?', cid)
                               Topic[cid] = 1
        
        elseif msgcontains(msg, 'yes') and getPlayerStorageValue(cid, 8601) == -1 and Topic[cid] == 1 then
        doNpcTalkALot({"Alright, I will give you a chance. Pay close attention to what I'm going to tell you now. ...","Recently, one of our members moved to Liberty Bay out of nowhere, talking about some strange cult. That is not the problem, but he took my favourite crossbow with him. ...","Please find my crossbow. It has my name engraved on it and is very special to me. ...","Secondly, we need a lot of leather for new quivers. 100 pieces of lizard leather and 100 pieces of red dragon leather should suffice. ...","Third, since we are giving out tiaras, we are always in need of enchanted chicken wings. Please bring me 5, that would help us tremendously. ...","Lastly, for our arrow heads we need a lot of steel. Best would be one piece of royal steel, one piece of draconian steel and one piece of hell steel. ...","Did you understand everything I told you and are willing to handle this task?"}, 8000, cid)
			setPlayerStorageValue(cid,8601,1)
                                Topic[cid] = 2
	
        elseif msgcontains(msg, "yes") and Topic[cid] == 2 and getPlayerStorageValue(cid, 8601) == 1 then
	    npcHandler:say('Great!', cid)
			setPlayerStorageValue(cid,8601,2)
                                 Topic[cid] = 0
                                 return true
   end

Now, just make the elseifs for "no" and elseifs if you don't have the required storage ;)
 
Back
Top