Jump to content

Help with a simple script


Sixdd

Recommended Posts

I just need a little help with a very simple script. I need a script that will check players health and if at 50 or less will refill health.

I know a little about scripting but I haven't done any of this stuff since Morrowind came out. I'll post what I need from the script in suedo-code for reference.

 

Start MyScript

Get Player Max Health
Get Player Current Health

If "Player Current Health" is Less Than "Player Max Health"
   Set "Player Current Health" to "Player Max Health"
End

End MyScript

 

Sadly I have no idea how to express this properly in G.E.C.K. script :confused:

Any help is very appreciated.

 

EDIT: I'd also like to note that I want to be able to refill the players health but keep limb damage, basically not allowing the player to die but remain crippled.

Link to comment
Share on other sites

Take a look at GetHealthPercentage and ForceActorValue pages.

No don't mind the fuss about not doing that because it may conflict.. That is only the case with attributes.. not with health...

Don't worry I've done this one before..In fallout its actually more simple to do because of the GetHealthPercentage function.

 

Because of the lack of time I cannot provide you with a script right now, so reply if you don't get it, got in trouble or found the solution.

So in any way, this page will have that script soon :).

 

----

Owk, any particular place you're going to use it for? Armor/weapon, whatever?

Link to comment
Share on other sites

I'll give that a shot and see what I get. Last night I managed to come up with the following but it does not work quite how I intended...

 

ScriptName MyScript

Begin Gamemode

If Player.GetHealthPercentage < 0.50
	Player.SetActorValue Health 999
EndIf

End

 

Obviously I learned very quickly that SetAV will change the base value and not just fill your total health like I had intended. The other problem is that it only worked once, after it initially bumped my health to 999 it never bumped it again. I'm still scratching my head on that one. When using "Begin Gamemode" will it run the script constantly while in "Gamemode" or do you have to cycle back out from the "Menumode" to "Gamemode" again to run the script?

Link to comment
Share on other sites

Okay tried it in my previous script and it does technically work, but it also will increase the max health of the player too, I just want it to fill up... is there a simple way to check the difference between current health and max health and then turn it into a variable I can use?
Link to comment
Share on other sites

yeah.. I know why that happened sorry.. I was working on something...

You would have to measure the current value of max health..

I made up the script for oblivion a short while ago

 

But I found a workaround that will skip that one..

 

I don't know if you know this one

Power Medic Armor

?

 

It has certain abilities which you might like..

 

The way the workaround works is this.. we'll make a super stim-pack as a Effect (works kinda like spells...)

That will immediately take effect. So a huge amount would do just fine.. 2000 or something..

You can create that in GameEffects->ActorEffects.. Create a new one.. and give it the RestoreHealth effect.

 

If you use - Player.CastImmediateOnSelf "effectname" - instead of that other script it will save some scripting..

probably some fps too... (haha like 0.002 :) )

 

Its far more easy to do...

 

 

Here is the link to that other script... I would go for this one though...

Link to comment
Share on other sites

hmm... so basically you create an effect that will heal a huge amount and the script casts it to just heal and not actually modify health? If so it is a really good idea... brb gonna test it.

 

EDIT: Well it works perfectly and I'm having some celebratory Mac 'n Cheese. Thanks for all your help, this will be the first step for me in learning to script again.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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