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

Joined
Jul 25, 2007
Messages
382
Reaction score
38
Alright, I've fiddled with this and I cannot understand why this doesn't work. No errors are given.

LUA:
	elseif msgcontains(msg, "offers") or msgcontains(msg, "job") then
		npcHandler:say("Well, if you've come for fine {handmade} arrows then you're at the right place.", cid)
		if msgcontains(msg, "handmade") then
			npcHandler:say("Back in the day I was an apprentice to the greatest craftsman of the {elven} kingdom.\n He carved the swiftest arrows and mightiest bows known to man and elf alike.", cid)

in-game
14:31 Tak: Akanar Black Reaper.
14:31 Black Reaper [1]: job
14:31 Tak: Well, if you've come for fine handmade arrows then you're at the right place.
14:31 Black Reaper [1]: handmade

The end's are correct etc.
 
Use elseif for it, too and don't try nesting them below each other, it won't work well.

In your example, player's message would have to contain "offers"/"job" AND "handmade" (in the SAME message), and then both replies would show up. Which doesn't sound right, does it?
 
Ah, alright, well I get it but I don't really understand why it works like that.
Thanks for the help again. :)

Edit: So I should do something like this?

elseif msgcontains(msg, "offers") or msgcontains(msg, "job") then
doPlayerSetStorageValue(cid, 1002, 1)
npcHandler:say("Well, if you've come for fine {handmade} arrows then you're at the right place.", cid)

elseif getPlayerStorageValue(cid, 1002) == 1 and msgcontains(msg, "handmade") then
blah blah
 
Last edited:
Ah, alright, well I get it but I don't really understand why it works like that.
Thanks for the help again. :)

Edit: So I should do something like this?

elseif msgcontains(msg, "offers") or msgcontains(msg, "job") then
doPlayerSetStorageValue(cid, 1002, 1)
npcHandler:say("Well, if you've come for fine {handmade} arrows then you're at the right place.", cid)

elseif getPlayerStorageValue(cid, 1002) == 1 and msgcontains(msg, "handmade") then
blah blah
more typing without elseif because you gotta 'end' and 'return true'
 
Back
Top