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

[Request] EASY NPC!! REP++

Synergy

New Member
Joined
Nov 24, 2011
Messages
334
Reaction score
0
Hello!

Im requesting a really easy npc for you scripters!!

---


PLAYER: Hi
NPC: Hello, blablablablablablabla, {cave}
PLAYER: cave
NPC: Oh so you wanna know about the cave blablablabla
PLAYER: yes
NPC: blablablabla, end of story



SO ITS SIMPLY JUST A SHORT STORY NPC!

Rep++ and a big thanks.
 
Hello!

Im requesting a really easy npc for you scripters!!

---


PLAYER: Hi
NPC: Hello, blablablablablablabla, {cave}
PLAYER: cave
NPC: Oh so you wanna know about the cave blablablabla
PLAYER: yes
NPC: blablablabla, end of story



SO ITS SIMPLY JUST A SHORT STORY NPC!

Rep++ and a big thanks.
WHAT ?!!!!!!!!!Explain more ... !
 
Npc.xml
XML:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Name" script="npc.lua" walkinterval="2000" floorchange="0">
	<health now="100" max="100"/>
	<look type="130" head="114" body="114" legs="114" feet="114" addons="0"/>
	<parameters>
		<parameter key="message_greet" value="Hello, blablablablablablabla, {cave}."/>
	</parameters>
</npc>

npc.lua
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(not npcHandler:isFocused(cid)) then
		return false
	end

	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

	if(msgcontains(msg, 'cave')) then
		selfSay('Oh so you wanna know about the cave blablablabla?', cid)
		talkState[talkUser] = 1
	elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
                selfSay('blablablabla, end of story', cid)
	end
	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top