Example conversation system

Looking for Resources for your mod/project? Want to share some of your creations so others can use them? Post them here!
Post Reply
User avatar
ZZYZX
Posts a lot
Posts: 742
Joined: Thu Jun 07, 2012 5:56 pm
Location: Ukraine
Clan: A3
Clan Tag: [A3]

Example conversation system

#1

Post by ZZYZX » Mon Sep 28, 2015 12:50 pm

subj.

Screenshot:
Spoiler: It's kinda large (Open)
Image

Demo (map01) and associated resources:
http://www.mediafire.com/download/srh9k ... zzconv.pk3

For the lazy:
ACS source for the library: http://pastebin.com/0kcRVmHx (contains references to files being in zzconv.pk3, so better download anyway)
ACS source for the map: http://pastebin.com/RfXDhpgy

The system is aimed at being highly customizable and at the same time separating library code from user code.

Requires GZDoom 1.8.6 (or the corresponding ZDoom version) or Zandronum 3.0.
Works in multiplayer (tested).

The GUI supports mouse (although it's not required) and has a good example of ignoring m_pitch/m_yaw/invertmouse (this part will not work online for obvious reasons though).

Once you import the library, you use a function called Conversation_Init with a single parameter — an INI-like string that describes the current conversation page that should be displayed.
Currently it's possible to set the page title (i.e. something that was said to you) and your possible answers. The behavior of answers depends on scripts passed to Conversation_Init.

The config syntax is as follows:
"conversation title\noption 1[config_parameter=config_value,...]\n..."
You can have multiple lines in conversation title by using \\n.

Listing of all possible config parameters:
  • visible/visible_named=script
    Specifies a script to decide whether the current answer should be visible. This is executed only once during screen initialization.
  • can_activate/can_activate_named=script
    Specifies a script to check whether the current answer should be enabled (disabled answers are grayed out and are impossible to select). This is executed every tic.
  • target/target_named=script
    Specifies a script to run when the player selects an answer. This is not executed when the player clicks an answer that can't be activated (due to can_activate(_named) result).
    If you have a sub-conversation, you call Conversation_Init with different parameters here.
  • default
    Makes the current answer the default. Mixing this with can_activate(_named) isn't a good idea.
You can use single script for all actions (i.e. target, can_activate, and visible) by giving different arguments to the script.

There can be no spaces in the config sections (i.e. between [ and ]).
This is correct:

Code: Select all

Conversation_Init("Spawn a Cacodemon?\\n(or a cyberdemon if you have the BFG)\\n(мяу, кстати)\nYes[default,target_named=test(666,41,0)]\nNo[target=11]\nGIMME A CYBERDEMON!!![can_activate=13,target=14]");
This is WRONG and will NOT work:

Code: Select all

Conversation_Init("Spawn a Cacodemon?\\n(or a cyberdemon if you have the BFG)\\n(мяу, кстати)\nYes[default, target_named = test(666, 41, 0)]\nNo[target = 11]\nGIMME A CYBERDEMON!!![can_activate = 13, target = 14]");
Anyone is allowed to modify anything. If you want to modify the looks, check "zzconv_gui" named script in the library.

Btw, the archive contains a good cyrillic (who cares?) medieval-themed font from this game (original look) that was never used anywhere in Doom before.
And also two less medieval-themed fonts. Also cyrillic.

Unrelated: it's pretty sad that we can't send a reliable puke request (and get result from puke requests). Otherwise it'd be possible to make the entire GUI clientside and it'd be way more awesome, especially with the mouse.
Last edited by ZZYZX on Mon Sep 28, 2015 1:50 pm, edited 1 time in total.

Post Reply