Admins:Content
- Last edited 13 years ago by I need to Update My Profile
Contents
About
WIP - This guide should help you get started but needs expanding on
Setting a Single Start Zone
Should you decide to you can override where players start. See Database:Starting.
Creating Spawns
Spawns can be set up easily in game which makes testing and setting positional parameters alot easier. First you need to Create the Spawn then Add it (save).
Some settings for spawns need to be done in the database, you may want to read Database:Spawns for more information. (For example info regarding merchants and vendors).
Create
To create the spawn use the simple and easy to use /spawn create command.
Add (Save)
To save the spawn so it loads everytime use the /spawn add command.
Once the spawn is added, be sure to reload all spawn points with /reload spawns
You can /spawn ID at several locations and then then /Spawn add it at each spot. Allowing you to change 1 spawn in the database which will be updated at many locations.
Move
Highlight a spawn and type /spawn move to adjust it. Wheel up and Wheel down turns the spawn.
Useful spawning commands
Assign a LUA Script
To do anything like pathing or dialogue you will need a lua script attached to your NPC. Once you done your /spawn create and /spawn add you can set the NPC's lua script in the database.
Do it via a command (recommended)
- /spawn set spawn_script 'SpawnScripts/example.lua'
Do it via the database
To do this, fire up your favourite SQL editor and run the query
SELECT id,name FROM spawns;
Find the NPC that matches the one you wish to assign a spawn_script to and make a note of it's ID for example 44.
Now with your ID and file run the following statement to create a spawn_script (changing the ID and lua_script path where appropriate):
INSERT INTO spawn_scripts (spawn_id,lua_script) VALUES (44,'SpawnScripts/myscript.lua');
Assuming you've done everything right the LUA_SCRIPT location will now be defined on the NPC.
Create the LUA file exactly as you defined it above (SpawnScripts/myscript.lua) and fill it with a sample script. For example:
function spawn(NPC) -- this is a comment end function hailed(NPC, Spawn) FaceTarget(NPC, Spawn) conversation = CreateConversation() StartConversation(conversation, NPC, Spawn, "Hey there " .. GetName(Spawn) .. ", how are ya doin' today?") end
Now /reload spawnscripts to reload all spawn scripts.
Finally /reload spawns to reload your NPCs (who will pick up on these new spawnscripts).
Your NPC should now respond to hails
- Note you can also run /luadebug start to help with debugging scripts.
Pathing
Pathing can be achieved using LUA scripts with the LUA function: LUA:MovementLoopAddLocation. This allows you to create a circular path for your NPC who will walk this route forever.
For example:
<pre> function spawn(NPC) --Syntax is NPC, x, y, z, speed, delay (in seconds) MovementLoopAddLocation(NPC, -233.71, -1.32,-78.60,1,0) MovementLoopAddLocation(NPC, -199.22, -1.30,-65.10,1,0) end </pre>
Loot
Loot can currently be set via the database tables loottable and lootdrop
See Database:Spawns for more information
Dialogue
See the LUA Function reference for dialogue and chat functions. In particular /say and StartConversation
function spawn(NPC) -- this is a comment end function hailed(NPC, Spawn) FaceTarget(NPC, Spawn) Say(conversation, NPC, Spawn, "Howdy!") end
Voice Dialogue
Voice dialogue can be achieved through different LUA Functions. PlayFlavor is probably the most recommended one (due to encryption on some files)
function spawn(NPC) -- this is a comment end function hailed(NPC, Spawn) FaceTarget(NPC, Spawn) PlayFlavor(NPC, "voiceover/english/voice_emotes/greetings/greetings_1_1002.mp3", "", "", 0, 0, Spawn) Say(conversation, NPC, Spawn, "Hail!") end
Factions
Please see this post by LethalEncounter regarding factions
Quests
See the LUA Function reference. Also check out the sample quests with the EQ2Emulator server pack. As well as Writing your first quest
Creating Items
Items can be configured via the Items table and it's children. See Database:Items for more information.
Sample Item (backpack)
- Load up your favourite sql editor and connect to your world database
- Create the item with a SQL statement
<pre> insert into items (name, item_type,icon,weight,description,sell_price,lua_script) values ('Basic Backpack','Bag', 10,5,'A 4 slot bag with 5 perc reduction',10,); </pre>
- then find the ID for the one you just inserted
<pre> select id,name from items where name like '%Basic Backpack%'; </pre>
- We'll say it was ID 1 for this example, then insert it's bag details into the item_defails_bag table
<pre> insert into item_details_bag (item_id,num_slots,weight_reduction) values (1,4,5); </pre>
- Now reload your items in game /reload items
- Search for it with /item
There's lots of other tables for different types of items, look at item_details_weapon etc
Setting up Merchants
Merchants can currently be set via the database tables merchants and merchants_inventory
You will also be required to set an entity object command to the NPC
See Database:Spawns for more information
Setting up Bankers
Bankers can be set via entity object commands on the spawn
See Database:Spawns for more information