• 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 NPC Local Voices

trustjah

Newbie
Joined
Jan 22, 2009
Messages
124
Solutions
6
Reaction score
14
Location
Belgium
anyone knows how i can make npc's say different things? at the moment he is only repeating the last line;

Code:
local voices = { {text = 'Come in, young mages! Purchase the latest in runes and wands!'} }
local voices = { {text = 'Perhaps I need to bake them hotter? Or was it longer?'} }
local voices = { {text = 'Offering all sorts of magic equipment!'} }
local voices = { {text = 'Now where did Alaistar put the wood for the new wands?'} }
local voices = { {text = 'Hmmm.. Maybe those crushed gems caused the strange side effect?'} }
local voices = { {text = 'Wands and rods, the true magicians weapons of choice!'} } 
npcHandler:addModule(VoiceModule:new(voices))

would love if the npc would randomise these sentences
 
Solution
because you're reassigning the variable
you cant expect to assign multiple values to 1 variable unless it's an array
Lua:
local voices = {
    'Come in, young mages! Purchase the latest in runes and wands!',
    'Perhaps I need to bake them hotter? Or was it longer?',
    'Offering all sorts of magic equipment!',
    'Now where did Alaistar put the wood for the new wands?',
    'Hmmm.. Maybe those crushed gems caused the strange side effect?',
    'Wands and rods, the true magicians weapons of choice!'
}
im not sure how voicemodule works but thats what it should look like
you may still need the {text = string}
if so just edit each line like that
because you're reassigning the variable
you cant expect to assign multiple values to 1 variable unless it's an array
Lua:
local voices = {
    'Come in, young mages! Purchase the latest in runes and wands!',
    'Perhaps I need to bake them hotter? Or was it longer?',
    'Offering all sorts of magic equipment!',
    'Now where did Alaistar put the wood for the new wands?',
    'Hmmm.. Maybe those crushed gems caused the strange side effect?',
    'Wands and rods, the true magicians weapons of choice!'
}
im not sure how voicemodule works but thats what it should look like
you may still need the {text = string}
if so just edit each line like that
 
Solution
Code:
local voices = {
{ text = 'Come in, young mages! Purchase the latest in runes and wands!'},
{ text = 'Perhaps I need to bake them hotter? Or was it longer?'},
{ text = 'Offering all sorts of magic equipment!'},
{ text = 'Now where did Alaistar put the wood for the new wands?'},
{ text = 'Hmmm.. Maybe those crushed gems caused the strange side effect?'},
{ text = 'Wands and rods, the true magicians weapons of choice!'}
}

npcHandler:addModule(VoiceModule:new(voices))

works just fine.
 
How i can change interval for only one NPC? in lua and hov to change color of text there

I don't know anything about it and I don't have any material benefits from it because I only play with my own kids. If anyone was kind, I would be very pleased :)

In this way?

--------
local voices interval="5000"
local chance="10"
local voices = {
{ text = 'Come in, young mages! Purchase the latest in runes and wands!'},
{ text = 'Perhaps I need to bake them hotter? Or was it longer?'},
{ text = 'Offering all sorts of magic equipment!'},
{ text = 'Now where did Alaistar put the wood for the new wands?'},
{ text = 'Hmmm.. Maybe those crushed gems caused the strange side effect?'},
{ text = 'Wands and rods, the true magicians weapons of choice!'}
}

npcHandler:addModule(VoiceModule:new(voices))
--------
 
Last edited:
Back
Top