Jump to content
The Dark Mod Forums

Adjust player speed with mouse wheel


snatcher

Recommended Posts

EDIT - You can find a working external script with instructions in this post

----------------------------------------------------------------

Hi!

First post in this forum. Greetings to all.

I am a long time fan of T1 & T2 and I recently stumbled upon The Dark Mod while looking for some T2 Fan Missions and I immediately fell in love with it. Here goes a heartfelt thanks to the developers for having created this masterpiece and my recognition and appreciation to the TDM content creators and artists. Thanks.

Back on topic. A couple of weeks ago I started playing Splinter Cell Chaos Theory. The game makes use of the mouse wheel to increase and decrease the speed of the character and while it took a couple of missions to get used to it, it felt natural from that point on. So much so that after beating the game and launching TDM again my first thought was: this game mechanic should be a must in the stealth genre.

You can see it in action in the first minute of this video:

 

I understand chances are this new mechanic cannot be implemented in TDM right away: we are currently limited by the 3 existing speeds / levels of sound (correct me if I am wrong) but regardless, if the development Team would allow us to use the mouse wheel to switch between creep, walk & run it would be a step forward in the right direction, in my humble opinion.

Cheers!

Edited by snatcher
  • Like 2

TDM_Modpack_42.png

Link to comment
Share on other sites

Yeah, manipulating the movement speed via the mouse wheel is actually something I like about the Splinter Cell games, too.

And yes, changing that would indeed not be a minor thing, but you could use Autohotkey for your purpose.

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

34 minutes ago, Obsttorte said:

[...] but you could use Autohotkey for your purpose.

I can try, that's for sure!

Consider my request as a long term project to eventually allow for a greater degree of movement, especially while creeping around. The first step is to allow the mouse wheel to perform different actions, I guess.

Thanks, Obsttorte.

 

TDM_Modpack_42.png

Link to comment
Share on other sites

First version (I couldn't resist :) )

speed = 1 ; init with walk speed

wheelup::
if (speed == 0) ; we are creeping
{
	speed = 1
	Send {u up}
}
else if (speed == 1) ; we are walking
{
	speed = 2
	Send {z down}
}
return

wheeldown::
if (speed == 1) ; we are walking
{
	speed = 0
	Send {u down}
}
else if (speed == 2) ; we are running
{
	speed = 1
	Send {z up}
}
return

In this setup u is used for running and z for creeping. You can other keys, of course, although I would avoid modificator keys as used by TDM per standard. Works quiet well.

I'll add a constant to allow to alter the sensivity so that you can adjust how much you have to turn the wheel to switch between states. You have to have AutoHotkey installed nevertheless.

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

Second version (should have waited :P)

speed = 1 ; init with walk speed
steps = 3 ; amount of steps needed for switching state
state = 0 ; counter for state switch
wheelup::
state += 1
if (state > steps)
	state = steps
if (speed == 0 && state >= 0) ; we are creeping
{
	speed = 1
	Send {u up}
}
else if (speed == 1 && state >= steps ) ; we are walking
{
	speed = 2
	Send {z down}
}
return

wheeldown::
state -= 1
if (state < -2*steps+1)
	state = -2*steps+1
if (speed == 1 && state <= -steps) ; we are walking
{
	speed = 0
	Send {u down}
}
else if (speed == 2 && state <= 0) ; we are running
{
	speed = 1
	Send {z up}
}
return

The important things to modify to your likings are u and z as above, as those control which keys are used for running and creeping as well as steps, which specifies how many digits the mousewheel needs to be turned to switch the movement. Setting it to 1 let it behave like the first version posted earlier.

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

Nobody says this gets implemented in the core mod. I just fulfilled a request. Of course modificators can be used. You can replace the mousewheel stuff with this for example

!wheeldown ; ALT+mousewheel down
^wheeldown ; CTRL
+wheeldown ; SHIFT
<^>!wheeldown ; AltGr

analog for wheelup
~wheeldown ; don't block native function

you can combine them
^!wheeldown ; CTRL+ALT+wheel down

More info here. Customize as you need it.

 

  • Like 1

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

13 hours ago, freyk said:

We use the mousewheel to move objects. I dont want to use it for the players speed. (Maybe for sam, but not for the tdm player, imho)

How about pressing down the mousswheel and scroll (middleclick). Or use something else.

It shouldn't be a problem if implemented well. The mouse wheel would perform the same action when holding objects but only if the Parry/Manipulate key is pressed.

Of course the whole thing should remain optional: use the mouse wheel to control speed or switch weapons / other.

TDM_Modpack_42.png

Link to comment
Share on other sites

Obsttorte, I have improved changed your script a little. I hope you don't mind. The highlight is that the script will only run when TDM is in focus (tested in Win 10).

The only issue remains when leaning forward + switching speed. For some reason I don't quite understand we stop leaning.

If anyone wants to test this:

  • Download AutoHotkey, install it, open Notepad, paste the below script inside, save it as whatever.ahk and double click on the file you just saved.
  • Settings > Controls > Weapons: Remove mouse wheel bindings from Next Weapon and Previous Weapon (or from any other setting you may have set the mouse wheel to)
  • Settings > Controls > General: Make sure Toggle Crouch is enabled and Always Run is disabled
  • Settings > Controls > Movement: The Run and Creep keys must match in both TDM and the script.
  • While using the script you can turn pages using Next Inv. Item / Prev Inv. Item
  • To end the script, go to the Windows taskbar, look for a green icon with an "H", right click on it and select Exit.

 

; =====================================
; Adjust player speed with mouse wheel
; -------------------------------------
; An AutoHotkey script for The Dark Mod
; version 3.0 by Obsttorte & snatcher
; =====================================

key_creep = c ; in-game creep key
key_run = r ; in-game run key
speed = 0 ; init speed (-1 = creep / 0 = walk / 1 = run)
steps = 1 ; amount of mouse wheel steps needed for switching state

; -------------------------------------
; do not edit anything past this point
; -------------------------------------

state = speed * steps ; counter for state switch

#IfWinActive ahk_exe TheDarkModx64.exe ; run only when TDM is focused

wheelup::
!wheelup::
^wheelup::
+wheelup::
state += 1
if (state >= steps)
{
    if (speed == -1) ; we are creeping
    {
        speed = 0
        Send {%key_creep% up}
    }
    else if (speed == 0) ; we are walking
    {
        speed = 1
        Send {%key_run% down}
    }
    state = 0
}
return

wheeldown::
!wheeldown::
^wheeldown::
+wheeldown::
state -= 1
if (state <= steps * -1)
{
    if (speed == 0) ; we are walking
    {
        speed = -1
        Send {%key_creep% down}
    }
    else if (speed == 1) ; we are running
    {
        speed = 0
        Send {%key_run% up}
    }
    state = 0
}
return

Cheers!

Edited by snatcher

TDM_Modpack_42.png

Link to comment
Share on other sites

The external script is a proof of concept. It takes some time to get used to it and it doesn't work that well because for this new game mechanic to work at an acceptable level we require at least 5 incremental speeds, one for each mouse wheel step.

In slow-paced games like this we don't need creep and run keys but a more refined, tactical movements (imho).

TDM_Modpack_42.png

Link to comment
Share on other sites

Yes, this is something I wanted to see more after I played Splinter cell even if it didn't work properly if I moved diagonally, I think there is a person in the TDM community who was making a thief inspired game that had this feature, I can't remember their name though

Link to comment
Share on other sites

I recently replayed that game and I very much disliked that approach to the game.

However, it was tightly integrated into the detection / sound system of the game.

If there were loud environmental noises playing you could go a little faster without being heard.

In practice, I never really used more than 2 or 3 movement speeds.

I always assumed I'd taste like boot leather.

 

Link to comment
Share on other sites

I also wouldn't add it to the core mod. The whole game is setup for three movement speeds and two poses. Changing this to a system like in Splinter Cell would be a tremendous undertaking with very little benefit.

I provided the script as I think that beeing able to switch between the three speeds via the mouse wheel is an understandable wish, and it wasn't much work to set it up, but not to suggest that it would be worthwhile adding it to the core mod.

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

I like it a lot in Splinter Cell, but, I don't need it in Thief/Dark Mod. Additionally to a dark meter, you also have a noise meter in Splinter Cell, and, the movement speed is mostly for that. Moving faster makes more noise, and, you will constantly watch your sound meter when you adjust your movement speed.

Link to comment
Share on other sites

4th version of the script.

I altered it so that when you are running and stop, you are back to "walking" mode. It feels quite natural now, considering the limitations.

------------------------------------

If anyone wants to put it to test, follow below instructions (please note it takes some time to get used to it):

  • Download AutoHotkey, install it, open Notepad, paste the below script inside, save it as TDM.ahk and double click on the file you just saved.
  • Settings > Controls > Weapons: Remove mouse wheel bindings from Next Weapon and Previous Weapon (or from any other setting you may have set the mouse wheel to)
  • Settings > Controls > General: Make sure Toggle Crouch is enabled and Always Run is disabled
  • Settings > Controls > Movement: The Forward, Run and Creep keys must match in both TDM and the script.
  • To end the script, go to the Windows taskbar, look for a green icon with an "H", right click on it and select Exit.

Known limitations:

  • You can turn pages and numbered dials using Next Inv. Item / Prev Inv. Item.
  • To prepare for a long jump from idle, move the mouse wheel up before executing your move
  • You cannot move objects you are holding back and forth
  • You cannot lean forward and switch speeds at the same time, for some reason
  • Warning: fighting is as cumbersome as ever!

 

; =====================================
; Adjust player speed with mouse wheel
; -------------------------------------
; An AutoHotkey script for The Dark Mod
; version 4.0 by Obsttorte & snatcher
; =====================================

; -------------------------------------
; Configure your keys below
; -------------------------------------

; In-game move forward key
key_forward = w

; In-game creep key
key_creep = c

; In-game run key
key_run = r

; -------------------------------------
; Do not edit anything past this point
; -------------------------------------

speed = 0 ; init speed (-1 = creep | 0 = walk [default] | 1 = run)
steps = 1 ; amount of mouse wheel steps needed for switching state [default = 1)
state = speed * steps ; counter for state switch

#IfWinActive ahk_exe TheDarkModx64.exe ; run only when TDM is focused

HotKey, *~%key_forward% up, keyForwardHandler
return

keyForwardHandler:
if (speed == 1) ; we are running
{
    speed = 0 ; walk
    Send {%key_run% up}

}
return

*wheelup::
state += 1
if (state >= steps)
{
    if (speed == -1) ; we are creeping
    {
        speed = 0 ; walk
        Send {%key_creep% up}
    }
    else if (speed == 0) ; we are walking
    {
        speed = 1 ; run
        Send {%key_run% down}
    }
    state = 0
}
return

*wheeldown::
state -= 1
if (state <= steps * -1)
{
    if (speed == 0) ; we are walking
    {
        speed = -1 ; creep
        Send {%key_creep% down}
    }
    else if (speed == 1) ; we are running
    {
        speed = 0 ; walk
        Send {%key_run% up}
    }
    state = 0
}
return

Cheers!

Edited by snatcher

TDM_Modpack_42.png

Link to comment
Share on other sites

  Version 5 of the script posted.

Change-log:

  • v5: To prevents sudden halts when running, a one-second delay has been added between the moment the player stops going forward and the script takes you automatically back to walking mode. To allow for a greater freedom of movement, the script requires to know now your backwards, right and left keys.
  • v4: Altered so that when player is running and stops, you are back to walking mode.
  • v3: The script only runs when TDM is in focus (tested in Win 10)
  • v2: Second version by Obsttorte
  • v1: First version by Obsttorte

------------------------------------

If anyone wants to put it to test, follow below instructions (please note it takes some time to get used to it):

  • Download AutoHotkey, install it, open Notepad, paste the below script inside, save it as TDM.ahk and double click on the file you just saved.
  • Settings > Controls > Weapons: Remove mouse wheel bindings from Next Weapon and Previous Weapon (or from any other setting you may have set the mouse wheel to)
  • Settings > Controls > General: Make sure Toggle Crouch is enabled and Always Run is disabled
  • Settings > Controls > Movement: The Forward, Run and Creep keys must match in both TDM and the script.
  • To end the script, go to the Windows taskbar, look for a green icon with an "H", right click on it and select Exit.

Known limitations:

  • You can turn pages and numbered dials using Next Inv. Item / Prev Inv. Item.
  • To prepare for a long jump from idle, move the mouse wheel up before executing your move
  • You cannot move objects you are holding back and forth
  • You cannot lean forward and switch speeds at the same time, for some reason
  • Warning: fighting is as cumbersome as ever!

 

; =====================================
; Adjust player speed with mouse wheel
; -------------------------------------
; An AutoHotkey script for The Dark Mod
; version 5.0 by Obsttorte & snatcher
; =====================================

; -------------------------------------
; Configure your keys below
; -------------------------------------

; In-game movements keys
key_left = a
key_right = d
key_forward = w
key_backward = s

; In-game creep key
key_creep = c

; In-game run key
key_run = r

; -------------------------------------
; Do not edit anything past this point
; -------------------------------------

delay = 1000 ; delay in miliseconds between running > walking [default = 1000]
speed = 0 ; init speed (-1 = creep | 0 = walk [default] | 1 = run)
steps = 1 ; amount of mouse wheel steps needed for switching state [default = 1]
state = speed * steps ; counter for state switch

#IfWinActive ahk_exe TheDarkModx64.exe ; run only when TDM is focused

HotKey, *~%key_forward% up, keyForwardHandler
return

keyForwardHandler:
if (speed == 1) ; we are running
{
    sleep, delay
    if (!GetKeyState(key_forward) && !GetKeyState(key_backward) && !GetKeyState(key_right) && !GetKeyState(key_left))
    {
        speed = 0 ; walk
        Send {%key_run% up}
    }
}
return

*wheelup::
state += 1
if (state >= steps)
{
    if (speed == -1) ; we are creeping
    {
        speed = 0 ; walk
        Send {%key_creep% up}
    }
    else if (speed == 0) ; we are walking
    {
        speed = 1 ; run
        Send {%key_run% down}
    }
    state = 0
}
return

*wheeldown::
state -= 1
if (state <= steps * -1)
{
    if (speed == 0) ; we are walking
    {
        speed = -1 ; creep
        Send {%key_creep% down}
    }
    else if (speed == 1) ; we are running
    {
        speed = 0 ; walk
        Send {%key_run% up}
    }
    state = 0
}
return

Cheers!

  • Like 1

TDM_Modpack_42.png

Link to comment
Share on other sites

@OktokoloWhat would be the point then? You have two key to control speed now and you would have two keys to control speed then. The only addition might be to allow players to turn those keys into toggles.

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Ansome

      Taking a break to alleviate burnout. In retrospect, I probably shouldn't have jumped into a map-making contest so quickly after just finishing another project and especially with my busy schedule, but I do believe I have something that the community will enjoy. No clue if I'll be able to finish it on time for the competition if I factor in a break, but I'd rather take my time and deliver something of quality rather than engage in development crunch or lose part of the map's soul to burnout.
      · 0 replies
    • Skaruts

      Working on an update for my mission By The Cookbook. If anyone that played it has any further bugs to report, please let me know.
      I posted more details about the update in the mission thread.
      · 1 reply
    • lucien

      being thankful for tdm is a good feeling
      · 0 replies
    • The Black Arrow

      Happy birthday to me!
      Yes, today's my birthday and as much as I want to play The Dark Mod, I won't until it's late Autumn, where it should be a bit chilly in my place and there's some wind too.
      For now, it's time to enjoy my birthday, if any of you want to play a great fan mission in my honour...Well that's asking too much, just play the mission because it's fun, not because of me, enjoy it yourself! 💪
      · 5 replies
    • nbohr1more

      New texture wiki article created: https://wiki.thedarkmod.com/index.php?title=Creating_textures_from_Ornate_Photos
      · 11 replies
×
×
  • Create New...