No categories assigned

ContentDesigner:Creating Conversations

Revision as of 00:08, 8 September 2015 by Cynnar (talk | contribs)

ContentDesigner:SpawnScripts - Creating Conversations

Return to: ContentDesigner:SpawnScripts | Tutorials | Portal | Forum | Project Manager | Bug Tracker


The Creating Conversations guide will be broken up into many different sections. The hope is to keep it from being overwhelming when learning to add different parts of conversations to your NPC.


Getting A NPC To Talk

A NPC is not much fun when you first create one. All they do is sand there motionless, and speechless. In order to solve that, a conversation dialog needs to be created. This guide will be using the spawn script of Verex N'Za in Darklight Wood. If you would like you can log on to the emulator and go through the dialog to see how it looks, and if you are a developer you can go to the web db editor under the Verex N'Za spawn section to find the full script. For those who have a local server this is located in worldserver\SpawnScripts\Darklight where you installed you server at. For this guide we want to build the dialog from scratch so we can get a better grasp on building spawn scripts.

First thing to do is create VerexNZa.lua file. If you are using the EQ2LuaEditor then one can be created by going to file->New->Spawn Script. If you are using a text editor like notepad++ then be sure when you save your file you put .lua at the end for the file extention. If you need a template to start off with you can get it at Spawn Script Template at the bottom of that page.

Fill Out The Comments Section

--[[
Script Name : SpawnScripts/DarklightWood/VerexNZa.lua
Script Purpose : Verex N'Za (340030)
Script Author : Cynnar
Script Date : 2015.07.01
Script Notes :
--]]

Above is an example of what your comments section should look like. These are most helpful when a spawn script needs to be edited at a later time.

Function Spawn

function spawn(NPC)
SetPlayerProximityFunction(NPC, 10, "InRange")
end

If you notice when you get close to Verex he will motion you over to him and will say something to you as he does. In order to do this it all starts in the spawn function. When a NPC is first created the function spawn is called, and as can be seen in the code above SetPlayerProximityFunction using parameters (NPC, 10, "InRange") will be executed. The SetPlayerProximityFunction allows us to have the NPC say or do something when a player gets within a certain range. We want Verex to call us over when we get close so we have to input those parameters in (NPC, 10, "InRange"). The first parameter is NPC and is used to refer to Verex, Next parameter is 10 and is how far away from Verex we want him to call us over. Last parameter is "InRange" and is a call to the function InRange.

Function InRange

function InRange(NPC, Spawn)
PlayFlavor(NPC, "", "You there, come here at once! We haven't a second to spare!", "beckon", 0, 0, Spawn)
end

The PlayFlavor function inside the function InRange is what we want Verex to do when a player gets within 10 m from him. The PlayFlavor function allows you play a voiceover, text, and an emote at the same time.

More Comming Soon...