View Full Version : Death by scripting?

02-09-2009, 08:08 PM
I was wondering if/how you can kill someone using script attached to dialog (or any easier way) (example: Bob has been injured in a recent fight. When you talk to him, he will ask you to tell his wife he loved her. As soon as he's finished asking, he dies)


Star Admiral
02-09-2009, 08:46 PM
Yes, you can. Use the DestroyObject() function. It would look something like this.

void main() {
object oKill = GetObjectByTag( "persontokill" );
AssignCommand( oKill, ClearAllActions() );
SetCommandable( FALSE, oKill );
DestroyObject( oKill, 1.00 );

"persontokill" should be replaced with the tag of the creature in question. The 1.00 in DestroyObject() is a delay before deletion, so that the creature doesn't immediately disappear. You should use this script only at the very end of the dialog, else bad things might happen.

- Star Admiral

02-09-2009, 09:08 PM
Thanks Star Admiral for the fast reply. Would his body still be in the ground as normal, or would it disappear. (Example: would I have to make a script to have Bob give me a note for his wife, or would I be able to put the note in his inventory and take it from his dead body?)

Star Admiral
02-09-2009, 09:51 PM
His body would fade away, so if you want to him to give a note, it will have to be by scripting.

- Star Admiral