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

Kinglike npc

sebas182

New Member
Joined
Aug 10, 2008
Messages
121
Reaction score
1
Hello, I need a NPC that start to talk when you say "Hail the king".

I need at all is all the commands to make a npc manualy! I HATE THAT NPCHANDLER MODELS IT KILL MY RPG!


It really does the npc more fast and consuming less memory? I hate it .-.

Please help :3
 
Last edited:
Try this:

npcs/budvel.xml (just change the looktype, I believe this one is wrong):

Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="King Budvel" script="budvel.lua" walkinterval="1000" floorchange="0" speed="180">
    <health now="150" max="150"/>
    <look type="332" head="20" body="124" legs="124" feet="112" addons="3"/>
  <parameters>
    <parameter key="message_greet" value="Greetings, my loyal servant."/>
  </parameters>
</npc>

npcs/scripts/budvel.lua:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
npcHandler:setFocusKeywords("hail the king")
NpcSystem.parseParameters(npcHandler)

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

npcHandler:addModule(FocusModule:new())
 
Works perfectly, but, how to change the others things?
Like the message when the guy get away, the message when say bye, etc...

Ah, already rep ++
 
In npc's xml code, add this to the parameters:
Code:
  <parameter key="message_XXXX" value="Enter a message here."/>

[depends what you want to change], I believe these are some of the useable ones:
Code:
	MESSAGE_GREET 			= 1 -- When the player greets the npc.
	MESSAGE_FAREWELL 		= 2 -- When the player unGreets the npc.
	MESSAGE_BUY 			= 3 -- When the npc asks the player if he wants to buy something.
	MESSAGE_ONBUY 			= 4 -- When the player successfully buys something via talk.
	MESSAGE_BOUGHT			= 5 -- When the player bought something through the shop window.
	MESSAGE_SELL 			= 6 -- When the npc asks the player if he wants to sell something.
	MESSAGE_ONSELL 			= 7 -- When the player successfully sells something via talk.
	MESSAGE_SOLD			= 8 -- When the player sold something through the shop window.
	MESSAGE_MISSINGMONEY		= 9 -- When the player does not have enough money.
	MESSAGE_NEEDMONEY		= 10 -- Same as above, used for shop window.
	MESSAGE_MISSINGITEM		= 11 -- When the player is trying to sell an item he does not have.
	MESSAGE_NEEDITEM		= 12 -- Same as above, used for shop window.
	MESSAGE_NEEDSPACE 		= 13 -- When the player don't have any space to buy an item
	MESSAGE_NEEDMORESPACE		= 14 -- When the player has some space to buy an item, but not enough space
	MESSAGE_IDLETIMEOUT		= 15 -- When the player has been idle for longer then idleTime allows.
	MESSAGE_WALKAWAY		= 16 -- When the player walks out of the talkRadius of the npc.
	MESSAGE_DECLINE			= 17 -- When the player says no to something.
	MESSAGE_SENDTRADE		= 18 -- When the npc sends the trade window to the player
	MESSAGE_NOSHOP			= 19 -- When the npc's shop is requested but he doesn't have any
	MESSAGE_ONCLOSESHOP		= 20 -- When the player closes the npc's shop window
	MESSAGE_ALREADYFOCUSED		= 21 -- When the player already has the focus of this npc.
	MESSAGE_PLACEDINQUEUE		= 22 -- When the player has been placed in the costumer queue.
 
Back
Top