Scripting a StaggerKneel

Post » Tue Jun 19, 2012 6:42 pm

Does anyone have an example script of forcing a stagger or kneeling effect through an OnHit event?

I can get them to work through enchantments and perks, but not through a script.

I can also get other types of spells to apply through scripts, but the stagger/kneel variants seem to elude me.

Is there a stagger/kneel equivalent to "PushActorAway()" or "Kill()"?

Thank you! :-)
User avatar
Nicole Mark
 
Posts: 3384
Joined: Wed Apr 25, 2007 7:33 pm

Post » Tue Jun 19, 2012 6:36 am

http://www.creationkit.com/SendAnimationEvent_-_Debug

But read the notes.

And read the notes there : http://www.creationkit.com/PlayAnimation_-_ObjectReference
User avatar
Hannah Barnard
 
Posts: 3421
Joined: Fri Feb 09, 2007 9:42 am

Post » Tue Jun 19, 2012 11:27 am

You may also play around with the "PushActorAway" method. Look in the core game scripts for VoicePushEffectScript, or create your own, like so:
Scriptname MyVoicePushEffectScript extends ActiveMagicEffect Event OnEffectStart(actor Target, actor Caster) Caster.PushActorAway(Target, PushForce)EndEventint Property PushForce  Auto 

A PushForce between 1 and 5 might get what you want, or something similar. I've only played around with PushForces >15 for my mods.
User avatar
Melanie
 
Posts: 3448
Joined: Tue Dec 26, 2006 4:54 pm

Post » Tue Jun 19, 2012 6:13 am

Thank you both :-)

I did play with the PushActorAway... and it sent things flying airborne, hahaha! :-P

It's odd, though. I have two different spells. One causes a stagger, the other causes kneeling. They both work when I cast them manually. But I CANNOT get them to work inside of a script. I'm at a loss :-P


Ps. The Function http://www.creationkit.com/ProcessTrapHit_-_ObjectReference has a "float afStagger"... but I'm in an OnHit event :-P
User avatar
Maria Garcia
 
Posts: 3358
Joined: Sat Jul 01, 2006 6:59 am

Post » Tue Jun 19, 2012 10:34 am

You can make a self-targeted spell with a stagger magic effect and use

spellProperty.Cast(self, self)

Or you can use

self.PlayAnimation(idleProperty)

where you'll have to set idleProperty to point to staggerStart, or you can use

Debug.SendAnimationEvent(self, "staggerStart") where you don't need a property.

In all of those lines, self points to the guy getting hit :P
User avatar
matt oneil
 
Posts: 3383
Joined: Tue Oct 09, 2007 12:54 am

Post » Tue Jun 19, 2012 2:16 pm

If you're trying to make another character stagger in response to a spell from the player, try a "Fire and Forget" - "Self" spell with just a script effect. Give it a script that takes two Spell properties - your stagger spell and your kneel spell. In the OnEffectStart method, use the Spell.Cast() method on both properties to cast them on yourself. Your stagger and kneel spells should be "Fire and Forget" - "Target Actor" spells. I've done a similiar setup for other types of spells and it works as long as you have an Actor in your crosshairs when you cast the spell (that is, you must have a valid "Target Actor" for the two spells to act upon).

Hmmm....I guess that gets you a spell that makes the target stagger and kneel. But you wanted this effect to happen when the player hits the target with a weapon, right? You could have a weapon with a "dummy" enchantment effect. The enchantment would just be a hook for another script which, in the OnHit effect, checks if the agressor is the player and if so, has the aggressor cast the first spell I mentioned.
User avatar
Zach Hunter
 
Posts: 3444
Joined: Wed Aug 08, 2007 3:26 pm

Post » Tue Jun 19, 2012 10:08 pm

self.PlayAnimation(idleProperty)

where you'll have to set idleProperty to point to staggerStart

Did you succeed once to do this ? Because the Wiki says that "PlayAnimation cannot be called on actors".

And effectively all my attempts with PlayAnimation failed, the only thing that worked for Actors was SendAnimationEvent.
User avatar
Blackdrak
 
Posts: 3451
Joined: Thu May 17, 2007 11:40 pm

Post » Tue Jun 19, 2012 8:34 pm

Did you succeed once to do this ? Because the Wiki says that "PlayAnimation cannot be called on actors".

And effectively all my attempts with PlayAnimation failed, the only thing that worked for Actors was SendAnimationEvent.

Ermm no I wrote that reply there from the top of my head, I meant ''PlayIdle''
User avatar
asako
 
Posts: 3296
Joined: Wed Oct 04, 2006 7:16 am

Post » Tue Jun 19, 2012 12:03 pm

Just apply the spell effect that causes your stagger to happen with an OnHit() event.

I.E. make your script reference a spell that does what you want, instead of making your entire script just try and do it instead.
User avatar
Anne marie
 
Posts: 3454
Joined: Tue Jul 11, 2006 1:05 pm


Return to V - Skyrim