Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Scripting NPC Death

Page: 1 of 1
 darthtyren
07-09-2011, 9:44 AM
#1
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?
 Marius Fett
07-09-2011, 11:22 AM
#2
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. :)
 darthtyren
07-09-2011, 3:14 PM
#3
That didn't quite work. Yes the dude died, but he died as he was speaking.
 Fastmaniac
07-09-2011, 3:46 PM
#4
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
 darthtyren
07-09-2011, 4:36 PM
#5
Fantastic. Thanks.
Page: 1 of 1