Jump to content

Need Assistance With Cloaking/Regenerating Armor


Oblivion187

Recommended Posts

I'm trying add two properties to some unique armor I'm working on:

  • Automatic health/limb regeneration that deactivates once full health is restored.
  • Cloaking feature ( no time limit, but otherwise similar to the Stealthboy's ) that can be manually toggled on and off.

With regards to the regeneration, I tried duplicating the script "testPhilRegenArmorSCRIPT" ( ID: 0100296A ) and "attaching" it to an effect, then "attaching" the effect to an enchantment, but unfortunately no discernable result occurred in the game. I would include the script here, but there is no way to copy/paste code from the Geck's Script Edit window into this thread rather than painstakingly typing all 40 + lines of code again.

 

I'm not certain where to even begin with regards to the cloaking feature. Any assistance would be greatly appreciated. Many thanks in advance.

Link to comment
Share on other sites

You can copy and paste scripts into your posts if you wrap it in code tags. That is an option that you can see above the text window when you are adding a post. It preserves all of the text formatting of a script when pasted in your post. Example:

 

ScriptName StealthBoyStopCombatScript

Begin ScriptEffectStart
scaonactor
End

 

I believe that an efficient way to accomplish the steathboy effect is to create an object effect of invisibility for the armor that is conditionalized to be active only when the player is sneaking. Then every time the player crouches the stealthy effect would begin and it would end when the player stands up again.

Link to comment
Share on other sites

Aw what the heck, here is the code I attempted for the regeneration effect:

 

scn ArmorRegenSCRIPT

short armorEquipped

short regenTimer
short timerRunning

short regenAmountHP
short regenAmountLimbs

BEGIN ONEQUIP
set armorEquipped to 1
set regenAmountHP to 20
set regenAmountLimbs to 100

END

BEGIN ONUNEQUIP
set armorEquipped to 0
END

BEGIN GAMEMODE

IF armorEquipped == 1&& player.isInCombat == 0&& player.getHealthPercentage < 1.0

	IF timerRunning == 0
		set regenTimer to 120
		set timerRunning to 1

	ELSE

		IF regenTimer > 0
			set regenTimer to regenTimer - getSecondsPassed
		ELSE

			player.restoreAv Health regenAmountHP
			player.restoreAv LeftMobilityCondition regenAmountLimbs
			player.restoreAv RightMobilityCondition regenAmountLimbs
			player.restoreAv LeftAttackCondition regenAmountLimbs
			player.restoreAv RightAttackCondition regenAmountLimbs
			player.restoreAv PerceptionCondition regenAmountLimbs
			player.restoreAv EnduranceCondition regenAmountLimbs
			set timerRunning to 0
		ENDIF

	ENDIF
ENDIF
END

 

Basically I just copied the format from testPhilRegenArmorSCRIPT, made a few minor changes and saved it under a new name. Initially I set the "Script Type" to "Object" ( which didn't seem to work ), then tried "Effect", which didn't work either. I also recompiled all scripts ( since there dosen't seem to be an option for recompiling a single script ), although I'm not certain that's even necessary.

 

Next I created a new Base Effect ( ArmorRegenEffect ) with the following settings:

  • Effect Archetype: Script
  • Assoc. Item: ArmorRegenSCRIPT ( couldn't find my script in the pulldown list )
  • Flags: Self

Finally, I attached the aforementioned effect to an enchantment. Frankly, I quite new to scripting and not entirely clear on what some of the above strings actually do. For example "set regenTimer to 120"; does this mean that the effect lasts for 120 seconds or that the effect BEGINS after 120 seconds. " Set regenAmountHP to 20"; means the effect regenerates 20 h.p.'s then quits, or regenerates 20 h.p.'s per second ( which would be a more desirable effect ).

 

As you can see I'm fumbling about in the proverbial "dark" here. :wallbash: Hope someone can clarify.

Link to comment
Share on other sites

In my opinion, when it comes to Fallout 3 scripting Cipscis is the man. So I'm going to refer you to his Beginner's Tutorial

 

Recompiling all scripts is not a good idea. It certainly is not necessary in your case. I don't know if it is disastrous because I've never done it. Normally I am satisfied if the GECK allows me to save a script. It may not work because of logic errors in my script, but at least it accepts the syntax.

 

There are a number of test scripts and cells left over by FO3 developers. I've always considered them bad housekeeping. At any rate, I don't trust them and don't base any of my work on them.

 

The script that you have shown has what appears to me to be unnecessary baggage and a loop that probably prevents it from working. Other than that, the timer would not heal the player until 120 seconds after combat has ceased, even if it were not set up as an endless loop. Is that what you want?

 

In contrast, vanilla scripts that handle companions will heal them to full health immediately after combat ends. For the sake of argument, say your armor is named Oblivion187Armor. To modify that companion script into an object script for your armor it might go something like this:

 

SCN Oblivion187Armor Script

BEGIN OnCombatEND

if (player.GetEquipped Oblivion187Armor)
	player.resethealth
	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

 

That should heal the player and remove crippling and concussion immediately after combat is ended as long as he is wearing the armor at the time, I think. It should only run once, and would not heal the player if he was injured outside of combat, as written. You could modify the script so that the armor would heal the player OnEquip also if you wanted. It would run without polling the player's condition, but that should cause no harm. You could include a timer if you wanted. If you want the healing process to be gradual rather than instant then that would take more scripting. I haven't tested this exactly as written, but did use something very similar to heal an NPC involved in a quest.

 

As far as the stealth mode, I showed you one of two ways that I know of to toggle an effect using only vanilla methods. You could create a method that would toggle the stealth off and on by a key press, but that would entail using Fallout Script Extender which you can download from the Nexus files database.

Link to comment
Share on other sites

Attempted to check out Cipscis's tutorial, but there appears to be something wrong with his webpage, it keeps "reloading" every 1/2 second, making navigation impossible. With regards to what I'm trying to achieve for with the regeneration feature, it's as follows:

  • Activates instantly in or out of combat, whenever damage is recieved.
  • Restores health & limb damage.
  • Terminates once full health/limb function is restored.
  • Restores a set value of damage per second, say 4 points.

Not sure how to combine the script you provided as an example with what I've already attempted. Again, I would peruse Cipscis's tutorial before asking anymore questions, but that appears to be impossible at least for the interim.

Link to comment
Share on other sites

Some notes on your script...

 

Timers are floats, not shorts. That will cause your script to fail right off.

 

What Badpenny says about putting the "object" script on the armor itself rather that using an "effect" script would be easier, but...

 

For your script, the script type needs to be an "Effect" script. If you want to place it in a Base Effect.

 

Effect scripts have only three blocks than may be used:

ScriptEffectStart - runs once when effect starts.

ScriptEffectUpdate - kind of like the GameMode equivalent for effect; may run multiple times.

ScriptEffectFinish - runs once when the effect ends.

 

GetSecondsPassed does not work in an effect script. You must use ScriptEffectElapsedSeconds in a ScriptEffectUpdate block only.

 

Clicking the "Recomplie All Scripts" is one of the major No - Nos of the GECK world. By doing this, you have added every single script in the game to your mod. If you check you mod file size you will now see that it is 3MB+ bigger than before. Hopefully, you have an old save in the Backup folder that you can use. Otherwise you are going to have to become familiar with FO3Edit to remove them.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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