Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

Forcing an NPC to fall down in a script?


Malonn
 Share

Recommended Posts

What's the easiest way to force an NPC to fall down in a script.  Am I missing a easy way to do it via a function that I've overlooked?  I couldn't find anything.  Currently I've been messing with idle animations, but that has been a little wonky.  Any help would be appreciated.

Link to comment
Share on other sites

Make a scripted Ability spell (and be very sure it has *zero* magicka cost) with the duration you want, and the effect of Paralysis on Self. In your script, if you do a call to myNPCref.addSpell myParalyzeAbility, the NPC will add the "ability" (actually a curse) to themselves and will fall down. Then after the correct time call myNPCref.removeSpell myParalyzeAbility to turn off the effect.

 

You may have to create a custom magic effect as a clone of Paralysis without the shader effect, unless you don't care about the effect playing, and you may find that you need to add about 1 second to the duration in the Ability to ensure that the NPC doesn't have time to re-cast it upon themselves just as your script is about to remove it. To make your script fire fast enough, if it's a quest script, you may need to set fQuestDelayTime in that script to something like 0.1 second.

 

There's also a way to make an NPC directly play an animation group; I'm not sure offhand how to best do that.

Link to comment
Share on other sites

Great suggestion, syscrusher.  I hadn't thought about a spell.  But, in the time between asking for help and this answer I was able to figure out a pure scripting way to make an NPC fall down (plus I was thinking with a paralyze effect the NPC will freeze and fall; with my way the NPC crumbles with physics to the cround).  The solution I found, for those interested, was to use the "PushActorAway" function.  Double up on the reference when setting the function and set the force parameter to a negative number.  This forces the NPC/creature to fall to the ground and then get right on back up.

 

Thanks again, though.

Link to comment
Share on other sites

The best way to make an NPC fall down that looks natural is to drain their fatigue. Give it an absurd amount (like 1000) and have it as an ability. When you need them to fall down add it to them, they'll crumple with havok.

 

That way you won't get the bizarre paralysis green shader and the stiff fall down. It will look natural.

Link to comment
Share on other sites

To play an animation you will need to have the animation of falling down ready, then you can add it as a special idle with the requirement of the NPC having to have a token (just a blank item with an ID you can use as the reference) in the script add the token and then use the command "pickidle" to play the animation of them falling down, then remove the token and have them pickidle and then evaluate their packages again so they choose whatever it is you need them to do next.

Link to comment
Share on other sites

Great suggestion, syscrusher.  I hadn't thought about a spell.  But, in the time between asking for help and this answer I was able to figure out a pure scripting way to make an NPC fall down (plus I was thinking with a paralyze effect the NPC will freeze and fall; with my way the NPC crumbles with physics to the cround).  The solution I found, for those interested, was to use the "PushActorAway" function.  Double up on the reference when setting the function and set the force parameter to a negative number.  This forces the NPC/creature to fall to the ground and then get right on back up.

 

Thanks again, though.

I didn't know about the negative number. Usually PushActorAway makes them fly lol. But that's awesome! Hmm, that can be incredibly useful to know.

Link to comment
Share on other sites

  • 3 weeks later...

I'm a little late here, but I'll reply anyway.

 

Great suggestions, jamochawoke.  I ended up using the fatigue suggestion for a different part of the script.  To just knock someone down I prefer "PushActorAway" because they get right back up, no need to worry about adjusting fatigue.  But a different section of the script called for an actor to be knocked out, that is where I used your suggestion.  I did it with pure scripting, no spells, but still...

 

Anyway, thanks.

Edited by Malonn
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...