Author: dwringer
Author Website:

Requirements: No addons required

Version: 1

Short description: A simple, RPG-like interactive text conversation system for NPC's (single player)

Date: 2014-02-28 23:52


Comments: (2)
Rating:



 



ASINC: A Simple Interactive NPC Conversation Script

by
dwringer


Description:
This is a simple console-RPG style conversation system (similar to dialogue seen in games like Final Fantasy VI or Knights of the Old Republic).

I have been putting this together over the last few days, and have gotten to a point where my desire to add features outweighs my desire to debug/troubleshoot. So, I am releasing what I have as of now in case others may be interested in using it to make missions, or even just to play around with how to make custom dialogs and onscreen resources. I am a complete novice when it comes to those topics, so it is likely some may find serious inadequacies in my code. Nevertheless, it seems to work pretty smoothly now, and I think I've worked out the major performance/initialization hiccups.


Features:
  • This is a purely text-based interactive conversation system, completely independent of the system built into the game.
  • In interactive mode, the player can be presented with up to three responses, each of which can lead to a new conversation state for the unit (or unit class, represented by a Game Logic).
  • The responses can also have associated actions, which are just chunks of code that will be compiled and executed at the time of selection (thus, forks in the mission flow can be set up, tasks can be given, etc.).
  • The system can also work passively, where NPC's provide non-interactive dialog for a specified number of seconds before the frame disappears. This is mainly for visual consistency, as the game currently allows this type of scripting without any real complications anyway.
  • I have included a demo mission, which for simplicity's sake doesn't quite illustrate the full potential of the system. However, it is a bare minimum display of all the different functions involved.

Installation:
Just unzip the included .rar file into your editor missions directory (in My Documents\Arma 3\missions\ or My Documents\Arma 3 Other Profiles\profilename\missions\).

Essential elements of a mission:
  • A trigger, set to activation by Game Logic, with the condition set to (time > 1), and the On Act: field set to "_nil = execVM "dialogEngineStart.sqf";"
  • Each unit that can be talked to must be initialized with "_nil = this execVM "dialogEnable.sqf""
  • initDialogs.sqf must be filled with the correct information to set up the NPC's:
  • See the setup of the example mission for more details

Look in initDialogs.sqf for examples of what kind of dialogue scripting possibilities exist - I have provided macros to set the text, as well as to set responses and associated actions, and the best way to figure it out is just to see it. This part could probably use some work but it is relatively straightforward. Until such time as I can put together some kind of real documentation, the example mission will have to suffice. And I probably won't do that until I have improved some things.


Notes:
Feedback/testing is greatly appreciated! Also, if anyone making a valiant effort to check this out finds themselves struggling, I'll be glad to help. As far as I know, the example mission should work out-of-the-box. If you follow the same patterns, you should be able to set up just about anything - the example is as barebones as it gets, so it would probably be fastest just to use it as a template.


Credits & Thanks:
Bohemia Interactive
Bioware - interface inspiration
Squaresoft - interface inspiration
Mandoble - scripting inspiration
Silola - scripting inspiration


License:
You may freely use these files in your own missions, but only if public attribution of the source is included. You may freely modify the files under the same conditions. Do whatever you want for private use.


Change log:
v1
- first release


Forums Topic:
- BI Forums




Enable javascript to be able to download from Armaholic please!



Tags: Conversation,   Dialogue,   Npc