//**************************************************************************************************************
// THERE ARE 2 SCRIPTS HERE AND INSTRUCTIONS IN THE COMMENTS!
//**************************************************************************************************************
//BIOWARE: a "preview" button for submitting to these message boards would help.
I sure hope this posts nicely. I'd hate a typo to make my post look //bad.
//
//<b>1. NPC Monolog/Conversation</b>
//
//<b>2. What it does: This script allows an NPC to run through several lines of
his/her own "over the head" text.</b>
//
//<b>3. Notes: </b>
//I searched the boards and found this question came up a lot but there were no
solutions that I could find. I finally figured this out and have tested it.
//
//This script is set up for one NPC to talk as though giving a lecture. I
haven't tested modifications on making two NPCs talk to each other, but that's
//coming shortly as I have another place where I want two NPCs to talk to each
other.
//
//First you must go into the NPC's OnSpawn event and simply uncomment the line:
//SetSpawnInCondition (NW_FLAG_HEARTBEAT_EVENT);
//found in the Custom User Defined Events section to activate the NPC's
Heartbeat event. Don't forget to save the script under a different name so you
//don't over-write the default script (and don't forget to assign your new
script to the NPC's OnSpawn event).
//Next, you'll need to place the following script in the OnEnter event of a
generic trigger defining the area in which you want the player to cause this
//conversation, or you might try placing it in the NPC's OnPerceive event
(though I have not tested that). This script speaks the first line of the
//conversation and sets a local variable on the NPC that will control the flow
of script.
void main()
{
object oPriest=GetObjectByTag("fc_PlatformPriest");
AssignCommand(oPriest, SpeakString("According to thy instructions, oh Great
Mictlantecuhtli, we have weeded out the unworthy from our potential
supplicants."));
SetLocalInt(oPriest, "iShowLine", 1);
}
//Then this is the template (complete with custom content from my module - sorry
about the stereotypical cult-sacrificing-victims side-plot) for the //custom
//conversation. Place this script in the NPC's OnUserDefined event. The example
stops mid-conversation but by then you should have figured //out the //concept.
//::///////////////////////////////////////////////
//:: Default: On User Defined
//:: NW_C2_DEFAULTD
//:: Copyright (c) 2002 Bioware Corp.
//:://////////////////////////////////////////////
/*
Determines the course of action to be taken
on a user defined event.
*/
//:://////////////////////////////////////////////
//:: Created By: Don Moar
//:: Created On: April 28, 2002
//:://////////////////////////////////////////////
void main()
{
// enter desired behaviour here
// 1001 = OnHeartbeat Event.
int nEvent = GetUserDefinedEventNumber();
if (nEvent == 1001)
{
object oPriest=GetObjectByTag("fc_PlatformPriest");
// Check to see if the priest is conversing.
// (Basically, is the last line still over his head?)
// If so, wait for next heartbeat.
if (IsInConversation(oPriest) == FALSE && GetIsInCombat(oPriest) == FALSE)
{
int iLine=GetLocalInt(oPriest, "iShowLine");
object oVictim1=GetNearestObjectByTag("fc_PlatformVictim", OBJECT_SELF, 1);
object oPC=GetFirstPC();
switch(iLine)
{
case 1:
AssignCommand(oPriest, SpeakString("Now we are prepared to sacrifice them to
thee, oh master!"));
SetLocalInt(oPriest, "iShowLine", 2);
break;
case 2:
AssignCommand(oPriest, SpeakString("And through thy devine power, let fire fly
from my fingertips --"));
SetLocalInt(oPriest, "iShowLine", 3);
break;
case 3:
AssignCommand(oPriest, SpeakString("And through our gathered witnessing of this
event, we shall all receive thy blessing!!"));
SetLocalInt(oPriest, "iShowLine", 4);
break;
case 4:
AssignCommand(oPriest, SpeakString("Now DIE ye mortal scum! DIE for
Mictlantecuhtli!!"));
SetLocalInt(oPriest, "iShowLine", 5);
break;
case 5:
AssignCommand(oPriest, ActionCastSpellAtObject(SPELL_FLAME_ARROW, oVictim1,
METAMAGIC_ANY, TRUE, 0, PROJECTILE_PATH_TYPE_DEFAULT, TRUE));
AdjustAlignment(oPC, ALIGNMENT_EVIL, 5);
SetLocalInt(oPriest, "iShowLine", 6);
break;
case 6:
AssignCommand(oPriest, SpeakString("YES!! Feel the power! Feel the presence of
Mictlantecuhtli seeping into your souls!"));
SetLocalInt(oPriest, "iShowLine", 7);
break;
case 7:
AssignCommand(oPriest, SpeakString("And now for the second of three."));
SetLocalInt(oPriest, "iShowLine", 8) ;
break;
}
}
};
return;
}
//Please note the last case should still set the NPC's local variable up, or the
last line will continually repeat.
//
//Members, please feel free to send me a message through the boards' "My
Messages" system.
//
//Hopefully, a multi-NPC conversation script is coming soon as I have a place
for that too.