Jump to content

Help needed to make accessibility mods (movement, crouch, etc)


Recommended Posts

Greetings!

My C# knowledge is basic, just-starting-to-learn-Unity3D levels, so please forgive me if I sound like a total newb. I'm attempting to run through the process of making a mod (got Visual Studio setup and ran the first few tests of ModMaker to confirm it was working, yay!)

I'm trying to increase the accessibility of Vintage Story. I have pretty bad arthritis and having to hold down W to walk, and hold down Shift to Crouch, gets very painful very quickly.

I think I have the basic idea down for the auto-walk ability. In Unity, the code I have so far looks like this:

    public class MoveCharacter : MonoBehaviour
    {
        private bool autoWalk = false
		private var speed = 1.0f
     
        private void Update()
        {
          
            if(!autoWalk)
			{
				if(Input.GetKeyDown(KeyCode.Q))
				{
					transform.Translate(Vector3.forward * (speed * Time.deltaTime));
					autoWalk = true;
				}
			

...and it's at this point that my knowledge breaks down. Actually, my knowledge broke down before this point, but that's beside the current point. I'm not sure if Input.GetKeyDown is even used by Vintage Story; I assumed it was a code block for Unity itself. So the problem I'm facing is that I'm not sure where to look in Vintage Story API to find the specific code I'd need to get the player to move forward automatically if they press Q, in this case. If you press Q again, or if you press S, that would set autoWalk to false. The problem is that I'm not sure how to go from where I am to where I want to be.

Directly related to that, I'd want to have crouch be able to be toggled. You press your crouch button and you go into crouch mode until you press the button again. So the variable would instead be isCrouched = false and would, I assume, follow a very similar code structure.

Thanks to anybody able to help!

Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.