Weapon draw/holstering events?

Post » Sat Jan 23, 2010 6:03 pm

My goal is to create a script to change from 3rd->1st person when the player's weapon is drawn and the reverse when it is holstered.

Ideally a script like this:
OnDrawWeapon{	TogglePOV}OnHolsterWeapon{	TogglePOV}


After a bit of searching the best thing I could come up with is this:
Begin GameMode{	if (IsWeaponOut)	{		Using keyboard?			TapKey 33		Using controller?			TapControl 13	}}

However, this seems like a very inefficient way of doing things and raises another issue. How can I tell if the user is using either the keyboard or a controller? (TapKey & TapControl are NVSE functions, and I assume I have to match them to the users input method for them to work.)

I could also try some sort of OnKey/ButtonPressEvent, but I can't find anything like that either.


Note: Consider this sudo-code; I know they won't compile as-is.
User avatar
Epul Kedah
 
Posts: 3545
Joined: Tue Oct 09, 2007 3:35 am

Post » Sun Jan 24, 2010 5:46 am

I assume I have to match them to the users input method for them to work.

Why? Keyboard controls don't go away when you plug in a joystick. (At least they shouldn't, and any developer who does that deserves a good kick in the head).

Note: Consider this sudo-code; I know they won't compile as-is.

It's spelled "pseudo," by the way. Sudo is the Linux superuser command.
User avatar
Matt Bigelow
 
Posts: 3350
Joined: Sun Sep 30, 2007 6:36 pm

Post » Sun Jan 24, 2010 4:25 am

Begin GameModeif player.isWeaponOut == 1 && IsPC1stPerson == 0	tapcontrol 13elseif player.isWeaponOut == 0 && IsPC1stPerson == 1	tapcontrol 13endifend

User avatar
Stephani Silva
 
Posts: 3372
Joined: Wed Jan 17, 2007 10:11 pm

Post » Sun Jan 24, 2010 6:10 am

Or, more concisely:
Begin GameMode	if player.IsWeaponOut != IsPC1stPerson		TapControl 13	endifEnd

Cipscis
User avatar
luis dejesus
 
Posts: 3451
Joined: Sun Aug 19, 2007 7:40 am

Post » Sun Jan 24, 2010 2:08 am

Or, more concisely:
Begin GameMode	if player.IsWeaponOut != IsPC1stPerson		TapControl 13	endifEnd

Cipscis

:facepalm:

of course...didn't have my coffee yet
User avatar
Reven Lord
 
Posts: 3452
Joined: Mon May 21, 2007 9:56 pm

Post » Sat Jan 23, 2010 3:50 pm

Thanks guys for all the help. However, the code only works when I'm using the mouse+keyboard. As soon as I enable the controller 'TapControl 13' no longer has any affect. I added a simple message to test in-game so I know the code is being executed; I just can't figure out why it's not working with the controller.

I don't know about your systems but on mine when I enable the controller Fallout then completely ignores the keyboard. Because of this I assumed Fallout disables one input method when enabling the other. I'm assuming this somehow negatively affects the TapControl NVSE function.

I'm currently using the default key bindings for both input methods, but I'm going to try changing them and see if I have better luck with the TapKey function.

Anybody know another method of toggling the POV?
User avatar
Kitana Lucas
 
Posts: 3421
Joined: Sat Aug 12, 2006 1:24 pm

Post » Sat Jan 23, 2010 11:44 pm

I've now done some testing and here's what I've found: Both the TapKey & TapControl function work (interchangeably) while using the keyboard. Neither work while using a gamepad. (Using 360 wireless controller)

Anyone know any workarounds or other methods of toggling the POV?
User avatar
lolly13
 
Posts: 3349
Joined: Tue Jul 25, 2006 11:36 am


Return to Fallout: New Vegas