Optimizing: Removing scripts from dead actors?

Post » Thu Jun 21, 2012 9:20 am

So I've just added a script to an actor dynamically using cloak effects, thanks to the nice tutorial on the CK wiki.

Only problem is, the script stays on the actor after death. I know I can run a check in the script to not "run the following lines" unless the actor is alive, and I know I can have it so my cloak effect doesn't attach scripts to already-dead actors, but the issue is that a previously alive actor will still have my script attached to it.

Seeing as I only run a calculation when said actor gets hit, I don't think it will be a serious performance-related issue. However, I can only imagine the kind of Save-game bloat this would cause. imagine playing 50 hours with my mod on one character, and there are literally THOUSANDS of scripts attached to various actors the players has come into contact with - even dead ones! Is there a way to, "clean up" and remove scripts to dead actors, or actors that are unloaded/not-in-range?
User avatar
Andy durkan
 
Posts: 3459
Joined: Fri Aug 03, 2007 3:05 pm

Post » Thu Jun 21, 2012 9:33 am

Aliases, perhaps. When they're dead, use http://www.creationkit.com/Clear_-_ReferenceAlias.
User avatar
Jessie Rae Brouillette
 
Posts: 3469
Joined: Mon Dec 11, 2006 9:50 am

Post » Thu Jun 21, 2012 3:29 am

A little confused on how that works.

So say if GetTargetActor().Clear() is used in an activemagiceffect script attached to an NPC, it'll remove the script from that NPC whenver I call that function?

EDIT: Doh just had a realization. If I "remove" the active magic effect from the actor, it should remove the script (that is from the magic effect) as well right? AKA I could simply just check if my cloak is being cast on them or not, and if not, remove the constant-effect script ability that the cloak had previously applied?
User avatar
vicki kitterman
 
Posts: 3494
Joined: Mon Aug 07, 2006 11:58 am

Post » Thu Jun 21, 2012 11:16 am

Under the Magic Effect of the cloak spell that attaches the script there is an option "No Death Dispel" if this is not ticked the script + effect should dissapear the moment the actor dies. At least thats what I am hoping with my mod or I will end up with the same massive save game bloat.
User avatar
Ezekiel Macallister
 
Posts: 3493
Joined: Fri Jun 22, 2007 12:08 pm

Post » Wed Jun 20, 2012 10:33 pm

Well the probelm with that is, I've just realized, that any alive actors near me that I don't plan on killing (say town folk or essential NPC's) will all get scripts attached to them that'll likely never go away unless I tell them too.
User avatar
Michael Korkia
 
Posts: 3498
Joined: Mon Jul 23, 2007 7:58 pm


Return to V - Skyrim