Jump to content

[Script]Player Essential


Mailamea

Recommended Posts

Posted

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.

Posted

You need to tell the game to resurrect you then decrease your health down to 15%.

 

I will take a look at this for you and see what I come up with. :)

 

Yeah but I don't know scripting stuff with geck that well. only basics

Posted

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.

Posted

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

Posted

 

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.

Posted

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.

Posted

You may want to also run either of the following

ApplyImageSpaceModifier FadeInFromBlack2sISFX
ApplyImageSpaceModifier FadeInFromBlack4sISFX

so you fade back in from black.

Posted

You may want to also run either of the following

ApplyImageSpaceModifier FadeInFromBlack2sISFX
ApplyImageSpaceModifier FadeInFromBlack4sISFX

so you fade back in from black.

 

where do i insert it in the script? what line?

Posted

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.

Posted

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.

Posted

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.

  • 6 months later...
Posted

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

Posted

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
Posted

Its the script dogface helped me with, but its missing, i got this to work but since the reformat of my computer i forgot how i made it work.

 

Ill try what you wrote.

Posted

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.

Posted

i did not really verified the command flow. You should move the next to last endif just above the last one for the condition to make sense. :)

Posted

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.

Posted
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.

 

Posted

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.

Posted

NPC.DamageAV Fatigue AVeryBigNumber, though the maximum practical value looks to be around 950.

(see BoxingGlovesFatigueOnHitScript, a vanilla script from FalloutNV).

 

If Fatigue gets negative, the NPC drops. http://fallout.wikia.com/wiki/Fatigue

 

So once KO, an NPC will wait 30s then get back up, unless you keep damaging it.

 

Posted

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....

 

Posted

Thanks. Ill be testing this out tomorrow. If this works we actually replicated arwens one life script.

Archived

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

  • Recently Browsing   0 members

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