Jump to content

How to add a Night-Vision script to a helmet?


Antartic

Recommended Posts

I know that there are a lot of excellent Night Vision mods (I am already using the Gopher’s Advanced Recon Thermal Nightvision which is awesomely easy to use), but I want to do my own mod for study and fun, especially having in mind that it must be the simplest as possible (a minimalistic mod).

 

I have this script working, no quest, no gear, only Night Vision at player demands (as well as VATS).

scn ARTNightVisionScript
;Handles the toggle of Night Vision
;This version uses Energy Cells as power -> AmmoSmallEnergyCell

short sActive
short sEffect
float fTimer
short sKeyPressed
short sJustActivated

Begin GameMode
	if (IsKeyPressed 23 != sKeyPressed) ;If the key 'i' is pressed and released
		set sKeyPressed to IsKeyPressed 258

		if (sKeyPressed)
			;Do Nothing
		else
			if (sActive == 0)
				if player.getItemCount AmmoSmallEnergyCell > 0
					player.removeItem AmmoSmallEnergyCell 1 1
					set sJustActivated to 1
					set sActive to 1
				else
					ShowMessage ARTNightVisionNoECMsg
				endif
			else
				set sActive to 0
			endif
		endif
	endif

	;Adds Night Vision effect if the Night Vision is on
	if (sActive) && (sEffect == 0)
		iMod ARTNightVisionISFX
		playsound ITMPistolUp
		set fTimer to 0
		set sEffect to 1
	endif


	if (sEffect)

		if (fTimer >= 10);
			if  sJustActivated
				set sJustActivated to 0
			else
				player.removeItem AmmoSmallEnergyCell 1 1
			endif
			set fTimer to 0
		else
			set fTimer to fTimer + GetSecondsPassed
		endif


		;Turn off Night Vision if player is out of AmmoSmallEnergyCell
		if (player.getItemCount AmmoSmallEnergyCell <= 0) && (sJustActivated == 0)
			set sActive to 0
			ShowMessage ARTNightVisionNoECMsg
		endif


		;Turn it off if when the variable say so
		if (sActive == 0)
			riMod ARTNightVisionISFX
			playsound ITMPistolDown
			set sEffect to 0
		endif
	endif
End

This script is perfect and I only want to add it to a helmet, as I’ve done with this Water Breathing script (but with Night Vision isn’t so easy)

scn WaterbreathingScript
begin OnEquip Player
	player.setav waterbreathing 1
end
begin OnUnequip Player
	player.setav waterbreathing 0
end

What is the simplest (minimalistic) way to attach the script to a piece of gear?

Edited by Antartic
Link to comment
Share on other sites

I would imagine the most minimal approach you could possibly use would be to attach the following script to a helmet or sunglasses or whatever.

scn YourNVGScript

Begin OnEquip
	imod YourNightVisionISFX
End

Begin OnUnEquip
	rimod YourNightVisionISFX
End
Link to comment
Share on other sites

Yes, is more or less the way I wanted but with that script Night Vision will be active every time I wear that helmet and don't consumes Energy Cells.

 

What I want is keep using the first script posted, but only when I wear a helmet, (not freely and with no gear, like VATS, as I'm using right now).

 

Anyway thank you, I searched the imod command in the GECK page and it will be useful to other things in my gear.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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