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

Lua Modules for NPCs

Waz

Banned User
Joined
Aug 8, 2007
Messages
163
Reaction score
0
Hey, can someone give me a list of the modules for NPCs? Like mokerhammer posted the one for travel.

<parameters>
<parameter key="module_travel" value="1" />
<parameter key="travel_destinations"

Can someone give me a list of everything I can use as a parameter key? Also explain the 'value' intention.

I suck at NPCs x[
 
Do you mean the prequences of the NPC script? ...
<?xml version="1.0"?>

<npc name="NPC NAME" script="data/npc/scripts/NPC NAME.lua" access="3" floorchange="0" autowalk="30" speed="40">
<health now="1000" max="1000"/>
<look type="138" head="144" body="114" legs="10" feet="114" corpse="3128"/>
<parameters>
<parameter key="module_shop" value="1" />
<parameter key="message_greet" value="Hello, |PLAYERNAME|. Welcome to my post shop!" />
<parameter key="shop_buyable" value="parcel,2595,15;letter,2597,5;label,2599,2" />
</parameters>
</npc>

That's a XML base, and then over to lua, in the script folder...

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end
-- OTServ event handling functions end

keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I am the postman here.'})

npcHandler:addModule(FocusModule:new())
 
Rep++
Wow thanks! by the way, where can I get a list of all the "parameter key" stuff and the constants (like |PLAYERNAME|) I mean is there some kind of documentation out there about this npc system?

Thank you!

See you later!
 
Rep++
Wow thanks! by the way, where can I get a list of all the "parameter key" stuff and the constants (like |PLAYERNAME|) I mean is there some kind of documentation out there about this npc system?

Thank you!

See you later!

That was my question. :blink:
 
MESSAGE_GREET
MESSAGE_FAREWELL
MESSAGE_BUY
MESSAGE_SELL
MESSAGE_ONBUY <--After player bought something
MESSAGE_ONSELL <--After player sold something.
MESSAGE_NEEDMOREMONEY
MESSAGE_NOTHAVEITEM
MESSAGE_IDLETIMEOUT
MESSAGE_WALKAWAY
MESSAGE_ALREADYFOCUSED
MESSAGE_PLACEDINQUEUE
MESSAGE_DECLINE

|PLAYERNAME| <--Player Name
|ITEMNAME| <-- Name of the item.
|QUEUESIZE| <---It would display how many more people are infront of that player
|ITEMCOUNT| <--Number of items (5 apples)
|TOTALCOST| <--Total

shop_buyable value="item_keyword,item_id,price;"
shop_sellable value="item_keyword,item_id,price;"

To add these, it would be like this:

<parameter key="message_greet" value="Hello, |PLAYERNAME|. Welcome to my post shop!" />

Thats all the ones I know of, there might be more though.
You can mix and match the greetings and such with an LUA script (such as the advanced container script)
 
Thanks a lot too! we should make some sort of documentation, in order to make it easier to make new scritp, actually all we can do is copy paste and modify scripts...

See you later!
 
Back
Top