Is there a way to give a helmet night vision?

Post » Thu Nov 04, 2010 8:01 pm

Topic. Can't seem to figure it out, if it's possible.
User avatar
Alina loves Alexandra
 
Posts: 3456
Joined: Mon Jan 01, 2007 7:55 pm

Post » Thu Nov 04, 2010 10:21 pm

Yeah, you'll want to use http://geck.gamesas.com/index.php/ApplyImagespaceModifier and http://geck.gamesas.com/index.php/RemoveImagespaceModifier to apply and remove the modifier, and do so when certain events take place. If you want the night vision to be applied all the time while it's equipped, then you can just use a script attached to the helmet itself.

Cipscis
User avatar
c.o.s.m.o
 
Posts: 3419
Joined: Sat Aug 12, 2006 9:21 am

Post » Thu Nov 04, 2010 4:27 pm

Awesome, thanks. I've never coded in GECK before, I just use it tweak equipment and stuff, is there a way to set it to a hotkey to toggle on/off? If not, how would I set it to only be on at night? Thanks!
User avatar
Lory Da Costa
 
Posts: 3463
Joined: Fri Dec 15, 2006 12:30 pm

Post » Thu Nov 04, 2010 12:13 pm

I just realised - using a scripted object effect would probably be a better method of applying the night vision. That way, it's much easier to add or remove conditions.

To make it only on at night, you'd want to use two conditions that check http://geck.gamesas.com/index.php/GetCurrentTime to make sure that the current time is between two times (I'm not sure when sunset/sunrise tend to happen in the game - I haven't even made it through one afternoon yet).

To enable/disable it via a hotkey, you'd need to use NVSE's http://fose.silverlock.org/fose_command_doc.html#IsKeyPressed function. I've written a tutorial on detecting keypresses in this way, which you can find on my website - http://www.cipscis.com/fallout/tutorials/detecting_keypresses.aspx

Cipscis
User avatar
James Shaw
 
Posts: 3399
Joined: Sun Jul 08, 2007 11:23 pm

Post » Thu Nov 04, 2010 11:13 am

Sounds like this may be a bit advanced for me, heh, the only code I know is simple Java and this language seems to be significantly different. Would it be too much to ask to request a code for toggling night vision via hotkey? (Any unused key would work) :)
User avatar
quinnnn
 
Posts: 3503
Joined: Sat Mar 03, 2007 1:11 pm

Post » Thu Nov 04, 2010 11:19 pm

I usually use a quest script with a processing delay of 0.1 seconds for detecting hotkeys, and they tend to look like somewhat this:
Spoiler
ScriptName NightVisionHotkeyScriptint bIsHotkeyPressedBegin GameMode	if bIsHotkeyPressed != IsKeyPressed HotkeyGlob		set bIsHotkeyPressed to IsKeyPressed HotkeyGlob		if bIsHotkeyPressed			; Do stuff when the hotkey is pressed		else			; Do stuff when the hotkey is released		endif	endifEnd
Where "HotkeyGlob" is a global that stores the http://fose.silverlock.org/fose_command_doc.html#DirectX_Scancodes for the key you want to use.

The tutorial that I linked to has some more advanced examples, like hotkeys that have different actions if you hold them down for a certain period of time, but of course if you're not interested in that then you needn't look into it.

You'll probably want to use something like this for the code that runs when the hotkey is pressed:
Spoiler
if IsImagespaceActive NightVisionISFX	RemoveImagespaceModifier NightVisionISFXelseif player.GetEquipped NightVisionHelmetsList	ApplyImagespaceModifier NightVisionISFXendif
Note that this code won't deactivate the night vision if the player unequips the helmet, so you'll probably want to add something like this as well:
Spoiler
if IsImagespaceActive NightVisionISFX	if player.GetEquipped NightVisionHelmetsList == 0		RemoveImagespaceModifier NightVisionISFX	endifendif
All of that added together, with a bit of commenting and formatting, ends up like this:
Spoiler
ScriptName NightVisionHotkeyScriptint bIsHotkeyPressedBegin GameMode	if bIsHotkeyPressed != IsKeyPressed HotkeyGlob		set bIsHotkeyPressed to IsKeyPressed HotkeyGlob		if bIsHotkeyPressed ; Run this code when the hotkey is pressed			; Toggle night vision			if IsImagespaceActive NightVisionISFX				RemoveImagespaceModifier NightVisionISFX			elseif player.GetEquipped NightVisionHelmetsList				ApplyImagespaceModifier NightVisionISFX			endif		endif	endif	; Remove the effect if the player stops wearing a helmet capable of night vision	if IsImagespaceActive NightVisionISFX		if player.GetEquipped NightVisionHelmetsList == 0			RemoveImagespaceModifier NightVisionISFX		endif	endifEnd

Cipscis
User avatar
Daniel Brown
 
Posts: 3463
Joined: Fri May 04, 2007 11:21 am

Post » Thu Nov 04, 2010 4:47 pm

Thanks a ton! And sorry, but what do I replace with the wanted hotkey? For example, if I wanted to use "N", the code for which is 49, where would I insert that in the code?

EDIT: Okay, think I figured that part out, but the script seems to refuse to save? When I hit 'save' nothing happens, and if I try to close the script edit window I get the message
"Save Current Script?
Current="
[Yes] [No]

Hitting Yes brings up the same prompt again, hitting no closes it without it being saved. =\
User avatar
Lizzie
 
Posts: 3476
Joined: Sun Nov 19, 2006 5:51 am

Post » Thu Nov 04, 2010 6:09 pm

Yeah, the New Vegas GECK does that instead of error reporting. Here's a fix - http://www.newvegasnexus.com/downloads/file.php?id=36290

In this case, you're probably missing a few forms referenced in the script, such as the imagespace modifier and the form list containing night vision-enabling helmets.

Cipscis
User avatar
Cccurly
 
Posts: 3381
Joined: Mon Apr 09, 2007 8:18 pm

Post » Thu Nov 04, 2010 12:18 pm

Okay, apparently this is just way over my head then, I don't know my way around the GECK enough to do this myself. xD Thanks though!
User avatar
Lloyd Muldowney
 
Posts: 3497
Joined: Wed May 23, 2007 2:08 pm


Return to Fallout: New Vegas