Cannot figure this script out

Post » Mon Nov 19, 2012 9:38 am

Spoiler
Scriptname dostuff extends ObjectReferenceimport utilityimport debugActor Property PlayerREF AutoActor Property Leann AutoSpell Property HealOther AutoEvent OnInit()		RegisterForSingleUpdate(7.0) ; Single update is safer. Use a float value as arg is a Float		RegisterForAnimationEvent(Leann, "magicDraw")EndEventEvent OnUpdate()		If PlayerREF.IsWeaponDrawn() ;  Leann.EquipSpell(HealOther,0)debug.SendAnimationEvent(Leann,"magicDraw")endifEndEvent
I am trying my hand at animations, and I simply want to animate an actor so she will have her "HealOther" spell drawn when I draw my weapons, later make the actor cast it at the player with the casting animation. Nothing happens when I draw my weapon, she just idles.
User avatar
Tinkerbells
 
Posts: 3432
Joined: Sat Jun 24, 2006 10:22 pm

Post » Mon Nov 19, 2012 10:24 am

You register for animation events, but do not include a block of code for that event. See http://www.creationkit.com/OnAnimationEvent_-_Form.

Also, if you want that update that on a loop, you will need to use a single update chain. Add another RegisterForSingleUpdate at the end of your OnUpdate event to loop it.

And what ObjectReference is this attached to? I see that it extends ObjectReference. Should this be on a quest instead?
User avatar
Andy durkan
 
Posts: 3459
Joined: Fri Aug 03, 2007 3:05 pm

Post » Mon Nov 19, 2012 8:14 am

This script is attached to an actor. I want her to play the animation of drawing a spell out when I draw my weapons, and the script posted isn't working
User avatar
Nice one
 
Posts: 3473
Joined: Thu Jun 21, 2007 5:30 am

Post » Mon Nov 19, 2012 2:57 pm

Edit: I have a better handle on what you're trying to do now.
  • To get her to draw her weapons using that spell, you need to
    • Equip the spell (you do this already)
    • Use http://www.creationkit.com/DrawWeapon_-_Actor to force the actor to draw their weapon; the spell will be equipped in one hand.
  • Your OnUpdate() event is only going to fire once because you don't re-register for update at the end of your OnUpdate() block
  • Verify that your properties are filled in the CK.
  • You didn't really specify when you want the actor to actually cast the spell.
User avatar
Robert
 
Posts: 3394
Joined: Sun Sep 02, 2007 5:58 am

Post » Mon Nov 19, 2012 5:47 am

success! she draws out her spell. Though I used "magic_equip" as the string for the animation. Now I can continue to perform the rest of the action.
Spoiler
 Scriptname dostuff extends ObjectReference  import utilityimport debugActor Property PlayerREF AutoActor Property Leann AutoSpell Property HealOther AutoEvent OnInit()		RegisterForSingleUpdate(7.0) ; Single update is safer. Use a float value as arg is a FloatRegisterForAnimationEvent(Leann, "magic_equip")EndEventEvent OnUpdate()		If PlayerREF.IsWeaponDrawn() ;Leann.EquipSpell(HealOther,0)debug.SendAnimationEvent(Leann,"magic_equip")endifRegisterForSingleUpdate(7.0)EndEvent
User avatar
Nichola Haynes
 
Posts: 3457
Joined: Tue Aug 01, 2006 4:54 pm


Return to V - Skyrim