• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Npc - need

norrow

Member
Joined
Dec 16, 2012
Messages
129
Reaction score
7
Location
Poland
Hi, I need NPCs with whom dialogue looks like this
17:49 Tester [1]: hi
17:49 NPC: Hello Tester! and welcome in academy!
17:49 Tester [1]: exam
17:49 NPC: Do you want to pass an exam?
17:49 Tester [1]: yes
17:49 NPC: Ok! Show me Bunshin no Jutsu!

17:49 Tester [1]: bunshin no jutsu
17:49 NPC: What was that? Tester. You fail that easy exam!
Storage (8000)
Please help me
 
What should it do, only talk?
And after that a player can't get the answer "Do you want to pass an exam?" from the NPC again after saying exam?
 
so it has to be the same dialogue and has cid get the answer, I have a sample script how it should look like but without the later part of the dialogue, I can not add
LUA:
 local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
local talkState = {}
 
function onCreatureAppear(cid) 			npcHandler:onCreatureAppear(cid)		 end
function onCreatureDisappear(cid) 		npcHandler:onCreatureDisappear(cid)      end
function onCreatureSay(cid, type, msg) 	npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink()											 end
 
function creatureSayCallback(cid, type, msg)
	if msgcontains(msg, "exam") then
		if getPlayerStorageValue(cid, 8000) == -1 then
			npcHandler:say("Do you want to pass an exam?", cid) 
			setPlayerStorageValue(cid, 8000, 2) 
		elseif getPlayerStorageValue(cid, 8000) == 2 then
		end
 
Dunno if I got you correctly.

Npc part:

LUA:
function creatureSayCallback(cid, type, msg)
	if(msgcontains(msg, "exam")) then
		if(getPlayerStorageValue(cid, STORAGE_ID) < 1) then
			npcHandler:say("Do you want to pass an exam?", cid)
			talkState[talkUser] = 1
		elseif(getPlayerStorageValue(cid, STORAGE_ID) == 1) then
			npcHandler:say("You still didn't show me your jutsu.", cid)
		elseif(getPlayerStorageValue(cid, STORAGE_ID) == 2) then
			npcHandler:say("Great, you passed your exam.", cid)
			setPlayerStorageValue(cid, STORAGE_ID, 3)
			-- Reward or sth
		else
			npcHandler:say("You've already passed your exam.", cid)
		end
	elseif(msgcontains(msg, "yes")) then
		if(talkState[talkUser] == 1) then
			setPlayerStorageValue(cid, STORAGE_ID, 1)
			npcHandler:say("Ok! Show me Bunshin no Jutsu!", cid)
			talkState[talkUser] = 0
		end
	end
	return true
end

In jutsu spell:

LUA:
if(getPlayerStorageValue(cid, STORAGE_ID) == 1) then
	setPlayerStorageValue(cid, STORAGE_ID, 2)
end

of course change STORAGE_ID to whatever you want.
 
Back
Top