GisleAune Posted February 15, 2012 Share Posted February 15, 2012 (edited) So I was looking into ambushes with draugr bursting out of their sarchophagi and would want a script to have one trigger have them triggered with an interval between them. Normally I would just have put them all into an ObjectReference array property and iterated it with a loop, which is something I'm very familiar with and I like how CK handles array properties and iteration. So, would an activation caused on the trigger side, with the object reference to the actor in the ambush from the warehouseAmbushes cell, do it like "draugrList.Activate(self)"? Or is it a way of getting the array of objects using the trigger in activate parents? Or does this thing have to join the list of strange oddities and hardcoded barriers working agianst my scripting ideas? Edited February 16, 2012 by GisleAune Link to comment Share on other sites More sharing options...
GisleAune Posted February 16, 2012 Author Share Posted February 16, 2012 (edited) Ok, it does work, it can be activated through attaching the object reference to a script property and calling Activate on it. Here's the script if you want to see it. The "GiAu_" prefix is so I can find my plugins' stuff easier. I miss the for-loop syntax of other languages, but it's easy enoguh, though a little bit uglier in code, to use a while loop exactly like one. Scriptname GiAu_WakeDraugrOneByOne extends ObjectReference ; Properties, makes the script easy to use in the level and reuse in similiar situations ObjectReference[] Property DraugrList auto Float Property Interval auto ; This is the initial state: Trigger is on the ground, ready for unsuspecting player. Auto State Ready ; This is the event when an actor (!) steps in its bounds Event OnTriggerEnter(objectReference akActivator) ; You'll want to make sure it's the player. If((akActivator as Actor) == Game.GetPlayer()) ; Go through all the draugr. int i = 0 While(i < DraugrList.Length) ; Activate it DraugrList[i].Activate(self) ; Wait in the interval if(Interval > 0) Utility.Wait(Interval) EndIf ; Increment the iterator (i.e. add 1 to it) i += 1 EndWhile ; Done, no leave this state of readiness GotoState("Done") EndIf EndEvent EndState ; When it's done and not needed anymore as the draugr are awake. State Done ; The trigger shouldn't listen to any more events now. EndState Edited February 16, 2012 by GisleAune Link to comment Share on other sites More sharing options...
Recommended Posts