Script on knocking someone down when you sprint into them?

Post » Thu Jun 21, 2012 12:46 am

Okay, so I've managed to do rather well so far on researching scripting and stuff for my mod that gives certain abilities/perks to the player.

This is my first "really hard" thing to figure out though, and I'm unsure where to start.

Basically, what I want to do, is a perk that does this:

When a player is wearing a full suit of Heavy Armor [easy]... while sprinting [easy]... into enemies, the enemy is knocked down [totally unsure how to even detect or do this].. and you lose 25 points of stamina per target knocked down this way [I feel like this is easy using variables that trigger on the former].

I know of PushActorAway, this will likely be what I do to cause the actual knockdown effect. I can do the full suit of heavy armor through perk/ability conditionals easy, and I know how to check if the player is sprinting in Papyrus as well. But how would I know if the player ran into an enemy, and then knockdown that reference I ran into?

I know it must be possible, since followers are able to (poorly) detect when a player is walking into them, and then back up. Not even sure where to look into stuff like that though.
User avatar
BRAD MONTGOMERY
 
Posts: 3354
Joined: Mon Nov 19, 2007 10:43 pm

Post » Wed Jun 20, 2012 6:35 pm

This is just off the top of my head, but what about consistently checking a few units ahead of the player with the function FindClosestActor()? If it ever returns someone other than the player that would mean there is an actor right in front of you. You would have to play around with the distances to get the right effect but that might work.
User avatar
Megan Stabler
 
Posts: 3420
Joined: Mon Sep 18, 2006 2:03 pm

Post » Thu Jun 21, 2012 12:58 am

Hmmm I'll look into that, thanks. I also thought about using cloak spells to detect actors with very small ranges, but I can't find any documentation or information on how they work.... and how I might use that to my advantage in a script. The cloak effects in the editor use a hard-coded effect made just for them.
User avatar
emma sweeney
 
Posts: 3396
Joined: Fri Sep 22, 2006 7:02 pm

Post » Wed Jun 20, 2012 6:49 pm

I don't know how they work either,but if you've not seen it...
There's a Block Perk Shield Charge: "Sprinting with a shield raised knocks down most targets."
That sounds very similar to what you're trying to do. I took a quick look at the related spell and magic effects and it sounds like you're on the right track.
User avatar
Kara Payne
 
Posts: 3415
Joined: Thu Oct 26, 2006 12:47 am

Post » Wed Jun 20, 2012 4:56 pm

Thanks, I totally forgot about that perk. I'll look into that too. With my luck though it'll probably be another hard coded effect :P Seems like I got a nice place to start, I'll report back with any progress.
User avatar
Roisan Sweeney
 
Posts: 3462
Joined: Sun Aug 13, 2006 8:28 pm

Post » Wed Jun 20, 2012 7:33 pm

So I promised a follow-up, here it is :biggrin:

Got it working, thanks for the suggestion tunaisafish, because the Shield Charge Perk is exactly what I needed to do to get this working. It's very simple: the whole thing is set up via a cloak, which refers to an effect (with a special shader with its own armor hit sound effect) that basically just does a PushActorAway on whatever the Target is from the caster.

On the upside, I figured out how cloak effects work too. Basically, it goes like this:

1. The base spell. This is what the perk (or spell) points to. It's a constant effect ability/spell on self, that refers to a cloak magic effect, or anythign else you want stacked on there.

2. The cloak magic effect. This is a constant effect ability that does nothing - except point to a second spell. Whatever this second spell it points to is, will be what the cloak does to the actor. So, if you have a cloak on your player, and then through the cloak magic effect dialog associate it with a fire spell, it'll "hit" that same firespell spell on whatever the cloak hits. In my case, this second spell effect that the cloak uses, was a script effect.

3. The second spell. This is the actual thing that does what you want the cloak to do. It's what the cloak magic effect will refer to when it wants to know what to actually hit actors/etc with. Can be anything from a fire, script, etc. Note that you must use "Spell" and not ability for this second spell, unless you only want it to apply once. If you use Ability, it'll correctly apply the cloak's effect to whatever it hits, but only once (because it is an ability, and because they technically already have the ability according to the game, it can't be added another time). This can be useful if you want to use a cloak that only works on an actor once for the lifetime of the actor. Not sure if this will royally mess up actors though after doing it for a while, since abilities never go away as far as I know.

So basically you just use the cloak magic effect as a "foundation" for the real spell. Any "real" spell that is done through a cloak first, will ahve it's effects done via the cloak instead of what you would expect.
User avatar
Your Mum
 
Posts: 3434
Joined: Sun Jun 25, 2006 6:23 pm

Post » Thu Jun 21, 2012 1:35 am

Thanks for that extra info, bet a lot of cool effects can be done with cloak logic. I haven't mucked with cloak spells at all, is there a way to set the diameter of how far the cloak spell extends, for example apply the effect once a target gets within 20 units? Also, for your spell above, how does it know you were sprinting? Does your second spell do something like "If player is sprinting then push actor away"?
User avatar
Crystal Birch
 
Posts: 3416
Joined: Sat Mar 03, 2007 3:34 pm

Post » Wed Jun 20, 2012 11:30 am

Yes you can.

Range of Cloak = Magnatude of the first ("Base") spell that points to your cloak magic effect. A magnitude of 6 for that base spell, would then be 6 (I think?) units in-game for the range. You can then have it do anything from being upclose and personal (like 6), or a wide AoE around you (like 20).

It knows when I am sprinting through the "Base" spell's condiitons. The base spell only activates the cloak magic effect (which in turn, applies it's spell to whatever is in range of the cloak) if all the conditions in the "Conditions" area of the base spell are true. In this case, doing "IsSprinting == 1" means the cloak only ever activates when I am actually sprinting.
User avatar
Cat
 
Posts: 3451
Joined: Mon Dec 18, 2006 5:10 am

Post » Wed Jun 20, 2012 12:31 pm

Ok, gotcha, I missed that it was a constant effect ability. That makes sense you would just check in the conditions. Thanks!
User avatar
anna ley
 
Posts: 3382
Joined: Fri Jul 07, 2006 2:04 am


Return to V - Skyrim