Difference between revisions of "LUA"
John Adams (talk | contribs) |
John Adams (talk | contribs) m (→Get Functions) |
||
| Line 44: | Line 44: | ||
| − | [[LUA:GetAgi | GetAgi(param)]] | + | [[LUA:GetAgi(param) | GetAgi(param)]] |
[[LUA:GetClass | GetClass]] | [[LUA:GetClass | GetClass]] | ||
| Line 99: | Line 99: | ||
[[LUA:HasMoved | HasMoved]] | [[LUA:HasMoved | HasMoved]] | ||
| − | |||
| − | |||
=== Set Functions === | === Set Functions === | ||
Revision as of 15:56, 1 April 2009
Contents
The LUA Scripting System
We have chosen LUA as our script engine for EQ2Emulator. Things like Quests, Spawn movement or interaction, Spells, and Zone-wide events are scripted in LUA using custom functions specific to the emulator core. Below you will find a list of current EQ2Emulator LUA Functions with links to what they do and examples of how to use them.
You will quickly see that the ease of the LUA Scripting language and it's tight integration with EQ2Emulator make our server extremely dynamic and customizable.
Currently, EQ2Emulator employs LUA scripting for the following systems:
ZoneScripts
Follow any of these links for a closer look at the system. Below is a general list of LUA functions we'll keep at this top-level for easier reference.
LUA Parameter Basics
EQ2Emulator LUA Functions normally have parameters - that is, some value required to be passed from the World to the Script or vice-versa. An example of this is the function hailed(NPC, Spawn). Note that there are 2 parameters for function hailed(). What the parameter names are is up to you, as long as there are the proper number of parameters in the () parens.
Example: Here, the NPC says Hello to the player.
function hailed(NPC, Spawn) Say(NPC, "Hello Player!") end
Example: Here, the Player says Hello to the NPC.
function hailed(NPC, Player) Say(Spawn, "Hello NPC!") end
Current standards we have adopted are to use NPC as the value for the NPCs parameters, and depending on the type of script, Spawn or Player for the Players parameters. Nearly all other parameter values are dynamic - that is, they can be any valid variable name you choose. But when coding scripts for the Official EQ2Emulator Project, be sure to follow our guidelines or your scripts will get rejected.
LUA Functions
Our LUA Functions list is broken into several categories for clarity of functionality. More functions are added often, so check back if you are looking for something that you need for your scripts.
Get Functions
This set of functions will GET info from the World or Database for use within any LUA script
Developer: LethalEncounter, Scatman
Set Functions
This set of functions will SET info in the World or Database from within any LUA script
Developer: LethalEncounter, Scatman
SetMount(Spawn, mount_mode_type (int))
Quest Functions
These functions are for use within Quest scripts, and are some of the more complex LUA Functions in the EQ2Emulator.
Developer: LethalEncounter, Scatman
UpdateQuestTaskGroupDescription
Spell Functions
These functions are used within Spell scripts to generate the expected effect of casting spells or using abilities.
Developer: LethalEncounter
SPECIAL NOTE ABOUT SPELL FUNCTIONS:
Many spells simply alter an existing stat of one kind or another to yourself or a target, so there are not very many "spell functions" to speak of. SpellDamage is one of the few, since buffing, debuffing, or slowing (etc) a target are done through the SET Functions inside a Spell Script.
Spawn Functions
These are functions that normally go into SpawnScripts for interacting with NPCs or other types of Spawns.
Developer: LethalEncounter, Scatman
MovementLoopAddLocation(Spawn, x, y, z, speed, delay, function)
General Functions
These are general functions that are either to set/retrieve player or target data, or get references to nearby objects.
Developer: LethalEncounter, Scatman
Conclusion
LUA functions are added often, usually when we discover some new way that SOE does their spawns, quests or other content. If you find you are unable to achieve your goal in your scripting, it is possible you need a LUA function added. You can either choose to develop your own LUA function and submit it to the core Devs for inclusion, or post your requirements in the Feature Request forum for a script dev to add to the server.