Previous (2)Screenplay ReferenceNext (4)

Conversations provide the interaction with the player and the path that the player will take through the screenplay.

They could be simple things, like an option on a terminal, or they could take the player on a completely different experience through the screenplay.

In your bin/scripts/mobile/custom_content/conversations folder, create yourself a myscreenplay folder and within that create a myscreenplay_my_npc.lua file.

-- define the conversation template
-- note the myscreenplay_ prefix before the my_npc
-- this is in case there is a my_npc conversation declared elsewhere in the system

myscreenplay_my_npc = ConvoTemplate:new { initialScreen = "myscreenplay_my_npc_first_conv", templateType = "Lua", luaClassHandler = "myscreenplay_my_npc_convo_handler", screens = {} } -- first conversation
myscreenplay_my_npc_first_conv = ConvoScreen:new { id = "myscreenplay_my_npc_first_conv", leftDialog = "", customDialogText = "Welcome to My Screenplay, please choose an option.", stopConversation = "false", options = { {"Option 1. Go to the next stage of the conversation", "myscreenplay_my_npc_conv_1a"}, {"Option 2. Exit the conversation.", "myscreenplay_my_npc_conv_exit"}, } }
-- add this screen to the conversation myscreenplay_my_npc:addScreen(sullust_porter_first_conv);
-- option to exit the conversation
myscreenplay_my_npc_conv_exit = ConvoScreen:new { id = "myscreenplay_my_npc_conv_exit", leftDialog = "", customDialogText = "Goodbye.", stopConversation = "true", options = { } } -- add this screen to the conversation myscreenplay_my_npc:addScreen(myscreenplay_my_npc_conv_exit);
-- Option 1 of the conversation myscreenplay_my_npc_conv_1a
= ConvoScreen:new { id = "myscreenplay_my_npc_conv_1a", leftDialog = "", customDialogText = "You chose option 1. Please choose another option.", stopConversation = "false", options = { {"Start the conversation again.", "myscreenplay_my_npc_first_conv"}, {"Exit the conversation.", "myscreenplay_my_npc_conv_exit"}, } }
-- add this screen to the conversation myscreenplay_my_npc:addScreen(myscreenplay_my_npc_conv_1a);
-- register the conversation addConversationTemplate("myscreenplay_my_npc", myscreenplay_my_npc);

Now we need to let the screenplay engine know about these conversations, so in your bin/scripts/mobile/custom_content/conversations/myscreenplay folder, create a file called conversations.lua and edit it as below


Now finally, we need to inform the screenplay engine of our conversation.

Edit the file bin/scripts/mobile/custom_content/conversations.lua and add the following line

-- My Screenplay
Previous (2)Screenplay ReferenceNext (4)