Alright, basically what I'm trying to do is track actors that are affected by my cloak spell, and store their reference in an array which can be manipulated durring the course of the cloak.
The cloak is going to be a concentrated effect, durring which actors inside it's radius will be stored in the array, and periodically things will happen to them (Every 1 - 2 seconds). What I'm needing help doing is figuring out how to add / remove actors from the array. I am figuring that this would be done with OnEffectStart() and OnEffectFinish() on the spell that is applied to each one by the cloak, updating the cloak's script itself. As an example (And I know this is not how to do it, at least I would be surprised if it was):
//########### The script that exists on the cloak magic effect itselfScriptname coreCloakEffectScript extends ActiveMagicEffectActor[] Property trackedActorList AutoEvent OnEffectStart(Actor target, Actor caster) RegisterForUpdate(2.0)EndEventEvent OnUpdate() // Do stuff to the actors in the affectedListEndEvent// Returns the tracked actor indexint function TrackActor(Actor t) // array logicEndFunction// Removes the actor from being trackedFunction StopTracking(int index) // array logicEndFunction //########### The script that exists on the magic effect that gets put on affected actors in range.Scriptname coreCloakActorEffectScript extends ActiveMagicEffectcoreCloakEffectScript Property cloakScript AutoInt trackIndexEvent OnEffectStart(Actor target, Actor caster) If (!target.IsDead()) trackIndex = cloakScript.TrackActor(target) EndIf EndEventEvent OnEffectFinish() cloakScript.StopTracking(trackIndex)EndEvent// I'm not actually sure if this event is neededEvent OnDying() cloakScript.StopTracking(trackIndex)EndEvent
So, what basically happens, in order:
For the duration of my concentrating the cloak, the following:
1) The actor moves within range of the cloak spell, applying a separate magic effect to him.
2) The magic effect applied registers the target for tracking
3) Every 2 seconds, something happens to tracked actors.
4) The actor goes out of range, or dies, and is unregistered for tracking.
Any help or suggestions on how this can be accomplished will be greatly appreciated
(Note: I did do a search, and the best I can find is something to do with making a quest which will contain the shared variables and methods, but I haven't been able to find a good resource on how to actually do this).
(Side not: I know // is not the proper comment for papyrus, but it's easier to read than ; on here imo. This is just an example script I wrote up in notepad.)