Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[EO] ShiftDown Run/Walk Option


KaosKaizer
 Share

Recommended Posts

I know that there has already been a tutorial to add a Run/Walk option to the game, but that's not what I'm doing here. I'm adding a tutorial to add an option to make the character either run when shift is held down or walk when shift is held down. It's a very simple tutorial, I know, but I was just testing my skills. I have thoroughly tested this and it does work.

Also, I know that I'm new to the forums and to VB6, but I'm a quick learner, and this is what I've learned in just an hour of work. Maybe some of you would know a better way to do this, and if so, please tell me so. I don't mind criticism, as long as it is constructive. :cheesy:

This code is all client side.
In **frmMain**,
1\. Add a label with a caption of "Speed" in the options menue.
2\. Add an option named optRun, captioned "Run"
3\. Add an option named optWalk, captioned "Walk"

In **frmMain**(code), insert:
```
Private Sub optRun_Click()
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    Options.Speed = 1
    ' save to cofig.ini
    SaveOptions

    ' Error Handler
    Exit Sub
errorhandler:
    HandleError "optRun_Click", "frmMain", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

Private Sub optWalk_Click()
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    Options.Speed = 0
    ' save to cofig.ini
    SaveOptions

    ' Error Handler
    Exit Sub
errorhandler:
    HandleError "optWalk_Click", "frmMain", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub
```
In **modDatabase**, find
```
Public Sub SaveOptions()
```After _Call PutVar(fileName, "Options", "Speed", Str(Options.Speed))_, add
```
Call PutVar(fileName, "Options", "Speed", Str(Options.Speed))
```
Next, find _Public Sub LoadOptions()_
After _Options.Debug = 0_, add
```
Options.Speed = 1
```
In the Else statement, after _Options.Debug = GetVar(fileName, "Options", "Debug")_, add
```
Options.Speed = GetVar(fileName, "Options", "Speed")
```
Then, right before the error handler, add
```
If Options.Speed = 0 Then
        frmMain.optWalk.Value = True
    Else
        frmMain.optRun.Value = True
    End If
```
In **modTypes**, fine _Private Type OptionsRec_ and after _Debug as Byte_, add
```
Speed as Byte
```
In **modGameLogic**, replace
```
If ShiftDown Then
                    Player(MyIndex).Moving = MOVING_WALKING
                Else
                    Player(MyIndex).Moving = MOVING_RUNNING
                End If
```With
```
If Options.Speed = 1 Then
                If ShiftDown Then
                    Player(MyIndex).Moving = MOVING_RUNNING
                Else
                    Player(MyIndex).Moving = MOVING_WALKING
                End If
            Else
                If ShiftDown Then
                    Player(MyIndex).Moving = MOVING_WALKING
                Else
                    Player(MyIndex).Moving = MOVING_RUNNING
                End If
            End If
```

> **THIS PART IS OPTIONAL**
> If you want to make running faster, you can open up **modConstants** and find
> ```
> Public Const RUN_SPEED As Byte = 6
> ```
> I replaced 6 with 10, but you can change it to whatever number you want.

After you have made all these edits, save all the files and compile. Open up your client and test it out :)
Please leave your feedback and/or constructive criticism so I know if I did anything a really idiotic way :)
Link to comment
Share on other sites

@Craselin++:

> Very nice, I'm suprised that this hasn't been thought of before!
> Thanks :D

It has been thought of, implemented, and everything, just nobody has ever released any source on it. I'm glad he released it though, I've heard lots of requests for it.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...