Apply effectsscripts to hostile actors when they spawn

Post » Thu Jun 21, 2012 2:09 pm

Tinkering around for hours but can't find a way to apply scripts to hostile actors when they spawn or die.
Maybe with OnCellAttach Event but I don't know where to hook a script up which containts that event.

Any suggestions?
User avatar
Lifee Mccaslin
 
Posts: 3369
Joined: Fri Jun 01, 2007 1:03 am

Post » Thu Jun 21, 2012 2:56 pm

I've been using the OnCellLoad and OnDeath events in the actor script.

A quest alias script can also be used, as long as you're certain that the quest will start before the event.

Alternatively, the main quest script can work with aliases in the OnInit event etc.
User avatar
Claire Mclaughlin
 
Posts: 3361
Joined: Mon Jul 31, 2006 6:55 am

Post » Thu Jun 21, 2012 7:58 am

thanks. i already abadoned the idea but your post let me try again and it works now.
BUT it only triggers on the first OnDeath event. I tried alias_dead.clear() but no effect

how to change it, so it triggers every time someone dies ?
User avatar
chinadoll
 
Posts: 3401
Joined: Tue Aug 22, 2006 5:09 am

Post » Thu Jun 21, 2012 8:39 am

Depending on your situation, you can put the OnDeath script in any of these places:
  • Actor base object
  • Actor instances
  • A different alias for each actor
  • A single alias which is reused for each new actor
I haven't tried option 4, but I guess it involves using Clear then ForceRefTo the next actor.

Case 1 and 2 require a script which extends Actor, whereas 3 and 4 must extend ReferenceAlias.
User avatar
KiiSsez jdgaf Benzler
 
Posts: 3546
Joined: Fri Mar 16, 2007 7:10 am

Post » Thu Jun 21, 2012 8:25 am

Aliases seem to be very tricky, I expected it to fill in automaticaly when cleared but it doesn't :/
I guess my best bet is to link a script to actors directly

Do you know anything about the "greet dead body" option in Ai Package Lists?
The idea was to modify that, since NPCs already react to dead people but don't do what I want them to do :]
Found something under the dialogue button on Actors - maybe that will work somehow...
User avatar
Shelby McDonald
 
Posts: 3497
Joined: Sat Jan 13, 2007 2:29 pm

Post » Thu Jun 21, 2012 8:49 am

I don't know much about AI packages yet, I'm afraid.

Are you trying to modify all actors in the game, or just some specific ones?
User avatar
Nina Mccormick
 
Posts: 3507
Joined: Mon Sep 18, 2006 5:38 pm

Post » Thu Jun 21, 2012 7:06 pm

All. Let's say all Bandits - I saw there are ~10-15 base actors for that (templates)
To keep it simple, they should glow ondeath (shadereffect lifedetect)

For some reason the script box on actors is greyed out :/
That's the stuff which gives me a hard time, a lot of things are harder to accomplish as they should...
User avatar
Chris Guerin
 
Posts: 3395
Joined: Thu May 10, 2007 2:44 pm

Post » Thu Jun 21, 2012 6:35 am

The script box only seems to be greyed out on templates, for some reason.

It can be changed on all other actors (unless Template > Use Scripts is checked).

In any case, changing base objects directly is generally discouraged.

The http://www.creationkit.com/Dynamically_Attaching_Scripts discusses how to add a script dynamically to all actors. Does that help?
User avatar
vanuza
 
Posts: 3522
Joined: Fri Sep 22, 2006 11:14 pm

Post » Thu Jun 21, 2012 5:27 am

yes, that works fine. thanks
User avatar
Noely Ulloa
 
Posts: 3596
Joined: Tue Jul 04, 2006 1:33 am


Return to V - Skyrim