Jump to content

Need help with simple 'near death' script


africanwarhead

Recommended Posts

Hi,

 

I need help with a very simple script (might open doors to an interesting mod). I'd imagine it would go like this:

 

class Gameplay

{

 

player.onHit

{

if (player.incomingDamage > player.gethealth)

{

player.incomingDamage = 0;

player.sethealth = 1;

}

// and another loop for damage?

}

}

 

I'm busy experimenting with all new mods and some of my own. I use the console 'Godmode' to avoid long loading times and the reloading screen is boring to look at when you're busy having fun. However, I still prefer to be able to witness health degradation, limb-damage and all that, but not entirely dying.

 

Besides that, to me it would feel more immersive because... well... I've never come back from the dead before... you? Such a mod could be expanded that while you're lying there unconscious, crippled, bleeding, you could get looted, raped or whatever, then picked up by traders or strangers, get fixed up by them, or made a slave, or whatever... but never dying. You could even make it lore-friendly, that you get saved by some main character and while you recover, you talk to this character and get another quest. And when you are back, healthy, you can go look for the bastards that robbed you. To me, that sounds a lot more entertaining than a silly reloading screen.

 

Can anyone help me make a script that prevents the character's HP going below 1, thus suffering horrendously, but not dying haha. Like essential companions, for example. I do have programming and scripting experience, as you can see in the conversation below, I am learning but I'm not entirely familiar with the keywords and syntax of the GECK. Oh and please tell me where to put it, I'd like to learn these things.

 

thanks in advance.

 

Cheers

AW

Edited by africanwarhead
Link to comment
Share on other sites

I wonder if you can just set the player as essential?

 

yeah I wonder that too. I read that the code was:

 

setessential <base_id> 1 (or 0)

 

but I tried this in the console, clicking on myself in 3rd person, but the code I'm giving for my PC is wrong. Something about wrong reference to Actor Data or something. You find anything?

Link to comment
Share on other sites

Uh, Well, Geck script is not C

 

scn somescriptname

if player.getav health =< 1

player.modav health 1

endif

 

Would be a little closer, problem is once a player goes below 1 health he is going to already be dead and boosting his health up is not going to change that fact.

Link to comment
Share on other sites

Uh, Well, Geck script is not C

 

scn somescriptname

if player.getav health =< 1

player.modav health 1

endif

 

Would be a little closer, problem is once a player goes below 1 health he is going to already be dead and boosting his health up is not going to change that fact.

 

cool cool, thanks. So what do you recommend? 5? 10?

plus, where do I plug this script? if its a long story, then please hook me up with some keywords, i'll google it

Link to comment
Share on other sites

Well, it has to be enough so that the next hit can't kill you...

 

Given a mine right to the face, thats over half your HP. Im really not sure how to pull off the effect you want. Keeping the player locked at full hp will at least allow cripples and prevent infinite ammo from TGM...

 

As far as where to put the script... Hmmm. Not really sure. Last time I wanted a script to run all the time on the player I had some mess with an activator that had a quest script to move it around to follow the player.. really messy.. a token item would be better but im not sure if you can place hidden token items on the player like you can on NPC's (Unplayable armor item with all body slots unchecked and 0DT)

Link to comment
Share on other sites

... a token item would be better but im not sure if you can place hidden token items on the player like you can on NPC's (Unplayable armor item with all body slots unchecked and 0DT)

 

so one might have to intercept the damage before it is removed from the HP. Let me try it out with some basic armor. I've got this mod called 'speed glasses' and 'Cheat Boy'. Lets see if I can take those scripts apart.

Link to comment
Share on other sites

As far as where to put the script... Hmmm.

 

Yo, so I'm fooling around with this. Seems that if you do a GameMode block script, that it needs no attaching to anything. Just save it in GECK. Works like a charm.

 

As for the script, you're right, the HP can be shifted around, but one fat blow and you're done for. Player.GetDead in combination with Player.resurrect doesn't work either. The Editor 'Player' instance can be set to 'essential' but that has no effect in the game.

 

So I need a way to intercept the damage before it is removed from the HP. Any ideas?

Link to comment
Share on other sites

christ! how hard must it be to find something as simple as intercepting incoming damage? I cannot find anything. The only thing I can find is 'Destructible Object Stages' and the explanation is very sloppy...

 

Later:

 

okay I managed to do the following.

1- setessential 7 1 does work, but you don't wake up again. The 'setessential' code only works in the console, not through the script.

2- the essential checkbox in the GECK NPC player form has no effect.

3- tried to do a GameMode block if player.getunconscious 1... doesn't even recognise it (trust me, I've tested it, I debug C# and JAVA. Getunconscious is a valid code and passed the mysterious GECK debug system. There's a trick that you can do through the console. setunconscious 1 and then back to 0 and then you wake up. But to do this through scripts in the GECK, first I need to convince the bloody engine that the player is unconscious so that I can run that bloody script! Nope, nothing. no debug messagebox to sooth my programming frenzy)

4- so to hell with that, left essential mode and tried OnHit blocks with getlasthitcritical == 1... you would suppose that you'd die from the last critical hit. Apparently they mean something else with it because the condition was not passed. Sigh...

5- and a couple of other hopeless attempts

 

AAHH! I must give up. I'm too used to clear-cut coding (C#, C++) and I grow very impatient with this scrapyard type scripting. Its such a waste of time to try and work with a patchwork coding system that has little consistency across its definitions and keywords, and moreover do not provide good explanations of them :P I mean, if you have 3 different definitions for 'unconscious' (companion unconscious, player unconscious and then some 'PlayerUnconscious') plus some other variants (like sleep), that's just ad-hoc programming... and then don't bother to explain it somewhere? that's just lazy.

 

If anyone out there knows how to do it, enlighten me. I still think its a fun idea.

 

Back to the wasteland!

Edited by africanwarhead
Link to comment
Share on other sites

  • Recently Browsing   0 members

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