What does a script for making an NPC disappear look like?

Post » Sat May 28, 2011 5:38 am

Like when Gentleman Jim Stacey of the Thieves guild disappears after you finished the Thieves guild quest. I would just copy the script, but there is more than one part of his script and I'm not sure what all I would need to copy and what not to. I am not really good with scripting.
User avatar
zoe
 
Posts: 3298
Joined: Sun Nov 12, 2006 1:09 pm

Post » Sat May 28, 2011 10:49 am

Depends on where the script is. If it's in dialog, just type Disable in the results box. If it's on the NPC, do a conditional test, then use Disable to make them "disappear".
User avatar
Kim Kay
 
Posts: 3427
Joined: Fri Oct 13, 2006 10:45 am

Post » Sat May 28, 2011 5:40 am

Can you explain what situation you want disable to work, is it on an NPC or an object?

Here's a link to the http://www.uesp.net/wiki/Tes3Mod:EnableDisableon scripting disable - if you check the code there are references to 2 original scripts in game to see how the devs used it
User avatar
Lillian Cawfield
 
Posts: 3387
Joined: Thu Nov 30, 2006 6:22 pm

Post » Sat May 28, 2011 12:07 am

Like when Gentleman Jim Stacey of the Thieves guild disappears after you finished the Thieves guild quest. I would just copy the script, but there is more than one part of his script and I'm not sure what all I would need to copy and what not to. I am not really good with scripting.

This is from my current WIP, replace the reference "xionrubblex" with the npcs id and it would disable them, in this script,when you "pick up" a hammer that is laying about near some rubble blocking your path, you "shatter" the rocks, then store the weapon. what is really happening is the script is run when you target and activate a dummy of the weapon that is placed there, a messagebox stating you busted the rocks up is displayed, and all the rubble plus the fake hammer are disabled. it then adds a real version of the hammer to your inventory.

Begin XionStone2If onactivate == 1Messagebox "You take the hammer, and with several powerful swings clear the rubble!"XionRubble1->Disable Xionrubble2->Disable Xionrubble3->Disable Xionrubble4->Disable Stoneshatter_fake->Disable player->additem stoneshatter_real 1endifend

User avatar
Stephani Silva
 
Posts: 3372
Joined: Wed Jan 17, 2007 10:11 pm

Post » Fri May 27, 2011 7:41 pm

As mentioned it really depends on the conditions you use to trigger the event. The most common being a journal update. Others could be a local state from script to script, or even a global. But a simplified form would be using the journal, with the following script attached to the NPC. If it's not on the NPC (say another object or a global script), the disable and setDelete need to have the reference target fixed. Note: setDelete is a Tribunal or later function, and has been know to crash the game when not used by the calling object.

Begin MyDisableShort DoneFloat Timeif ( MenuMode == 1 ) ; I use this out of habit with a timer     returnendifif ( done == 1 )     returnendifif ( GetJournalIndex, my_journal >= XX ) ;xx = your journal index     if ( GetCellChanged == 1 ) ; player leaves cell          disable     endif     Set Time to ( Time + GetSecondsPassed )     if ( Time > 3 )            setDelete 1 ;completely removes reference          set time to 0          set done to 1     endifendifend



If you wanted to have the NPC vanish before the player leaves the cell, then you can add an effect (a mock divine/almsivi or recall so to speak), then try this;

Begin MyDisableShort DoneFloat Timeif ( MenuMode == 1 ) ; wait until dialogue has ended     returnendifif ( done == 1 )     returnendifif ( GetJournalIndex, my_journal >= XX ) ;xx = your journal index     cast, "almsivi intervention", player  ;of course make sure NPC has spell and is able to cast it           disable      Set Time to ( Time + GetSecondsPassed )     if ( Time > 3 )            setDelete 1          set Time to 0          set done to 1     endifendif



These are untested, and it's been some time since I've scripted something like this, so there may be a more efficient method.
User avatar
Matt Bigelow
 
Posts: 3350
Joined: Sun Sep 30, 2007 6:36 pm


Return to III - Morrowind