Make a NPC fall on the ground

Post » Tue Jun 19, 2012 4:30 pm

I need one of these two things :
- a command to stop the SendAnimationEvent, and bring back the NPC to his "normal" animation state.
- A way to make the NPC stay for 15 sec on the ground in the last script.

With one of those two things, I can do what I want...
User avatar
rebecca moody
 
Posts: 3430
Joined: Mon Mar 05, 2007 3:01 pm

Post » Tue Jun 19, 2012 1:31 pm

So, it's like he's asleep? Check the AI code that makes NPCs go to sleep/wake up at certain times. There has to be a way to force an NPC to take a nap...Then put them in a Deactivated mode and do a "Push away" on them to sprawl them on the floor...then use something similar to the code in the dungeon tutorial to wake up the draugr in the tomb.

; Code to put NPC asleep here, and a push to knock him down.   NPC.Deactivate()   RegisterForSingleUpdate(15)Event OnUpdate()  NPC.Activate()EndEvent

Haven't done much yet with NPC manipulation, but that may be something like what you're looking for?
User avatar
Vincent Joe
 
Posts: 3370
Joined: Wed Sep 26, 2007 1:13 pm

Post » Tue Jun 19, 2012 8:48 am

It starts to be a thing like I never did yet.
I will try to look at AI package and learn how it works.

In fact, I see that there is a "Sleep and Guard" package, I guess it would maybe work.
I will look at the tuto to see how to add and/or remove a package to a NPC by a script.

EDIT :

I can't do something with activate/deactivate, as Papyrus compiling says to me taht is not a valid function.
I guess the idea to add a package template to the NPC is fine. I will look out how to do that when I get a moment.
User avatar
Roberto Gaeta
 
Posts: 3451
Joined: Tue Nov 06, 2007 2:23 am

Post » Tue Jun 19, 2012 11:30 pm

I think http://www.creationkit.com/Bethesda_Tutorial_Traps_and_Prefabsis the tutorial that covers something similar...does the NPC need to drop while the player is present, or was he knocked out "off screen" and wakes up when the player approaches?
User avatar
Enny Labinjo
 
Posts: 3480
Joined: Tue Aug 01, 2006 3:04 pm

Post » Tue Jun 19, 2012 9:37 am

Sorry for the late.

The NPC needs to drop and to wake up while the player is present, cause it is a magic effect (poison, or spell cast by the player, I still dunno, it's not important now).

For the Ambush tuto, I already saw it, but it needs to have the "ambush" NPC in the NPC list.
And I want that to work with any NPC. But I can't duplicate all the NPC in the game to make their Ambush clone ! It would be insane.

I just would like to find a function to add and set as active a AIPackage to a NPC, by the script under extends activemagiceffect.
The Package I need does exist, I found it. I juste need a way to add it to the akTarget.
User avatar
Svenja Hedrich
 
Posts: 3496
Joined: Mon Apr 23, 2007 3:18 pm

Post » Tue Jun 19, 2012 11:23 am

Welcome to a bug I've run into trying to do this exact thing.

The OnEffectFinish event seems to fire almost immediately instead of waiting out the spell duration. I haven't found a way around it myself.
User avatar
Lyd
 
Posts: 3335
Joined: Sat Aug 26, 2006 2:56 pm

Post » Tue Jun 19, 2012 8:55 am

No.

When I set up the unconsciousness on EffectStart, the NPC goes unconscious. Closed eyes, no talking.
When the effect finsihes, 15 sec later, the unconsciousness fades up.

The EffectStart and the EffectFinish work good in my case.

I heard that I have to use Aliases to give the NPC AiPackages, but I'm the hell not able to understand without a tutorial. And Bethesda's one is not clear enough for the Aliases (or I'm not intelligent enough, maybe.)

If someone is cute enough to do a step by step tuto to create aliases to add AiPackage in a script, I would be happy.
User avatar
Alisia Lisha
 
Posts: 3480
Joined: Tue Dec 05, 2006 8:52 pm

Post » Tue Jun 19, 2012 5:13 pm

Have you tried using the push force thing? like using PlaceAtMe() to place an invisible marker 5000 units over the NPC's head, then using InvisibleMarker.PushActorAway(NPC,20) - that should knock him down without knocking him head over heels, an if he's unconscious he shouldn't get up unti he wakes up. Adjust the 20 up or down until you get about the "fainting" effect you want.

Event OnEffectStart (Actor Target,Actor Caster) ; Whatever code makes Target unconscious  ObjectReference InvisibleMarker = Target.PlaceAtMe(InvisibleMarkerType,1)  InvisibleMarker.MoveTo(Target,0.0,0.0,5000.0)  InvisibleMarker.PushActorAway(Target,20.0)EndEvent
User avatar
Cheville Thompson
 
Posts: 3404
Joined: Sun Mar 25, 2007 2:33 pm

Post » Tue Jun 19, 2012 11:16 am

I am already using the pushactoraway. No need of the marker, I use Game.Getplayer().pushactoraway with a magntude of 0. The target simply falls on the ground.

But, no, even if I set him unconscious, he gets up, then stands up unconscious. That's why I want to add it a default sleeping package while he is "sleeping".

I'm still working on the Aliases, because before using them, I need to learn how it works, and for now, it's a "little bit" over what I am able to do safely on my own, with the dozens of options and checkboxes in it.
User avatar
Betsy Humpledink
 
Posts: 3443
Joined: Wed Jun 28, 2006 11:56 am

Post » Tue Jun 19, 2012 10:05 pm


I'm still working on the Aliases, because before using them, I need to learn how it works, and for now, it's a "little bit" over what I am able to do safely on my own, with the dozens of options and checkboxes in it.

Yeah, aliases are anything but self-explanatory, but here's the gist (only the gist, because I'm no expert)

1. Make a ReferenceAlias in your quest. Set it to "optional" that way the quest will be active even if this alias is not filled. Also, set to "re-use", so you can use it for more than one character.

2. When creating the ReferenceAlias, there is a spot for AI Packages. An actor that is assigned to the ReferenceAlias will assume the packages in this list, and prefer them over their own.

3. From any other script (with the new Reference Alias added to properties) use the ForceRefTo function to assign the Actor to the Alias.

e.g. YourRefAlias.ForceRefTo(YourActor)


This will assign "YourActor" to "YourRefAlias", and it will inherit the new AI

User avatar
ladyflames
 
Posts: 3355
Joined: Sat Nov 25, 2006 9:45 am

Post » Tue Jun 19, 2012 2:12 pm

In my script, the compilation fails, it says that ForceRefTo (and Clear, which I tried too) is not a recongnized function.
It may be because I'm on an extend activemagiceffect script, I presume.

Do I have to give the quest I created for the alias to the player, and script inside ?
User avatar
Sasha Brown
 
Posts: 3426
Joined: Sat Jan 20, 2007 4:46 pm

Previous

Return to V - Skyrim