Jump to content

Power Armor - Restore Health & Limbs


GT500

Recommended Posts

This has been driving me crazy for 4 or 5 hours of Google searching and skimming tutorials. I've been modding Bethesda games (Oblivion, Fallout 3, Fallout: NV, Skyrim) for many years, but I never really bothered learning much about the scripting, so I'm a bit confused as to why my script isn't working as expected.

 

Basically I'm making a T-51b power armor mod with several variants that each have different effects when wearing them (blue increases energy weapon resistance, green increases radiation resistance, pink heals you over time and repairs limb damage, etc). The issue is, of course, with the limb repair on the pink armor. It wasn't hard to figure out how to get a heal over time (create an effect that increases Heal Rate and add it to the armor), but I can't get the script that repairs limb damage to only run when out of combat.

 

I've tried simple things like this, and they don't work:

 

SCN PinkT51bLimbRepair Script

BEGIN OnCombatEND

	if (player.GetEquipped ArmorPowerT51bPink)
		player.restoreav perceptioncondition 100
		player.restoreav endurancecondition 100
		player.restoreav leftattackcondition 100
		player.restoreav leftmobilitycondition 100
		player.restoreav rightattackcondition 100
		player.restoreav rightmobilitycondition 100
	endif

END

Of course, I've also tried it without the IF statement, and with "BEGIN OnCombatEND player" instead of "BEGIN OnCombatEND", but it doesn't work.

 

Early on I made the mistake of trying to save it as an Effect script, and add it to an effect, then add it to the armor, however I now understand that I can't do that with a constant enhancement to an armor. I am now saving it as an Object and adding it directly to the armor instead of trying to add it with effects.

 

I've found that if I add the code to "GameMode" instead of "OnCombatEND" it works just fine, but of course it prevents limb damage from happening at all due to healing the damage faster than the player could notice it (so no broken limbs at all). To get around that, I've tried using "OnStartCombat" and "OnCombatEND" to set a variable so that a conditional statement in the "GameMode" section can be used to stop it from running the commands when in combat, however this doesn't seem to work, and the script still just maintains 100% health on all limbs at all times (even in combat).

 

Here's my current script:

 

SCN PinkT51bLimbRepair Script

Short WearingPink
Short InCombat

BEGIN OnEquip player

	Set WearingPink to 1
	
END

BEGIN OnUnequip

	Set WearingPink to 0
	
END

BEGIN OnStartCombat player

	Set InCombat to 1

END

BEGIN OnCombatEnd player

	Set InCombat to 0

END

BEGIN GameMode

	If (WearingPink == 1 && InCombat == 0)
		player.restoreav perceptioncondition 100
		player.restoreav endurancecondition 100
		player.restoreav leftattackcondition 100
		player.restoreav leftmobilitycondition 100
		player.restoreav rightattackcondition 100
		player.restoreav rightmobilitycondition 100
	EndIf
	
END
Obviously I have no clue what I'm doing wrong here, so if anyone has any suggestions, then I would certainly appreciate them.

 

I do have FOSE installed, however I don't want it to be a dependency for this mod, so I am trying to avoid any FOSE scripting.

Edited by GT500
Link to comment
Share on other sites

Instead of trying to maintain a script variable, "InCombat", actors have an "isInCombat" flag. Your first script could look like this:

SCN PinkT51bLimbRepair Script

BEGIN GameMode

	if (player.GetEquipped ArmorPowerT51bPink && !player.isInCombat)
		player.restoreav perceptioncondition 100
		player.restoreav endurancecondition 100
		player.restoreav leftattackcondition 100
		player.restoreav leftmobilitycondition 100
		player.restoreav rightattackcondition 100
		player.restoreav rightmobilitycondition 100
	endif

END
Link to comment
Share on other sites

Many thanks.

 

The following seems to do what I want:

 

SCN PinkT51bLimbRepair Script

BEGIN GameMode

	If (player.GetEquipped ArmorPowerT51bPink && player.isInCombat != 1)
		player.restoreav perceptioncondition 100
		player.restoreav endurancecondition 100
		player.restoreav leftattackcondition 100
		player.restoreav leftmobilitycondition 100
		player.restoreav rightattackcondition 100
		player.restoreav rightmobilitycondition 100
	EndIf

END

I guess the returned value from "player.isInCombat" is an integer (at least in Fallout 3), so I had to throw a check in there to see if the value was 1 or 0. After a quick test, it seems to be working just like I wanted it to. :wink:

Link to comment
Share on other sites

  • Recently Browsing   0 members

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