How to knock unconscious without Essential effect

Post » Wed Jan 05, 2011 1:45 pm

I am creating a mod that will allow you to revive fallen companions as an alternative to setting them as essential. I have an alpha version of this mod working for ED-E, but with ED-E I can use a resurrect command to revive him without all of the associated animation problems since he doesn't have limbs or gibbets.

My problem is in expanding this mod to work on human companions. I'm told that I should avoid using resurrect but so far I haven't been able to make it work any other way.

In my failed test I did the following:

- set ED-E to essential
- added the following OnHit block to render ED-E unconscious if his health was reduced to 0
begin OnHit     if GetActorValue health <=0          SetUnconscious 1     endifend


When I then shoot ED-E to death he falls down but I am not allowed to activate him. Then when the essential timer runs down he pops back up, even though he is still set to unconscious by my script.

Can anyone provide some guidance on how to render companions unconscious when there health is reduced to 0 without invoking the essential knockout script? Thanks.
User avatar
Ilona Neumann
 
Posts: 3308
Joined: Sat Aug 19, 2006 3:30 am

Post » Wed Jan 05, 2011 11:48 pm

Down his fatigue (If robots have any) to keep him down.
User avatar
Amy Masters
 
Posts: 3277
Joined: Thu Jun 22, 2006 10:26 am

Post » Wed Jan 05, 2011 11:09 pm

Okay, knocking out ED-E with fatigue damage works (using DamageActorValue ). My problem now is that I can't activate the unconscious companion to trigger the repair messages. Is there a workaround for this?
User avatar
Sunnii Bebiieh
 
Posts: 3454
Joined: Wed Apr 11, 2007 7:57 pm

Post » Wed Jan 05, 2011 3:25 pm

If I were you I'd go with knocking them unconscious, and then move an invisible activator to them every frame, which is scripted to show the revive menu and stuff when you activate it.
User avatar
Nomee
 
Posts: 3382
Joined: Thu May 24, 2007 5:18 pm

Post » Wed Jan 05, 2011 12:36 pm

If I were you I'd go with knocking them unconscious, and then move an invisible activator to them every frame, which is scripted to show the revive menu and stuff when you activate it.


So there is no way to override the script that renders the unconscious actor un-activatable?
User avatar
Sxc-Mary
 
Posts: 3536
Joined: Wed Aug 23, 2006 12:53 pm

Post » Wed Jan 05, 2011 6:20 pm

How to knock unconscious without Essential effect


Check my SIG link for my Shock ammo mod.

The unconscious effect is done by dealing Fatigue damage; when they are out-cold they are listed as unconscious.

To knock them out, call 'damageav Fatigue' in your code instead of 'SetUnconscious'

damageav Fatigue 15000   ;[use your own number to tweak the duration of the sleep. 15000 is a good start] 


**Unconscious NPC's can still be further injured or killed while knocked out.
User avatar
Matt Bee
 
Posts: 3441
Joined: Tue Jul 10, 2007 5:32 am

Post » Wed Jan 05, 2011 11:17 am

This works on essential, unconscious actors that are 'killed' in the usual way without you having to do anything:

BEGIN ONActivateif (IsActionRef Player)	if (GetKnockedState == 1)	;There are times when this is unreliable if recovering from PushActorAway http://geck.gamesas.com/index.php/GetKnockedState		ShowMessage MyRessurectionMenu	else		Activate	endifendifEND


The problem with trying to catch low health in a OnHit or Gamemode block from my limited testing is that the game engine appears to intercept a 'death' before the script can do anything about it.
Something to note - in non-hardcoe mode, an actor set as player teammate is essential no matter what commands to turn if off that you throw at it. In hardcoe mode, you have the choice.
I use
Ressurect 0
in my FO3 mod as it works fine - I haven't tried it yet in NV.
User avatar
butterfly
 
Posts: 3467
Joined: Wed Aug 16, 2006 8:20 pm

Post » Wed Jan 05, 2011 11:46 am

This works on essential, unconscious actors that are 'killed' in the usual way without you having to do anything:


I'm making some progress on this: I can get the activation and menu system to work by checking GetKnockedState, as your code demonstrates. The problem I'm having now is getting the companion to stay down indefinitely. I'm at work atm so I can't cut and paste my exact code right now but basically it takes the following steps:


if GetKnockedState == 1 and fatigue > 0 (conditions that are only present when the actor is KO'd by health damage, not fatigue damage) then I apply modav fatigue -500 on each frame. This is to put the actor at negative fatigue indefinitely.

Except that, in practice, the actor gets up after two to three minutes and I have no idea why. It's like the actor is somehow recovering enough fatigue to get above 0 after a while, even though I'm continuously applying a negative fatigue modav.

I initially tried damaging fatigue to keep the actor down but I had similar results. Even though I was continuously applying fatigue damage, the actor would get up after several minutes.
User avatar
xemmybx
 
Posts: 3372
Joined: Thu Jun 22, 2006 2:01 pm

Post » Wed Jan 05, 2011 3:05 pm

doubleposted
User avatar
Budgie
 
Posts: 3518
Joined: Sat Oct 14, 2006 2:26 pm

Post » Thu Jan 06, 2011 12:52 am

I finally got my script working. Thanks for all of the help. Here is my addition to Veronica's script in case someone is trying to solve a similar problem.

When an essential actor is knocked out, the script sets a flag for either Incapacitated - when the actor is "killed" by health damage - or KO'd - when the actor is knocked out by fatigue damage. While incapacitated, the actor receives ongoing fatigue damage every frame until revived by a ShowMessage menu system. When KO'd, the actor recovers normally.

;sets companion to essential;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; BEGIN OnLoad	setessential 000e32aa 1 END; checks for knocked state and adds fatigue damage;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;BEGIN GameMode	set iKnockedState to GetKnockedState	if iIncapacitated == 1		;applies continuing fatigue damage to incapacitated actor		;--------------------------------------------------------------------------------------------------------------		set iFatigueDamage to GetAV fatigue		DamageAV fatigue iFatigueDamage		;--------------------------------------------------------------------------------------------------------------		;--------------------------------------------------------------------------------------------------------------								;handler for revive menu system		;--------------------------------------------------------------------------------------------------------------		set iButton to GetButtonPressed		if iMenu == 1	;handler for CompanionReviveLivingActivate			if iButton == 0	; handler for open inventory button											OpenTeammateContainer 1				set iMenu to 0							elseif iButton == 1	; handler for Examine Wounds button					if player.getav medicine >= 35 ;checks for sufficient Medicine skill					set iHaveRequiredMaterials to 0									if player.getitemcount 000cb05c >= 1 ;checks for doctor bag						if player.getitemcount 000ccef2 >= 1 ;checks for super stimpak							set iHaveRequiredMaterials to 1						endif					endif					if iHaveRequiredMaterials == 1						ShowMessage CompanionReviveLivingHaveTools						set iMenu to 4					else						ShowMessage CompanionReviveLivingNoTools						set iMenu to 3							endif				else					ShowMessage CompanionReviveLivingSkillTooLow						set iMenu to 2											endif			elseif iButton == 2	;handler for Leave button				set iMenu to 0																endif		elseif iMenu == 2	;handler for CompanionReviveLivingSkillTooLow			if iButton == 0				set iMenu to 0	;handler for Leave button			endif		elseif iMenu == 3	;handler for CompanionReviveLivingNoTools			if iButton == 0				set iMenu to 0	;do not perform the repairs			endif		elseif iMenu == 4 ; handler for CompanionReviveLivingHaveTools			if iButton == 0		;handler for Revive Button				set iMenu to 0				player.removeitem 000cb05c 1  ;removes doctor bag				player.removeitem 000ccef2 1   ;removes super stimpak				set iIncapacitated to 0				setunconscious 0				restoreav fatigue 100				resethealth				restoreav perceptioncondition 100				restoreav endurancecondition 100				restoreav leftattackcondition 100				restoreav leftmobilitycondition 100				restoreav rightattackcondition 100				restoreav rightmobilitycondition 100				if ( VNPCFollowers.bVeronicaHired == 1  )					set VNPCFollowers.nCurrentFollowers to VNPCFollowers.nCurrentFollowers + 1;					set vNPCFollowers.bCritterinParty to 1					set VNPCFollowers.bPlayerHasFollower to 1					set VNPCFollowers.bHumanoidInParty to 1;					player.AddPerk ScribeAssistant					ShowMessage FollowerMessagePerkVeronicaAdd									endif			else 				set iMenu to 0	;handler for Do Not Revive Button			endif		endif		;--------------------------------------------------------------------------------------------------------------		;--------------------------------------------------------------------------------------------------------------	else		;detects incapacitation due to health damage and applies effects one time		;--------------------------------------------------------------------------------------------------------------		if GetKnockedState == 1			set iFatigue to getav fatigue			;set iBaseFatigue to GetBaseActorValue fatigue			if iFatigue > 0	;this causes incap to occur only when KO was due to something other than fatigue damage								if iKOd == 0					ShowMessage bDebugIncap					set iIncapacitated to 1					;set iRevived to 2					setunconscious 1 				;setting unconscious causes companion to stand up when knocked out					damageav fatigue 1000000					if ( VNPCFollowers.bVeronicaHired == 1  )						set waiting to 1						set VNPCFollowers.nCurrentFollowers to VNPCFollowers.nCurrentFollowers - 1;						if (VNPCFollowers.nCurrentFollowers == 0)							set VNPCFollowers.bPlayerHasFollower to 0						endif						set VNPCFollowers.bHumanoidInParty to 0;						player.RemovePerk ScribeAssistant						ShowMessage FollowerMessagePerkVeronicaRemove								endif				endif			else				set iKOd to 1 			endif			endif		;--------------------------------------------------------------------------------------------------------------		;--------------------------------------------------------------------------------------------------------------	endif		 	;--------------------------------------------------------------------------------------------------------------		if iKnockedState == 0;these checks occur when the actor is awake		set iKOd to 0 ;resets iKOd to 0 when actor is awake		if iIncapacitated == 1			; if incapacitated actor is wakened by another script (player sleeping causes this, for instance) 			damageav fatigue 1000000 	; - this re-damages fatigue to keep the actor under		endif	endif	;--------------------------------------------------------------------------------------------------------------	;--------------------------------------------------------------------------------------------------------------END

User avatar
Celestine Stardust
 
Posts: 3390
Joined: Fri Dec 01, 2006 11:22 pm


Return to Fallout: New Vegas