Making NPC ignore attacks and stay sitted

Post » Sun Nov 18, 2012 12:04 am

I'm trying to do something very specific. I need an Actor to stay sited and ignore all combat, even if he dies in the process.

I set up a package with the Sit template and the flags "Ignore combat" and "No combat alert" on. When I hit him, he gets up from the chair, the red dot in the compass appears, the health bar appears and he sits down again. After that, he doesn't get up again if I keep hitting him, which is the intended behavior.

If I call StopCombat() and StopCombatAlarm() functions, the red dot and the health bar disappears. If I hit him again after that, he gets up again and the above behavior repeats.

Is there a way for the actor to truly ignore combat. It seems that flag on the package still makes the actor change states to combat and he still gets up when that state changes, even though he doesn't fight.

Any ideas to do what I need?
User avatar
James Hate
 
Posts: 3531
Joined: Sun Jun 24, 2007 5:55 am

Post » Sat Nov 17, 2012 4:28 pm

have you tried SitTarget instead of sit?

i believe sitTarget will force them to stay in the furniture regardless of actions.
User avatar
Cassie Boyle
 
Posts: 3468
Joined: Sun Nov 05, 2006 9:33 am

Post » Sat Nov 17, 2012 6:25 pm

I get the same behavior with SitTarget, although I've been able to solve this with the function SetRestrained(). This is probably what anyone searching for this thread would need. I still have an issue with it but I'll start a new thread.
User avatar
Jodie Bardgett
 
Posts: 3491
Joined: Sat Jul 29, 2006 9:38 pm

Post » Sun Nov 18, 2012 1:54 am

Can you just disable the NPC's AI altogether with a script? Once he's sitting, turning off the AI should make sure he stays sitting for all eternity.

Self.EnableAI(0) may be your best friend here.
User avatar
Taylor Thompson
 
Posts: 3350
Joined: Fri Nov 16, 2007 5:19 am

Post » Sun Nov 18, 2012 12:08 am

I want to do the samething as the OP so would I need to write a script using Self.EnableAI(0) or could it be done via NPC AI settings?
User avatar
Mari martnez Martinez
 
Posts: 3500
Joined: Sat Aug 11, 2007 9:39 am

Post » Sun Nov 18, 2012 1:33 am

I Tried using SetRestrained as a flag on the AI Package but didn't seem to get any progress so instead I decided to use a script and attach it to whatever furniture item the actor was linked to. But it's early days for me and scripting so could someone please give me a pointer where I am going wrong.

Scriptname StayPut extends ObjectReference  {Make sure the actor stays in the postion given}Import Game  Import Utility  Actor Property Prisoner AutoEvent OnLoad()	ObjectReference ActorREF = GetLinkedREF()	Prisoner = ActionREF.GetActorBase()	Prisoner.SetRestrained() 		 EndEvent  
User avatar
Rinceoir
 
Posts: 3407
Joined: Thu Jun 29, 2006 1:54 am

Post » Sat Nov 17, 2012 11:25 pm

Have a look at the Actor's Ai-Data (aggression, aggro-radius and things).

If something is beating on him/her that will all kick in.

(I think there is also an Ignore Flag, somewhere ... but that maybe only for "Friendly hits"?)


So restraining a very cowardly NPC does not seem to work ... They run away. So - when I wanted to do almost the same thing - I gave the restrained NPC a package with the OVERIDE Flag checked that makes the NPC ignore it's AI-Data stuff (and so does not run away).

(You have to becareful though ... once done an npc will just sit there and get bashed to death if you let it happen) :wink:
User avatar
Sarah Knight
 
Posts: 3416
Joined: Mon Jun 19, 2006 5:02 am

Post » Sat Nov 17, 2012 5:45 pm

Unless I'm not setting somethng right in the AI Template package I think a script is the only way to go. I have no problem getting them to stand there and take a beating the problem is the NPC standing up when they are supposed to be in the BoundCaptiveMarker position.

Despite having flags Ignore Combat and No Combat alert flags set I still get the red dot/health bar, good thing is they won't fight.

Something interesting I have been testing this NPC out using the BoundCaptiveMarker , but if you go and bash someone linked to the ShackleWallMarker they do stay in position until health is very low.
User avatar
Rachie Stout
 
Posts: 3480
Joined: Sun Jun 25, 2006 2:19 pm

Post » Sat Nov 17, 2012 4:56 pm

Unless I'm not setting somethng right in the AI Template package I think a script is the only way to go. I have no problem getting them to stand there and take a beating the problem is the NPC standing up when they are supposed to be in the BoundCaptiveMarker position.

Despite having flags Ignore Combat and No Combat alert flags set I still get the red dot/health bar, good thing is they won't fight.

Something interesting I have been testing this NPC out using the BoundCaptiveMarker , but if you go and bash someone linked to the ShackleWallMarker they do stay in position until health is very low.
If you get the red dot, it means that NPC has flagged the player as an enemy (it is reacting to it, even if it's packages and flags stop it doing much at all). The standing you see is probably the NPC going into "alert" mode.

What you may be able to do - it depends exactly what you are trying to achieve, I guess? - is to temporary add the "captive" to a faction that is friends with the player (or with an NPC doing the bashing). Then flag the "captive" to ignore friendly hits ... that might stop it jumping up?

(and interesting, I have only used the Wallshackles when I attempted this and what I described above worked ... well enough for my needs, anyway ... I have not tried with the BoundCaptiveMarker, but I would have thought the two would function the same?)
User avatar
vanuza
 
Posts: 3522
Joined: Fri Sep 22, 2006 11:14 pm

Post » Sat Nov 17, 2012 4:29 pm

DA02 (Boethiahs Calling) has a pillartrap scene which is in fact an advanced sit operation and it works I think using a combination of Scene Package override and SetGhost. Might try taking a look at what that quests scripts do.
User avatar
Nims
 
Posts: 3352
Joined: Thu Jun 07, 2007 3:29 pm

Post » Sun Nov 18, 2012 4:20 am

Thats a scary object, we had a thread on that earlier there is something really wrong with the object boundaries. Wanted to have it in my mod but I ended up taking it out.

H4vent, I made my own faction up and stuck all the captives in it, set them to allies with the player faction, it works for about 4 hits until they get upset and then enter combat. I can set iAllieHitNonCombatAllowed to say 20 as a game settings but that means it becomes global for the whole game, and I'm just too dumb to know what to put in a script instead.

I posted another try in quick questions and answers but no takers yet.

Really would like to get this sorted it's the last bit of fool proofing for the mod and then I can leave it in my game for long term testing. If it was just for me I would leave it like it is but I was thinking of uploading it to Nexus (That will be a first in itself).
User avatar
Marine Arrègle
 
Posts: 3423
Joined: Sat Mar 24, 2007 5:19 am

Post » Sat Nov 17, 2012 5:12 pm

Thats a scary object, we had a thread on that earlier there is something really wrong with the object boundaries. Wanted to have it in my mod but I ended up taking it out.

H4vent, I made my own faction up and stuck all the captives in it, set them to allies with the player faction, it works for about 4 hits until they get upset and then enter combat. I can set iAllieHitNonCombatAllowed to say 20 as a game settings but that means it becomes global for the whole game, and I'm just too dumb to know what to put in a script instead.

I posted another try in quick questions and answers but no takers yet.

Really would like to get this sorted it's the last bit of fool proofing for the mod and then I can leave it in my game for long term testing. If it was just for me I would leave it like it is but I was thinking of uploading it to Nexus (That will be a first in itself).
I'm not at all sure you can sort it.

When I did it I was satisfied that my torturer could whack his victims a couple of times (as an ally of himself) before the scene I had setup kicked in ...

... If you want to keep whacking the victim, then eventually the NPC is going to kick-off ... because as you say, there is a Game-Limit on Friendly Hits being ignored and once that setting is reached the NPC will defend itself (as set in it's AI Data).

Somewhere, in hardcoded land, there is a function we can't get at ... Everything defends itself - even if that is only running away - and there doesn't seem to be anything we can do to change that fact (other than set our games to ignore countless friendly hits).

So ... Can you lessen the amount of abuse your victim is getting?
User avatar
Horse gal smithe
 
Posts: 3302
Joined: Wed Jul 05, 2006 9:23 pm

Post » Sat Nov 17, 2012 7:47 pm

Winner! I got it sorted.

So I made my own faction up stuck all the prisoners in the faction and set that faction as Allies with the Player Faction.
I have to remind myself that the scripts are extentions so my script using SetIgnoreFriendlyHits(1) ended up very small indeed. (then I find there is a bloody default one that say's the same thing, re-invented the wheel!)
I attached the script to the Base Actor and, you can now beat on them all day long, their even nice to you while you do it.
User avatar
Melung Chan
 
Posts: 3340
Joined: Sun Jun 24, 2007 4:15 am

Post » Sat Nov 17, 2012 6:19 pm

Well done :smile:

I'll have to take a look at that DefaultScript (I didn't know there was one, either) ... sounds like I can make my torturer-guy have a bit more fun before I kick off my scene

thx for updating the topic :smile:
User avatar
Beat freak
 
Posts: 3403
Joined: Thu Dec 14, 2006 6:04 am


Return to V - Skyrim