forked from Jaysyn/PRC8
Updated Release Archive. Fixed Mage-killer prereqs. Removed old LETO & ConvoCC related files. Added organized spell scroll store. Fixed Gloura spellbook. Various TLK fixes. Reorganized Repo. Removed invalid user folders. Added DocGen back in.
109 lines
3.7 KiB
Plaintext
109 lines
3.7 KiB
Plaintext
//:://////////////////////////////////////////////
|
|
//:: Short description
|
|
//:: filename
|
|
//:://////////////////////////////////////////////
|
|
/** @file
|
|
Long description
|
|
|
|
|
|
@author Joe Random
|
|
@date Created - yyyy.mm.dd
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:://////////////////////////////////////////////
|
|
|
|
#include "inc_dynconv"
|
|
|
|
//////////////////////////////////////////////////
|
|
/* Constant defintions */
|
|
//////////////////////////////////////////////////
|
|
|
|
const int STAGE_ENTRY = 0;
|
|
|
|
|
|
//////////////////////////////////////////////////
|
|
/* Aid functions */
|
|
//////////////////////////////////////////////////
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////
|
|
/* Main function */
|
|
//////////////////////////////////////////////////
|
|
|
|
void main()
|
|
{
|
|
object oPC = GetPCSpeaker();
|
|
/* Get the value of the local variable set by the conversation script calling
|
|
* this script. Values:
|
|
* DYNCONV_ABORTED Conversation aborted
|
|
* DYNCONV_EXITED Conversation exited via the exit node
|
|
* DYNCONV_SETUP_STAGE System's reply turn
|
|
* 0 Error - something else called the script
|
|
* Other The user made a choice
|
|
*/
|
|
int nValue = GetLocalInt(oPC, DYNCONV_VARIABLE);
|
|
// The stage is used to determine the active conversation node.
|
|
// 0 is the entry node.
|
|
int nStage = GetStage(oPC);
|
|
|
|
// Check which of the conversation scripts called the scripts
|
|
if(nValue == 0) // All of them set the DynConv_Var to non-zero value, so something is wrong -> abort
|
|
return;
|
|
|
|
if(nValue == DYNCONV_SETUP_STAGE)
|
|
{
|
|
// Check if this stage is marked as already set up
|
|
// This stops list duplication when scrolling
|
|
if(!GetIsStageSetUp(nStage, oPC))
|
|
{
|
|
// variable named nStage determines the current conversation node
|
|
// Function SetHeader to set the text displayed to the PC
|
|
// Function AddChoice to add a response option for the PC. The responses are show in order added
|
|
if(nStage == STAGE_ENTRY)
|
|
{
|
|
// Set the header
|
|
SetHeader("Foo.");
|
|
// Add responses for the PC
|
|
AddChoice("Bar", 1, oPC);
|
|
AddChoice("Baz!", 2, oPC);
|
|
|
|
MarkStageSetUp(nStage, oPC); // This prevents the setup being run for this stage again until MarkStageNotSetUp is called for it
|
|
SetDefaultTokens(); // Set the next, previous, exit and wait tokens to default values
|
|
}
|
|
//add more stages for more nodes with Else If clauses
|
|
}
|
|
|
|
// Do token setup
|
|
SetupTokens();
|
|
}
|
|
// End of conversation cleanup
|
|
else if(nValue == DYNCONV_EXITED)
|
|
{
|
|
// Add any locals set through this conversation
|
|
}
|
|
// Abort conversation cleanup.
|
|
// NOTE: This section is only run when the conversation is aborted
|
|
// while aborting is allowed. When it isn't, the dynconvo infrastructure
|
|
// handles restoring the conversation in a transparent manner
|
|
else if(nValue == DYNCONV_ABORTED)
|
|
{
|
|
// Add any locals set through this conversation
|
|
}
|
|
// Handle PC responses
|
|
else
|
|
{
|
|
// variable named nChoice is the value of the player's choice as stored when building the choice list
|
|
// variable named nStage determines the current conversation node
|
|
int nChoice = GetChoice(oPC);
|
|
if(nStage == STAGE_ENTRY)
|
|
{
|
|
// Move to another stage based on response, for example
|
|
//nStage = STAGE_QUUX;
|
|
}
|
|
|
|
// Store the stage value. If it has been changed, this clears out the choices
|
|
SetStage(nStage, oPC);
|
|
}
|
|
}
|