Jump to content

[Script]Player Essential


Mailamea

Recommended Posts

I need a little bit of help with scripting.

 

I found something for fallot3/NV/TTW that will stop you from using saves.

When your PC dies he/she will go unconscious and wake up. Arwen's One Life does something like this but as of now its very buggy and crash heavy.

 

Here's what I've found.

 

1. Setting player character as essential works.... BUT player character will remain lifeless on the ground.

WHY? - because you have no health, even giving the player character health via console command won't work

 

2. Setting the character un-unconsious(lol) via console command, player.unconscious 0 won't work, since you wake up but don't have the health so you are still life less.

 

3. In order for this to work. I need I script.

 

Here's what the script should do.

-Check the PlayerCharacter's Health

if PCHealth is 5%

then playercharacter = forced unconscious

(if possible) play fadetoblackfx [player's vission goes black]

ammount of time passed blah blah

playercharacter unconscious 0

set health 15% [players health after waking up]

 

For now its this simple to keep game from crashing.

If this is successfull, then we can add negative effects, like you keep your crippled limbs, you are more hungry/thristy, some items are looted [although this is already implemented in the vanilla game if you died on unconscius state human type npc loot boodies as well as you], caps lost, stat reductions, penalties, etc. etc.

Link to comment

float fHealthGain

float fTimer

 

begin gamemode

 

if player.getav health <= (player.getpermav health / 20)

player.setunconscious 1

imod FadeToBlack9sISFX

set fTimer to getsecondspassed

endif

 

if player.getunconscious == 1

 

if fTimer < 15

set fTimer to fTimer + GetSecondsPassed

else

set fHealthGain to (player.getpermav health / 20) * 3

player.modav health fHealthGain

player.setunconscious 0

set timer to 0

endif

 

end

 

Will need testing, obviously. But it might work.

Link to comment

 

float fHealthGain

float fTimer

 

begin gamemode

 

if player.getav health <= (player.getpermav health / 20)

player.setunconscious 1

imod FadeToBlack9sISFX

set fTimer to getsecondspassed

endif

 

if player.getunconscious == 1

 

if fTimer < 15

set fTimer to fTimer + GetSecondsPassed

else

set fHealthGain to (player.getpermav health / 20) * 3

player.modav health fHealthGain

player.setunconscious 0

set timer to 0

endif

 

end

 

Will need testing' date=' obviously. But it might work.

 

[/quote']

 

Hey dogface thanks :)

lol one questions where do i attach the script? rofl

 

Might be worth looking at Oblivion COBL death handling. Many if not all of these (same) issues are addressed and scripted round in there.

 

If this one doesnt work as planned i guess i will look at it. Hopefully my brain doesn't explode with all the scripting.

Link to comment

Make a quest, set it as startgame enabled and set the quest delay to 0.1

 

Attach the script to that and it'll run constantly checking for player-"death".

 

oh, and add an "&& player.getunconscious == 0" to the first if that checks your health so it doesn't keep resetting the timer.

Link to comment

That should go somewhere in the if/endif block that wakes the player up when the timer's run out. Stick it somewhere next to the player.setunconscious 0.

 

Also, as dogface did in his original script, you can substitute the shorthand version of ApplyImageSpaceModifier which is imod so the lines can also be written as:

imod FadeInFromBlack2sISFX
imod FadeInFromBlack4sISFX

Use only one of those two... the difference is that the one with 2s takes 2 seconds to fade in, the one that has 4s takes 4 seconds.

Link to comment

One question, if the player 'died' while in the water, wouldn't that basically dump the player in a situation, somewhere in the game world, where the player gets stuck ?

 

I know it seems like an obvious thing to just avoid doing as a player, but figured may as well bring it up incase there is some way to deal with it, such as prehaps giving a water breathing effect for 30s or so after a drowning death.

Link to comment
  • 6 months later...

Not to necro the thread, but i forgot how i got it to work lol.

 

Can someone check if the script structure is correct?

 

 

float fHealthGain
float fTimer

begin gamemode

 

&& player.getunconscious == 0
if player.getav health <= (player.getpermav health / 20)
player.setunconscious 1
imod FadeToBlack9sISFX
set fTimer to getsecondspassed
endif

if player.getunconscious == 1

if fTimer < 15
set fTimer to fTimer + GetSecondsPassed
else
set fHealthGain to (player.getpermav health / 20) * 3
player.modav health fHealthGain
player.setunconscious 0

imod FadeInFromBlack2sISFX

set timer to 0
endif

end

 

 

Thank you

Link to comment

Is this a copy/paste of your actual script ?

 

Strange, because you start with the second half of an If structure. Plus there is another either redundant or incomplete if structure in the second part.

I would interpret it as:

float fHealthGain

float fTimer
begin gamemode

 

 

 

if player.getunconscious == 0

 if player.getav health <= (player.getpermav health / 20)

   player.setunconscious 1

   imod FadeToBlack9sISFX

   set fTimer to getsecondspassed

 endif

endif
if player.getunconscious == 1
 if fTimer < 15

   set fTimer to fTimer + GetSecondsPassed

 else

   set fHealthGain to (player.getpermav health / 20) * 3

 endif

 player.modav health fHealthGain

 player.setunconscious 0

 

  imod FadeInFromBlack2sISFX

 

  set timer to 0

endif
end
Link to comment

You were onto it the first time I think.

 

Using the console...

 

setessential 7 1

Makes the player essential and go unconscious instead of dying.

 

To get back up it's player.setunconscious 1

followed by player.setunconscious 0

 

and they'll get back up as normal.

Works perfect in FO3. Makes the character endlessly spin around in NV for some inexplicable reason.

Link to comment

You were onto it the first time I think.

 

Using the console...

 

setessential 7 1

Makes the player essential and go unconscious instead of dying.

 

To get back up it's player.setunconscious 1

followed by player.setunconscious 0

 

and they'll get back up as normal.

Works perfect in FO3. Makes the character endlessly spin around in NV for some inexplicable reason.

That eliminates the purpose, the purpose was to create a plugin that does that , so there is no need for typing. Dang i really forgot what i did to dogface's script that made it work.

Link to comment
float fHealthGain
float fTimer

begin gamemode
	if player.getunconscious == 0
		if player.getav health <= (player.getpermav health / 20)
			player.setunconscious 1
			imod FadeToBlack9sISFX
			set fTimer to getsecondspassed
		endif
	endif

	if player.getunconscious == 1
		if fTimer < 15
			set fTimer to fTimer + GetSecondsPassed
		else
			set fHealthGain to (player.getpermav health / 20) * 3
			player.modav health fHealthGain
			player.setunconscious 0
			imod FadeInFromBlack2sISFX
		endif
	endif
end

This is what I meant.

 

Link to comment

AWESOME AWESOME AWESOME, IT WORKS!

 

But jaam do you have any ideas how to add a knockdown effect to the script?

 

if player.getav health <= (player.getpermav health / 20

"insert knockdown"

player.setunconscious 1

 

because with the current script the player gets unconscious but the player will be standing still.

Link to comment

Now, I forgot that you are targetting the player, I cannot it is going to work for him, but it looks like it was used in Fallout 3, so hopefully yes.

 

 

float fHealthGain
float fTimer
begin gamemode
 if player.getunconscious == 0
  if player.getav health <= (player.getpermav health / 20)
   player.DamageAV Fatigue 10000
   ; Possibly required so player stays KO. Test if it does not work without it
   ; DisableplayerControls
   player.setunconscious 1
   imod FadeToBlack9sISFX
   set fTimer to getsecondspassed
  endif
 endif
 if player.getunconscious == 1
  if fTimer < 15
   set fTimer to fTimer + GetSecondsPassed
  else
   set fHealthGain to (player.getpermav health / 20) * 3
   player.restoreAV Fatigue 15
   player.modav health fHealthGain
   player.setunconscious 0
   imod FadeInFromBlack2sISFX
   ; if disabled earlier
   ; EnableplayerControls
  endif
 endif
end

 

Totally untested of course....

 

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use