Movement Controls

Post » Tue May 17, 2011 1:27 am

Hey all, I need help figuring out to disable the strafe forward and strafe backward whenever the "F" key (3rd Person) is pressed or a function that disable these movements when in 3rd Person. I've been reading posts from the forums seems like I can use the "disableplayercontrols" function but the problem is how those the script detect if im in 3rdperson or if the "F" key is pressed?
So basically the script needs to:
detect if player is in 3rd person, and if disable the player from pressing forward/backward with the left/right keys to stop the strafe forward/backward function. The reason for this is, I really hate that there are no strafing forward/backward animation and since its impossible to make one why not just disable that function in 3rd person mode? Also is it possible to stop npcs from doing the strafe forwad/backward thing? it really breaks immersion when I see them gliding when in a firefight. thanks
User avatar
Stryke Force
 
Posts: 3393
Joined: Fri Oct 05, 2007 6:20 am

Post » Tue May 17, 2011 10:51 am

Hey all, I need help figuring out to disable the strafe forward and strafe backward whenever the "F" key (3rd Person) is pressed or a function that disable these movements when in 3rd Person. I've been reading posts from the forums seems like I can use the "disableplayercontrols" function but the problem is how those the script detect if im in 3rdperson or if the "F" key is pressed?
So basically the script needs to:
detect if player is in 3rd person, and if disable the player from pressing forward/backward with the left/right keys to stop the strafe forward/backward function. The reason for this is, I really hate that there are no strafing forward/backward animation and since its impossible to make one why not just disable that function in 3rd person mode? Also is it possible to stop npcs from doing the strafe forwad/backward thing? it really breaks immersion when I see them gliding when in a firefight. thanks


Try;
short viewbegin ....set view to IsPC1stPersonif view == 0DisablePlayerControls 1 0 0 0 0 0 0endifend

User avatar
Eduardo Rosas
 
Posts: 3381
Joined: Thu Oct 18, 2007 3:15 pm

Post » Tue May 17, 2011 12:09 am

Try;
short viewbegin ....set view to IsPC1stPersonif view == 0DisablePlayerControls 1 0 0 0 0 0 0endifend



You'll need to enable the controls if not, so just put an else statement in there.

I think you'd also need to have FOSE to detect if you press 'F' in which the above would run, though I'm not familiar with FOSEs functions. So something like


Short viewShort buttonBegin GameMode	If GetButton == button		Set view to IsPC1stPerson		If view == 0			DisablePlayerControls 1 0 0 0 0 0 0		Else			EnablePlayerControls		EndIf	EndIfEnd


And whatever FOSEs button detection is for "If GetButton..."
User avatar
Zach Hunter
 
Posts: 3444
Joined: Wed Aug 08, 2007 3:26 pm

Post » Tue May 17, 2011 6:21 am

thanks to the both of you will try it out :woot:
User avatar
remi lasisi
 
Posts: 3307
Joined: Sun Jul 02, 2006 2:26 pm

Post » Tue May 17, 2011 8:05 am

I think you would want to use http://fose.silverlock.org/fose_command_doc.html#IsControlPressed with the parameter number of 13, according to http://fose.silverlock.org/fose_command_doc.html#ControlCodes which is toggle POV. So if they map it to a key other than F, it still works.
User avatar
JAY
 
Posts: 3433
Joined: Fri Sep 14, 2007 6:17 am

Post » Tue May 17, 2011 9:01 am

Have a look at my http://www.cipscis.com/fallout/tutorials/detecting_keypresses.aspx tutorial for how to detect when a control is pressed. You'll want to disable the left/right controls when the forward/backward controls are pressed and enable them when they are are released, and do the same for the forward/backward controls whenever the left/right controls are pressed and released.

Cipscis
User avatar
naome duncan
 
Posts: 3459
Joined: Tue Feb 06, 2007 12:36 am

Post » Tue May 17, 2011 4:26 am

Have a look at my http://www.cipscis.com/fallout/tutorials/detecting_keypresses.aspx tutorial for how to detect when a control is pressed. You'll want to disable the left/right controls when the forward/backward controls are pressed and enable them when they are are released, and do the same for the forward/backward controls whenever the left/right controls are pressed and released.

Cipscis


Hey thanks for the tutorial Cipscis and thanks for helping you guys. Already made a esp for the script and compiled it, but I haven't tested it yet for I'm modding up my mod list with FO3Edit.
Will post the result when I get to play test. :celebration:
User avatar
Scotties Hottie
 
Posts: 3406
Joined: Thu Jun 08, 2006 1:40 am

Post » Tue May 17, 2011 2:40 pm

Hi again, I need help with the following script:

Short viewint bIsWPressedint bIsSPressedint bIsAPressedint bIsDPressedBegin GameMode		Set view to IsPC1stPerson		If view == 0			if bIsWPressed != IsKeyPressed 17 ; W				set bIsWPressed to IsKeyPressed 17 ; W				if bIsWPressed				DisableControl 2 ;Disables left and right strafe				DisableControl 3		Else			if bIsSPressed != IsKeyPressed 31 ; S				set bIsSPressed to IsKeyPressed 31 ; S				if bIsSPressed				DisableControl 2 ;Disables left and right strafe				DisableControl 3		Else				if bIsAPressed != IsKeyPressed 30 ; A				set bIsAPressed to IsKeyPressed 30 ; A				if bIsAPressed				DisableControl 0 ;Disables left and right strafe				DisableControl 1		Else 			if bIsDPressed != IsKeyPressed 32 ; D				set bIsDPressed to IsKeyPressed 32 ; D				if bIsDPressed				DisableControl 0 ;Disables left and right strafe				DisableControl 1			EndIf		EndIf	EndIfEnd


Will it work? Am I Missing something? I tested the disableplayercontrols when in 3rdpersonview by putting it on a quest and it worked but it was not what i had in mind. I want to disable strafing not the whole control. So I came up with the script above, but before implementing it I need the advance scripters opinion. Basically what I wanted to achieve is:
1)When in 3rdperson script will start
2)Detects if I pressed W(forward) and will disable A(left)/D(right) keys to stop strafing forward/backward.
3)If W(forward) is not pressed it will evaluate the other if statements.
4)likewise it will enable other controls when the keys are not pressed.
User avatar
Emmanuel Morales
 
Posts: 3433
Joined: Sat Oct 06, 2007 2:03 pm

Post » Tue May 17, 2011 1:42 am

Your syntax is all screwed up. You need to read a tutorial again or something so you fully understand what each thing means, but the short of it is you're missing a bunch of EndIfs and you can't use Else like that. I'm also not sure what DisableControl is doing, I think it needs to be the keycode not 0,1 whatever like it is (I'm not familiar with it though so you may be right) so like DisableControl 30 for A.

You'll also make it easier to read if you tab out and use white space accordingly like most code.

And lastly you're never re-enabling the control.

As for the basic idea of the script it's also wrong. You would want to check, in one If statement if you're pressing W or S, then disable both A and D, then have an ElseIf pressing A or D, disable both W and S.

So

Begin GameMode	....	If View 3rd person		If W or S pressed			DisableControl A			DisableControl D		ElseIf A or D pressed			DisableControl W			DisableControl S		Else			EnablePlayerControls		EndIf				If doOnce == 0			Set doOnce to 1		EndIf	Else		If doOnce == 1			EnablePlayerControls			Set doOnce to 0		EndIf	EndIfEnd


You'd probably also want to have some logic for getting the key released to automatically enable controls rather then having to press a different button, thought I'm not sure if there is a function to do that and it would be more complicated. Nevermind IsKeyPressed already does that so just do it like so.
User avatar
kasia
 
Posts: 3427
Joined: Sun Jun 18, 2006 10:46 pm

Post » Tue May 17, 2011 2:30 am

Begin GameMode	....	If View 3rd person		If W or S pressed			DisableControl A			DisableControl D		ElseIf A or D pressed			DisableControl W			DisableControl S		Else			EnablePlayerControls		EndIf				If doOnce == 0			Set doOnce to 1		EndIf	Else		If doOnce == 1			EnablePlayerControls			Set doOnce to 0		EndIf	EndIfEnd


You'd probably also want to have some logic for getting the key released to automatically enable controls rather then having to press a different button, thought I'm not sure if there is a function to do that and it would be more complicated. Nevermind IsKeyPressed already does that so just do it like so.


thanks alright will read the tutorials again, i've also taken a look into the sprint mod script that is where i based my codes from and copied some codes on Cipscis tutorial aswell so i thought i had the syntax set up correctly. will update when im successful with the codes thanks
User avatar
Dawn Farrell
 
Posts: 3522
Joined: Thu Aug 23, 2007 9:02 am

Post » Tue May 17, 2011 12:22 pm

Hey, here is a bit of logic :)

What happens if the Player has changed his/her controls?

That would result in Errors/Conflict.

Say i was left-handed! I would use my mouse with my left hand while probably using the Arrow Keys :)

Thanks Persidon
User avatar
Code Affinity
 
Posts: 3325
Joined: Wed Jun 13, 2007 11:11 am

Post » Tue May 17, 2011 1:39 am

Sorry, Double Post
User avatar
sophie
 
Posts: 3482
Joined: Fri Apr 20, 2007 7:31 pm

Post » Tue May 17, 2011 3:37 pm

Hey, here is a bit of logic

What happens if the Player has changed his/her controls?

That would result in Errors/Conflict.

Say i was left-handed! I would use my mouse with my left hand while probably using the Arrow Keys

Thanks Persidon

hey thanks for the tip, but im no programmer and im not that good with scripts. guess i still have alot of researching to do hehe
User avatar
john palmer
 
Posts: 3410
Joined: Fri Jun 22, 2007 8:07 pm

Post » Tue May 17, 2011 7:57 am

:)
No prob hope it helps, i do scripting, but would not have a clue how to do it either, i guess i would try find a "Detect Player Controls" Function or what not, if there is such a function

Thanks Persidon
User avatar
jessica Villacis
 
Posts: 3385
Joined: Tue Jan 23, 2007 2:03 pm

Post » Tue May 17, 2011 7:17 am

I was under the impression it was a personal mod so that's not really an issue, but if you did want to release it you could just make a little message box menu and have the user press their respective forward, back, left and right keys and then store that. So instead of checking If W or S, it would be If ForwardVariable or BackwardVariable.
User avatar
Pete Schmitzer
 
Posts: 3387
Joined: Fri Sep 14, 2007 8:20 am


Return to Fallout 3