I want to give the PC a choice to let the NPC die without attacking him. The NPC would die after his dialogue has been spoken. How would I script the death of that NPC after that dialogue?
Here you go:
void main()
{
object oNPC = GetObjectByTag("NPC_TAG_HERE");
effect eDeath = EffectDeath();
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDeath, oNPC);
}
That should work. Just put the tag of your NPC where it says NPC_TAG_HERE. :)
That didn't quite work. Yes the dude died, but he died as he was speaking.
Just create a node after the line he's supposed to say and apply the script to that node...
If - however - you want to do the same effect with scripting you'll want to use the following:
void main()
{
ActionPauseConversation();
object oNPC = GetObjectByTag("NPC_TAG_HERE");
effect eDeath = EffectDeath();
DelayCommand(AMOUNT_OF_SECONDS, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDeath, oNPC));
ActionResumeConversation();
}
You'll have to replace AMOUNT_OF_SECONDS with the length of the soundfile in seconds.
Hope that helps
Fastmaniac