• 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 talk and door!

Amiroslo

Excellent OT User
Joined
Jul 28, 2009
Messages
6,812
Solutions
6
Reaction score
822
I have some questions!

1. How to make so the NPC talks only in NPC channel and not public.

2. How to make so when u open a locked door and enters it, it automaticly closes after u enter it!

Rep++
 
1. Make sure you're using the correct NPC system
2. It's in movements.xml, just add the door id for closingdoor.lua.
 
1.
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, 'hello') then
              if getCreatureStorage(cid, 17001) == 1 then
                    selfSay('Hmm... ??.')
                    doCreatureSetStorage(cid, 17001, 2)
              else
                    selfSay('o.o' .. getCreatureStorage(cid, 17001))
                    talk_state = 0
              end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

2.
LUA:
-- made by elf
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.uid == 10281 then
		if(isInArray({getPlayerStorageValue(cid,10274), getPlayerStorageValue(cid,10275), getPlayerStorageValue(cid,10276), getPlayerStorageValue(cid,10277), getPlayerStorageValue(cid,10278), getPlayerStorageValue(cid,10279), getPlayerStorageValue(cid,10280)}, -1) == TRUE) then
  			doPlayerSendTextMessage(cid, 22, "The door seems to be sealed against unwanted intruders.")
		else
			doPlayerSendTextMessage(cid, 22, ".")
			doTransformItem(item.uid, item.itemid + 1)
			doTeleportThing(cid, toPosition, TRUE)
		end
		return TRUE
	end
	return FALSE
end
 
Last edited:
the problem is here
LUA:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Max" script="data/npc/scripts/key.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
	<look type="133" head="20" body="39" legs="45" feet="7" addons="0"/>
<parameters>
<parameter key="message_greet" value="Welcome |PLAYERNAME| !, To enter you'll have to give me food for the {key}. I also have some tools if you need!" />
<parameter key="module_shop" value="1"/>
<parameter key="shop_buyable" value="fishing rod,2580,150;Mechanical Fishing Rod,10223,500;worm,3976,1"/>
</parameters>
</npc>
this is getting duplicated when he say it :S
I think that the prob is in the npc system
 
The npc, when he says

Welcome |PLAYERNAME| !, To enter you'll have to give me food for the {key}. I also have some tools if you need!

he says it twice
one in yellow (public) and one in blue (npc chat) and both comes over each other and it looks ugly!
how to make only one of em shows?
 
try this
LUA:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Max" script="data/npc/scripts/key.lua" walkinterval="2000" floorchange="0">
	<health now="100" max="100"/>
	<look type="133" head="20" body="39" legs="45" feet="7" addons="0"/>
	<parameters>
		<parameter key="module_shop" value="1"/>
		<parameter key="message_greet" value="Hello |PLAYERNAME|. To enter you'll have to give me food for the {key } I also have some tools if you need!"/>
		<parameter key="shop_buyable" value="fishing rod,2580,150;Mechanical Fishing Rod,10223,500;worm,3976,1"/>
	</parameters>
</npc>
 
Back
Top