Difference between revisions of "Admins:Content"

(Dialogue)
 
(15 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
 
== About ==
 
== About ==
  
Line 10: Line 11:
  
 
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).
 
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 ===
 
=== Create ===
Line 20: Line 23:
  
 
Once the spawn is added, be sure to reload all spawn points with [[Commands:reload_spawns | /reload spawns]]
 
Once the spawn is added, be sure to reload all spawn points with [[Commands:reload_spawns | /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 [[Commands:spawn_move | /spawn move]] to adjust it. Wheel up and Wheel down turns the spawn.
 +
 +
=== Useful spawning commands ===
 +
 +
* [[Commands:spawn_details | /spawn details]]
  
 
=== Assign a LUA Script ===
 
=== 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 [[Commands:spawn_create | /spawn create]] and [Commands:spawn_add | /spawn add]] you can set the NPC's lua script in the database.
+
To do anything like pathing or dialogue you will need a lua script attached to your NPC. Once you done your [[Commands:spawn_create | /spawn create]] and [[Commands:spawn_add | /spawn add]] you can set the NPC's lua script in the database.
 +
 
 +
==== Do it via a command (recommended) ====
 +
 
 +
* [[Commands:spawn_set | /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
 +
<pre>
 +
SELECT id,name FROM spawns;
 +
</pre>
 +
 
 +
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.
  
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):
  
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');'''
+
<pre>
 +
INSERT INTO spawn_scripts (spawn_id,lua_script) VALUES (44,'SpawnScripts/myscript.lua');
 +
</pre>
  
 
Assuming you've done everything right the LUA_SCRIPT location will now be defined on the NPC.  
 
Assuming you've done everything right the LUA_SCRIPT location will now be defined on the NPC.  
Line 37: Line 64:
 
   -- this is a comment
 
   -- this is a comment
 
end
 
end
 +
 
function hailed(NPC, Spawn)
 
function hailed(NPC, Spawn)
 
   FaceTarget(NPC, Spawn)
 
   FaceTarget(NPC, Spawn)
Line 44: Line 72:
 
</pre>
 
</pre>
  
Now [[Commands:reload_spawnscripts | /reload_spawnscripts]] to reload all spawn scripts.
+
Now [[Commands:reload_spawnscripts | /reload spawnscripts]] to reload all spawn scripts.
  
Finally [[Commands:reload_spawns | /reload_spawns]] to reload your NPCs (who will pick up on these new spawnscripts).
+
Finally [[Commands:reload_spawns | /reload spawns]] to reload your NPCs (who will pick up on these new spawnscripts).
  
 
Your NPC should now respond to hails
 
Your NPC should now respond to hails
  
* Note you can also run [[Commands:luadebug | /luadebug]] start to help with debugging scripts.
+
* Note you can also run [[Commands:luadebug | /luadebug start]] to help with debugging scripts.
  
 
=== Pathing ===
 
=== Pathing ===
  
Pathing can be achieved using LUA scripts with the LUA function: [[LUA:MovementLoopAddLocation]].
+
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:
 
For example:
  
<pre>
+
&lt;pre>
 
function spawn(NPC)
 
function spawn(NPC)
 
--Syntax is NPC, x, y, z, speed, delay (in seconds)
 
--Syntax is NPC, x, y, z, speed, delay (in seconds)
Line 64: Line 92:
 
MovementLoopAddLocation(NPC, -199.22, -1.30,-65.10,1,0)
 
MovementLoopAddLocation(NPC, -199.22, -1.30,-65.10,1,0)
 
end
 
end
</pre>
+
&lt;/pre>
  
 
=== Loot ===
 
=== Loot ===
Line 75: Line 103:
  
 
See the [[Developer:LUA_Functions | LUA Function reference]] for dialogue and chat functions. In particular [[LUA:Say | /say]] and [[LUA:StartConversation | StartConversation]]
 
See the [[Developer:LUA_Functions | LUA Function reference]] for dialogue and chat functions. In particular [[LUA:Say | /say]] and [[LUA:StartConversation | StartConversation]]
 +
 +
<pre>
 +
function spawn(NPC)
 +
  -- this is a comment
 +
end
 +
 +
function hailed(NPC, Spawn)
 +
  FaceTarget(NPC, Spawn)
 +
  Say(conversation, NPC, Spawn, "Howdy!")
 +
end
 +
</pre>
 +
 +
==== Voice Dialogue ====
 +
 +
Voice dialogue can be achieved through different LUA Functions. [[LUA:PlayFlavor | PlayFlavor]] is probably the most recommended one (due to encryption on some files)
 +
 +
<pre>
 +
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
 +
</pre>
 +
 +
=== Factions ===
 +
 +
Please see [http://www.eq2emulator.net/phpBB3/viewtopic.php?f=3&amp;t=804&amp;p=5730&amp;hilit=factions#p5730 this post] by LethalEncounter regarding factions
  
 
=== Quests ===
 
=== Quests ===
  
See the [[Developer:LUA_Functions | LUA Function reference]]. Also check out the sample quests with the EQ2Emulator server pack.
+
See the [[Developer:LUA_Functions | LUA Function reference]]. Also check out the sample quests with the EQ2Emulator server pack. As well as [[Admins:ContentQuest | Writing your first quest ]]
  
 
== Creating Items ==
 
== Creating Items ==
Line 89: Line 148:
  
 
* Create the item with a SQL statement  
 
* Create the item with a SQL statement  
<pre>
+
&lt;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,'');
 
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>
+
&lt;/pre>
  
 
* then find the ID for the one you just inserted
 
* then find the ID for the one you just inserted
  
<pre>
+
&lt;pre>
 
select id,name from items where name like '%Basic Backpack%';
 
select id,name from items where name like '%Basic Backpack%';
</pre>
+
&lt;/pre>
  
 
* We'll say it was ID 1 for this example, then insert it's bag details into the item_defails_bag table
 
* We'll say it was ID 1 for this example, then insert it's bag details into the item_defails_bag table
  
<pre>
+
&lt;pre>
 
insert into item_details_bag (item_id,num_slots,weight_reduction) values (1,4,5);
 
insert into item_details_bag (item_id,num_slots,weight_reduction) values (1,4,5);
</pre>
+
&lt;/pre>
  
 
* Now reload your items in game /reload items
 
* Now reload your items in game /reload items

Latest revision as of 20:51, 10 July 2012

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)

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

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