Scripting Problem - Visual Effect on Enabling an Actor

Post » Sun Nov 02, 2014 10:10 am

I'm new to scripting and want to write a script that causes a few draugr to appear from thin air after a short teleport-in visual effect. I also want the Draugr to be disabled while the teleport effect is playing so they arent moving around during that time.

I've created a few draugr that are initially disabled. I've made a trigger box that covers an entire room and I've successfully made it so that when the player enters the trigger box the draugr are enabled and it even plays the teleport visual effect. The only problem is that there is always a delay, the draugr model plays for maybe 1/5 of a second and then the teleport effect plays.

The script attached to the trigger box:

Scriptname SpawnDraugr extends ObjectReference Hidden Actor Property Draugr1H AutoActor Property Draugr2H AutoActor Property DraugrMissile AutoActor Property DraugrWarlock AutoObjectReference Property TriggerBox AutoEvent OnTriggerEnter(ObjectReference akActionRef)	if akActionRef == Game.GetPlayer()		Utility.Wait(2.0)		Draugr1H.enableNoWait()		Draugr2H.enableNoWait()		DraugrMissile.enableNoWait()		DraugrWarlock.enableNoWait()		Draugr1H.enableAI(false)		Draugr2H.enableAI(false)		DraugrMissile.enableAI(false)		DraugrWarlock.enableAI(false)	EndIfEndEvent 
The script attached to each draugr:
Scriptname AppearEffect extends ObjectReference Hidden Actor Property DraugrActor AutoObjectReference Property TriggerBox AutoVisualEffect Property AppearAnimation AutoEvent OnLoad()		AppearAnimation.play(DraugrActor, 1.0, Game.GetPlayer())		Utility.Wait(1.0)		DraugrActor.EnableAI(True);EndEvent
I've tried more things than i can remember to list. I've tried playing the effect onactivate but the timing was worse. The triggerbox is not an activation parent to the draugrs... ive played with that a lot as well.
I'm really new so I may just be approaching it from a totally wrong angle. Any help would be appreciated.

User avatar
carly mcdonough
 
Posts: 3402
Joined: Fri Jul 28, 2006 3:23 am

Post » Sun Nov 02, 2014 1:51 am

Did you already tried OnInit() `?

User avatar
Jonny
 
Posts: 3508
Joined: Wed Jul 18, 2007 9:04 am

Post » Sun Nov 02, 2014 2:13 am

I just now tried using oninit() instead onload() and it didn't seem to call the script at all. Didn't enable AI or play the special effect.

Another question... I've been looking through http://www.creationkit.com/Category:Script_Objects to find functions and events to use but i don't see oninit() in actor, objectreference, or form. Am i missing something?

User avatar
Krystina Proietti
 
Posts: 3388
Joined: Sat Dec 23, 2006 9:02 pm


Return to V - Skyrim