I have a lot o sailors on docks and them all say always the same.
I want to make a script with random speechs when someone say hi, I may put a lot of speechs on this script so I could have a small database of speechs to all sailors in question, it doesn't matter if they repeat speechs sometimes.
Does it need to be a script or can it be done using the paramenter on .xml of the NPC in question?
I'm using "9.31 - The Forgotten Server - Version 0.2.11.2 (Mystic Spirit) - R4"
Here is how I set up the NPC.xml file:
Atcual script file (it has some keywords but theyre all aritifical, but even funny, if it could be done in a way that I could keep keywords, plus add the random speechs to hi/bye it would be way better!)
I would really appreciate any help =)
I want to make a script with random speechs when someone say hi, I may put a lot of speechs on this script so I could have a small database of speechs to all sailors in question, it doesn't matter if they repeat speechs sometimes.
Does it need to be a script or can it be done using the paramenter on .xml of the NPC in question?
I'm using "9.31 - The Forgotten Server - Version 0.2.11.2 (Mystic Spirit) - R4"
Here is how I set up the NPC.xml file:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Sailor" script="data/npc/scripts/sailor.lua" walkinterval="200" floorchange="0">
<health now="100" max="100"/>
<look type="93" head="114" body="0" legs="0" feet="0" addons="0"/>
<parameters>
<parameter key="message_greet" value="Ya!! Hello |PLAYERNAME|!!" />
<parameter key="message_farewell" value="Nice travels |PLAYERNAME|!!" />
</parameters>
</npc>
Atcual script file (it has some keywords but theyre all aritifical, but even funny, if it could be done in a way that I could keep keywords, plus add the random speechs to hi/bye it would be way better!)
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
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
-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
keywordHandler:addKeyword({'sea'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I love the sea...'})
keywordHandler:addKeyword({'what?'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ehh?!'})
keywordHandler:addKeyword({'trade'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Yo ho ho one more bottle of rom!!'})
keywordHandler:addKeyword({'jack'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Are you asking me about the Captain Jack Sparrow?'})
keywordHandler:addKeyword({'quest'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Oh yes! The treasure chest... Captain only, knows the right place...'})
keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ya!! Nice day to travel!!'})
keywordHandler:addKeyword({'boat'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you have seen the Black Pearl? She is the best ship ever!!'})
keywordHandler:addKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'HA! Jack is the best pirate from all seas!!'})
npcHandler:addModule(FocusModule:new())
I would really appreciate any help =)
Last edited: