OnDeath()

Post » Wed Jun 20, 2012 8:49 pm

Hello,

I have just started recently scripting for my level and was wondering how I would go about this activation of a door.

- When an enemy actor dies, the linked door will open.

Do I use OnDeath() for this?
User avatar
Amie Mccubbing
 
Posts: 3497
Joined: Thu Aug 31, 2006 11:33 pm

Post » Thu Jun 21, 2012 12:57 am

):
User avatar
Benjamin Holz
 
Posts: 3408
Joined: Fri Oct 19, 2007 9:34 pm

Post » Thu Jun 21, 2012 12:22 am

That's right. You'll want to use the OnDeath() event for actors.

If the actor is unique you could attach a script to it like

ScriptName openDoorScript extends ActorObjectReference property door autoEvent OnDeath(Actor akKiller)    door.lock(false)EndEvent

you could do whatever you want in place of lock.

If the actor is not unique you'd be better off attaching the script to a referencealias inside a quest with the actor filling the alias. In this case, the script would be the same except it would extend ReferenceAlias.
User avatar
Racheal Robertson
 
Posts: 3370
Joined: Thu Aug 16, 2007 6:03 pm

Post » Wed Jun 20, 2012 12:31 pm

Oh thank you, however I am confused on scripting. Do I make a new custom script for the actor and put the code in, and set the reference properties or use a premade script?
User avatar
emily grieve
 
Posts: 3408
Joined: Thu Jun 22, 2006 11:55 pm

Post » Wed Jun 20, 2012 8:15 pm

Make a new one. Ive never messed with the premade ones and my stuff works. If you plan to release your mod you will have to include your scripts if they are custom.
User avatar
Lynne Hinton
 
Posts: 3388
Joined: Wed Nov 15, 2006 4:24 am

Post » Thu Jun 21, 2012 12:27 am

That's right. You'll want to use the OnDeath() event for actors.

If the actor is unique you could attach a script to it like

ScriptName openDoorScript extends ActorObjectReference property door autoEvent OnDeath(Actor akKiller)	door.lock(false)EndEvent

you could do whatever you want in place of lock.

If the actor is not unique you'd be better off attaching the script to a referencealias inside a quest with the actor filling the alias. In this case, the script would be the same except it would extend ReferenceAlias.

Oh wow, I used SetOpen() function in replace of the lock. Dude, thank you so much. Scrivene07, thank you as well man. I made sure to create a new script, which is easier to have a precise command. My only question is where do my scripts save? Is it just like the textures, etc etc folders?
User avatar
Laura Hicks
 
Posts: 3395
Joined: Wed Jun 06, 2007 9:21 am

Post » Thu Jun 21, 2012 3:21 am

My only question is where do my scripts save? Is it just like the textures, etc etc folders?
Data\Scripts\. Source : .PSC :: Compiled : .PEX
User avatar
Rachael Williams
 
Posts: 3373
Joined: Tue Aug 01, 2006 6:43 pm

Post » Wed Jun 20, 2012 3:04 pm

Thank you JustinOther :biggrin:
User avatar
rae.x
 
Posts: 3326
Joined: Wed Jun 14, 2006 2:13 pm


Return to V - Skyrim