ESS - Easy Speech System
Introduction
Originally intended to allow you to add conversations between NPCs very easily, but eventually it's evolved to a lot more.
What does this do?
I've always felt setting up conversations and basically spicing up the world around you always has been a tedious and boring task. You were prone to errors with all the functions you had to register and you could easily forget about removing the events when the NPC dies. Therefore I've written this script which allows you to write a lively world by simply adding some lines without having to mess around with functions and registers. Keep your data in one spot, be able to quickly change a few things and thus stay in control, so you can focus on the more important parts of your server which require your attention.
Features
The foremost feature of this script is being able to send messages on a global interval or an interval per message in any chat type or chat language, in either a random or strict order.
Other features include, but may not be limited to:
- movement
- casting
- spawning NPCs
- spawning GOs
- playing an emote
- loading from ESS_data.txt (recommended) or ESS.lua
- checking your data for errors or inconsistencies (recommended)
- detailed error information
It is entirely possible to have all of them execute at one point or even skip the message at all. Spawning even allows you to spawn multiple objects at once.
Reloading ESS_data.txt during runtime may be possible, but it is always recommended to test your changes on a server off limits for public before you push it to your live realm.
Documentation
I suggest you have a look at some of the example scripts found in ESS_data.txt. However, here's a list of the how's and what's. Neccesary variables are really neccesary - without them the script will not work.
SETUP (found in ESS.lua)
COUNT: this one counts the number of loaded scripts.
CHECK_FOR_ERRORS: if enabled (recommended) checks for inconsistencies or errors which could cause your script not to work.
ERROR: used in displaying detailed error information
MAX_CHAT_LANGUAGE: a chat language cannot be higher than this number or lower than zero
MAX_CHAT_TYPE: a chat type cannot be higher than this number or lower than zero
LOAD_EXTERNAL_DATA: if set to true (recommended) loads data from the specified path
EXTERNAL_PATH: the path that is used to load from if loading external data is enabled
DATA (found in either ESS.lua or ESS_data.txt (recommended))
Format
Global variablesCode:ESS[entry] = -- entry is the entry of the NPC { global variables, messages = { {variables, variables}, -- every but the last one requires a comma at the end {variables, variables} } }
interval: this is a global interval which overrides the message specific intervals. This is defined in miliseconds; if defined a message is sent every this interval.
random (nessecary): if set to true the order in which the messages which will appear in a random order, if not they will appear as in the order they have been specified in.
times (global variable only!): the amount of times the function (and thus a message sent) is triggered. This variable only works if the global interval variable has been defined.
messages (neccesary): this defines the actions every interval. Without this variable the script will not work.
Messages variables
message: this can be left out if you don't want a message to be sent. This is a string and therefore needs to be in quotes; either "" or ''.
chatType (neccesary if a message is defined): the number of the type in which the message must appear
chatLanguage (neccesary if a message is defined): the number of the language in which the message must appear
interval (only works without a global interval defined): the time in miliseconds it takes for a message to appear
Extra message variables
castSpell
Defined as castSpell = {variables, variables}
id: id/entry of the spell to be cast
full (optional): defaults to false, determines whether the Full cast version of the function is used
x (optional, but neccesary if another coordinate is defined): x coordinate of the location where the spell is to be cast on
y (optional, but neccesary if another coordinate is defined): y coordinate of the location where the spell is to be cast on
z (optional, but neccesary if another coordinate is defined): z coordinate of the location where the spell is to be cast on
o (optional, but neccesary if another coordinate is defined): o coordinate of the location where the spell is to be cast on
emote
Defined as emote = {id = something, duration = something}
id (neccesary): the id of the emote to be executed.
duration (neccesary): the duration of the emote, can be zero.
moveTo
Defined as moveTo = {x = something, y = something, z = something, o = something}
x (neccesary): x coordinate of the location to move to
y (neccesary): y coordinate of the location to move to
z (neccesary): z coordinate of the location to move to
o (neccesary): o coordinate of the location to move to
spawnGO
Defined as spawnGO = {{GO1 variables}, {GO2 variables}} you can have as many GOs as you want (or just one)
entry (neccesary): entry of the gameobject to be spawned
x (neccesary): x coordinate of the spawning location
y (neccesary): y coordinate of the spawning location
z (neccesary): z coordinate of the spawning location
o (neccesary): o coordinate of the spawning location
duration (neccesary): length of the duration of the gameobject; if zero stays forever until a restart
scale (optional): defaults to 1 if not defined: scale of the object to be set to.
phase (optional): defaults to 1 if not defined: phase in which the object appears.
save (optional): defaults to false if not defined: set this to true if you want the object to save and thus last through a restart
spawnNPC
Defined as spawnNPC = {{NPC1 variables}, {NPC2 variables}} you can have as many NPCs as you want (or just one)
entry (neccesary): entry of the NPC to be spawned
x (neccesary): x coordinate of the spawning location
y (neccesary): y coordinate of the spawning location
z (neccesary): z coordinate of the spawning location
o (neccesary): o coordinate of the spawning location
faction (neccesary): faction of the NPC spawns with
equip1 (optional): defaults to 0; the entry of the weapon the NPC wields in the main-hand
equip2 (optional): defaults to 0; the entry of the weapon the NPC wields in the off-hand
equip3 (optional): defaults to 0; the entry of the weapon the NPC wields in the ranged slot
duration (neccesary): length of the duration of the NPC; if zero stays forever until a restart
phase (optional): defaults to 1 if not defined: phase in which the NPC appears.
save (optional): defaults to false if not defined: set this to true if you want the NPC to save and thus last through a restart
Example data
What I would like to do:
I want a human guard (entry id: 6 to yell three things in a random order in the normal language every 15 seconds.
Data
I would add this piece of code to ESS_data.txt.
What I would like to do:Code:ESS[68] = { interval = 15000, random = true, messages = { {message = "Hey, you! Halt!", chatType = 14, chatLanguage = 0}, {message = "Can I help you?", chatType = 14, chatLanguage = 0}, {message = "It's peanut butter yelly time!", chatType = 14, chatLanguage = 0} } }
I want a human guard to dance for 5 seconds whilst yelling "Sexy time!" after 10 seconds, then after 5 more seconds he would cast Frost Armour and after 1 more second say "It's chilly here, isn't it?".
Data
What I would like to do:Code:ESS[68] = { random = false, messages = { {message = "Sexy time!", chatType = 14, chatLanguage = 0, interval = 10000, emote = {id = 10, duration = 5000}}, {interval = 5000, castSpell = {id = 7301, full = true}}, {message = "It's chilly here, isn't it?", chatType = 12, chatLanguage = 0, interval = 1000} } }
I want a human guard to spawn 5 kittens after 2 seconds (first interval), then walk again the next interval. This should happen only once!
Data
Code:ESS[68] = { times = 1, random = false, interval = 2000, messages = { {spawnNPC = { {entry = 28665, x = 81, y = 90, z = 20, o = 5.9, faction = 35, duration = 5000, scale = 1.2, phase = 1, save = false}, {entry = 28665, x = 82, y = 90, z = 20, o = 5.9, faction = 35, duration = 5000, scale = 1.2, phase = 1, save = false}, {entry = 28665, x = 83, y = 90, z = 20, o = 5.9, faction = 35, duration = 5000, scale = 1.2, phase = 1, save = false}, {entry = 28665, x = 84, y = 90, z = 20, o = 5.9, faction = 35, duration = 5000, scale = 1.2, phase = 1, save = false}, {entry = 28665, x = 85, y = 90, z = 20, o = 5.9, faction = 35, duration = 5000, scale = 1.2, phase = 1, save = false} } }, {moveTo = {x = 50, y = 100, z = 20, o = 5.1}} } }
Installation instructions
Put both files in your scripts folder in your ArcEmu folder. ESS_data should be saved as a text (.txt) file. ESS should be saved as a Lua (.lua) file.
The scripts (ESS.lua and ESS_data.txt)
ESS.lua
ESS_data.txt
Questions
If you have any, I'd be glad to try answer them.
Suggestions
If you have any, I would love to hear them.
Bugs
Found a bug? Report it to me in either a PM or a reply in this thread and I'll attempt to squash it as soon as possible.