Paralyzing a NPC via script ?

Post » Wed Jun 20, 2012 7:27 am

Here's my script so far, it's a simple knock-out mace for thieves.

I never put my hands of spells with Papyrus, i totally failed with " cast " so what should i use to paralyze the target ?

Thanks


Scriptname drkKnock extends activemagiceffect  Spell property Paralyze autoEvent OnEffectStart(Actor akTarget, Actor akCaster)If (Game.GetPlayer().IsSneaking() == true)Game.GetPlayer().PushActorAway(akTarget, 0)akTarget.SetUnconscious()Paralyze.Cast(akTarget) < failed hardUtility.Wait(25)endIfEndEventEvent OnEffectFinish(Actor akTarget, Actor akCaster)akTarget.SetUnconscious(false)EndEvent
User avatar
Mr. Ray
 
Posts: 3459
Joined: Sun Jul 29, 2007 8:08 am

Post » Wed Jun 20, 2012 9:59 am

?
User avatar
Ice Fire
 
Posts: 3394
Joined: Fri Nov 16, 2007 3:27 am

Post » Wed Jun 20, 2012 3:05 am

Paralyze.Cast(Game.GetPlayer(), akTarget)
User avatar
Breautiful
 
Posts: 3539
Joined: Tue Jan 16, 2007 6:51 am

Post » Wed Jun 20, 2012 6:39 am

Thank you sir.

Another question, is this possible to make a body unlootable ?

Because i'm messing with the resurrect function, and sadly when a NPC is ressurected, his inventory too.
User avatar
lisa nuttall
 
Posts: 3277
Joined: Tue Jun 20, 2006 1:33 pm

Post » Wed Jun 20, 2012 1:12 am

You could try calling BlockActivation() on the NPC... But then you wouldn't be able to talk to him/her either.
User avatar
Jeneene Hunte
 
Posts: 3478
Joined: Mon Sep 11, 2006 3:18 pm

Post » Wed Jun 20, 2012 11:27 am

BlockActivation worked like a charm, thank you !

Well, i must admit it's sad that players can't loot knocked-out NPC's ( in my mod ) but sadly i don't know another way to fix this.

An exemple :

Player knock a random NPC out, in the script the NPC is now set as dead, so the player can move the ragdoll, interact with it ( only way i found to do this ) for 60 seconds. After 60 seconds, in the script the NPC is now set as resurrected, so he gets up, and get all his stuff back ( because it's how resurrection work with Bethesda ).

Problem is :

1. The player can easily glitch and knock the NPC like 10 times to have almost infinite items since they come back.
2. Seeing a naked body suddenly reappear with all his clothes back kinda ruin the thing.

So the only fix i found was to block the loot. And it works thanks to RandomNoob.

But if someone knows a way to " really " fix this, and still be able to loot, would be awesome.

Sorry for the poor english.
User avatar
GLOW...
 
Posts: 3472
Joined: Thu Aug 03, 2006 10:40 am

Post » Tue Jun 19, 2012 11:33 pm

just before you trigger the resurrection, use NPC.RemoveAllItems(ResurectionSaveContainer) to store any unlooted items in a hidden container used only for this purpose, then after you trigger the resurrection, you could use RemoveAllItems() (no passed variable, so it destroys the items), then do ResurrectionSaveContainer.RemoveAllItems(NPC) to return the saved items to the NPC.

Only drawback is, the NPC may not put the restored items on right away.
User avatar
Kat Stewart
 
Posts: 3355
Joined: Sun Feb 04, 2007 12:30 am

Post » Wed Jun 20, 2012 12:39 am

It seems to work partially, the NPC is naked etc but sadly got some trouble compiling " ResurrectionSaveContainer.RemoveAllItems(NPC) " like you said.

(19,14): RemoveAllItems is not a function or does not exist


Scriptname drkKnock extends activemagiceffect  ImageSpaceModifier Property GetHit  AutoContainer Property drkSavedItems  Auto  Event OnEffectStart(Actor akTarget, Actor akCaster)If (Game.GetPlayer().IsSneaking() == true)GetHit.Apply(2.0)Game.GetPlayer().PushActorAway(akTarget, 2)Utility.Wait(1)AkTarget.KillSilent()Utility.Wait(20)Debug.SendAnimationEvent(akTarget, "GetUpStart")Utility.Wait(4)AkTarget.RemoveAllItems(akTarget, drkSavedItems)AkTarget.Resurrect()AkTarget.RemoveAllItems()drkSavedItems.RemoveAllItems(akTarget)Utility.Wait(1)Debug.SendAnimationEvent(akTarget, "DrunkStart")Utility.Wait(10)Debug.SendAnimationEvent(akTarget, "DrunkStop")Game.GetPlayer().PushActorAway(akTarget, 3)endIfEndEvent
User avatar
jadie kell
 
Posts: 3497
Joined: Sat Jul 29, 2006 3:54 pm

Post » Wed Jun 20, 2012 12:03 am

Try casting it as an ObjectReference.

And you don't pass it the thing it's called on, just where the items are supposed to go.

AkTarget.RemoveAllItems(AkTarget,drksavedItems) would put all the items right back in the NPC. And that shouldn't work anyway, since the second parameter should be a boolean ( since it exists, it evaluates as "True")
after the wait, it should be:

AkTarget.RemoveAllItems(DrkSavedItems)

then later,

(DrkSavedItems as ObjectReference).RemoveAllItems(AkTarget); to put them back after destroying the re-spawned items.

maybe?
User avatar
Claudz
 
Posts: 3484
Joined: Thu Sep 07, 2006 5:33 am

Post » Wed Jun 20, 2012 5:49 am

I don't even know how :blush: .
User avatar
Lynette Wilson
 
Posts: 3424
Joined: Fri Jul 14, 2006 4:20 pm

Post » Wed Jun 20, 2012 4:21 am

I edited and showed ya.

Oh, and make sure that you actually have said container out there somewhere of course...heh.
User avatar
Vickytoria Vasquez
 
Posts: 3456
Joined: Thu Aug 31, 2006 7:06 pm

Post » Wed Jun 20, 2012 3:14 am

cannot cast a container to a objectreference, types are incompatible
User avatar
Melis Hristina
 
Posts: 3509
Joined: Sat Jun 17, 2006 10:36 pm

Post » Wed Jun 20, 2012 9:39 am

Well sadly this container business does not seems to work.

Have to reblock the activation, sadly.
User avatar
Daramis McGee
 
Posts: 3378
Joined: Mon Sep 03, 2007 10:47 am

Post » Wed Jun 20, 2012 1:08 pm

Oh, it works, you just need to define your container as an Objectreference, and pick it in the render window wherever you placed it. Apparently defining it as a http://www.creationkit.com/Container_Scriptmakes it completely useless (note the utter lack of any functions, events, or anything of any use whatever.)
User avatar
Epul Kedah
 
Posts: 3545
Joined: Tue Oct 09, 2007 3:35 am

Post » Wed Jun 20, 2012 12:31 am

Container is just a class to manipulate the container object or to detect if an object is in container class. If you add some properties or function in "Container.psc", recompile it, all your container can have these properties/function if you cast them as container after.

I didn't find yet the real use to add something to a class but it's possible, I tried quickly with Weapon class and it works more or less.
User avatar
Celestine Stardust
 
Posts: 3390
Joined: Fri Dec 01, 2006 11:22 pm

Post » Wed Jun 20, 2012 3:16 am

So yeah, this time the compilation worked, but it has no effect ingame. The NPC is back with the same items as before.

Don't know why.


Scriptname drkKnock extends activemagiceffect  ImageSpaceModifier Property GetHit  AutoSound Property WPNImpactBluntVsFlesh  AutoObjectReference Property drkSavedItems  Auto  Event OnEffectStart(Actor akTarget, Actor akCaster)If (Game.GetPlayer().IsSneaking() == true)WPNImpactBluntVsFlesh.Play(Game.GetPlayer())GetHit.Apply(4.0)Game.GetPlayer().PushActorAway(akTarget, 3)AkTarget.KillSilent()Game.GetPlayer().PushActorAway(akTarget, 0)Utility.Wait(1)Game.GetPlayer().PushActorAway(akTarget, 0)Utility.Wait(1)Utility.Wait(60)Debug.SendAnimationEvent(akTarget, "GetUpStart")Utility.Wait(4)AkTarget.RemoveAllItems(DrkSavedItems)AkTarget.Resurrect()(DrkSavedItems as ObjectReference).RemoveAllItems(AkTarget)Utility.Wait(1)Debug.SendAnimationEvent(akTarget, "DrunkStart")Utility.Wait(10)Debug.SendAnimationEvent(akTarget, "DrunkStop")Game.GetPlayer().PushActorAway(akTarget, 3)endIfEndEvent
User avatar
Eve Booker
 
Posts: 3300
Joined: Thu Jul 20, 2006 7:53 pm

Post » Wed Jun 20, 2012 11:15 am

I do wonder what made them switch back to the Morrowind-style resurrect command instead of Oblivion's version (which would allow you to resurrect that instance of an NPC only, and not respawn it).
User avatar
priscillaaa
 
Posts: 3309
Joined: Sat Dec 30, 2006 8:22 pm

Post » Tue Jun 19, 2012 9:08 pm

Don't know why indeed.

So yeah, the SavedItems container works well, it saves items, but the NPC are still back with full items like nothing happened i don't know why.

Damn.
User avatar
Chenae Butler
 
Posts: 3485
Joined: Sat Feb 17, 2007 3:54 pm

Post » Wed Jun 20, 2012 1:04 am

Try adding another RemoveAllItems() in there:

AkTarget.RemoveAllItems(DrkSavedItems)AkTarget.Resurrect()AkTarget.RemoveAllItems()(DrkSavedItems as ObjectReference).RemoveAllItems(AkTarget)
User avatar
Leticia Hernandez
 
Posts: 3426
Joined: Tue Oct 23, 2007 9:46 am

Post » Wed Jun 20, 2012 3:05 am

You forgot a line. After the ressurect, you need to use this:

akTarget.RemoveAllItems()

before reloading the saved items from your save barrel..
User avatar
Sun of Sammy
 
Posts: 3442
Joined: Mon Oct 22, 2007 3:38 pm

Post » Wed Jun 20, 2012 6:54 am

God damnit i'm [censored].

Thank you very much.
User avatar
jessica Villacis
 
Posts: 3385
Joined: Tue Jan 23, 2007 2:03 pm

Post » Wed Jun 20, 2012 7:21 am

So yeah the script is working fine. A small video :

http://www.youtube.com/watch?v=_lKoSP885KA&feature=player_embedded

There's still some rough edges, like the [censored] resurrect fade effect ( once the NPC has played the GetUp animation he get respawned, and as you can see it's not very fluid, we can see the transition ) but otherwise i think it's pretty decent.

Thanks again Redwood and Randomnoob.
User avatar
Jason Wolf
 
Posts: 3390
Joined: Sun Jun 17, 2007 7:30 am

Post » Wed Jun 20, 2012 4:24 am

I wonder if other NPCs will react to him being nvde like they do when you run around in the buff?
User avatar
Lisa Robb
 
Posts: 3542
Joined: Mon Nov 27, 2006 9:13 pm

Post » Wed Jun 20, 2012 2:10 am

No idea !

I was in tdetect off, for recording purpose, but i will give it a try in " legit " conditions.

Anyway, i'm 100 % sure that the NPC's are reacting to a knocked out corpse like they would do with a dead corpse, because i've seen that in action. Pretty cool side effect actually :smile: .
User avatar
Stacyia
 
Posts: 3361
Joined: Mon Jul 24, 2006 12:48 am

Post » Wed Jun 20, 2012 8:26 am

Hmmm, seems everyhing is not truely fixed.

If i knock a NPC out, and if i don't take anything in his inventory, he will resurrect naked for some reason :stare: .

Grmrmrmflfppfpffffuuu.
User avatar
Shae Munro
 
Posts: 3443
Joined: Fri Feb 23, 2007 11:32 am

Next

Return to V - Skyrim