Jump to content

Need script to disable body on death please


Recommended Posts

Hi, I'm currently making a mod and one part involves a hallucination / illusion of some NPCs. Everything works fine except when the npc dies (intended part of the scene) I don't know how to make the body disappear (as it is mean to be a hallucination and should disappear on death)

 

I'm wondering if someone could write a simple script that will disable anything it's attached to on death

 

And also is there anything I need to do to get this working as I'm not really familiar with scripting, all credit for the script will go to the author in the mod description of course

 

Thanks in advance

Edited by thelonewarrior
Link to comment
Share on other sites

Assuming this NPC is a reference alias.

Scriptname DisableAliasOnDeathScript extends ReferenceAlias

Event OnDeath(Actor akKiller)
       (GetReference() as Actor).Disable()
EndEvent

For this really easy script, all you need to do is create a new script on the alias and copy/paste this into it.

This will give you the basics on script creation: http://www.creationkit.com/index.php?title=Bethesda_Tutorial_Papyrus_Hello_World

Edited by TheDungeonDweller
Link to comment
Share on other sites

Ok so it's not an alias, the NPCs are spawned via an explosion using "placed object" as they appear from an explosion that distorts the air like a portal (sorry it's weird I know), is there anyway to write a script that just disables whatever it's attached to once they die?

 

So that it just references itself? And then disables it, whatever that might be?

 

It's basically a weapon that causes the player to hallucinate when hit and the npc spawns from nowhere in the same way you would "summon" a new creature in other games like skyrim

 

 

 

Thanks again

Edited by thelonewarrior
Link to comment
Share on other sites

Yes. Just correct the script above so it would look like this:

 

 

Scriptname YourCustomScriptName extends Actor

Event OnDeath(Actor akKiller)
       Self.Disable()
EndEvent

 

And attach it locally on the Actor Base (NPC in ObjectWindow).

Link to comment
Share on other sites

Yes. Just correct the script above so it would look like this:

Scriptname YourCustomScriptName extends Actor

Event OnDeath(Actor akKiller)
       Self.Disable()
EndEvent

And attach it locally on the Actor Base (NPC in ObjectWindow).

 

Thanks a lot!

 

Works really well :) Ill be sure to mention both of you when my mod is released

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...