Jump to content
Forum Login Changes ×
The Dark Mod Forums

Snatcher's Workshop - Mods for The Dark Mod


snatcher

Recommended Posts

Still around?

I just received a shipment from a distant exotic place but it isn't for the faint-hearted, I was told. Come on down. Let's have a look.

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

ADJUST PLAYER SPEED WITH THE MOUSE WHEEL v6.0

Installation and execution:

  • 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. The script will run in the background.
  • To end the script, go to the Windows taskbar, look for a green icon with an "H", right click on it and select Exit.

Configuration:

  • 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, Backwards, Left, Right, Run and Creep keys must match in both TDM and the script.
  • Settings > Controls > Actions: The Parry/Manipulate key must match in both TDM and the script.
  • Settings > Controls > Inventory: The Next Inv. Item and Prev Inv. Item must match in both TDM and the script.

Recommended controls:

  • Forward / Backward / Left / Right: W, S, A, D
  • Run: Z
  • Creep: C
  • Parry/Manipulate: Right Mouse Button
  • Next Inv. Item / Prev Inv. Item: Right Arrow, Left Arrow

Known limitations and workarounds:

  • You can move through the inventory, turn pages, numbered dials and move objects you are holding back and forth using Next / Prev Inv. Item or Parry/Manipulate + the mouse wheel.
  • To prepare for a long jump from idle, move the mouse wheel up before executing your move.
  • Remember the script will switch you automatically from running to walking after one second of inactivity.
  • You cannot lean forward and switch speeds at the same time, for some reason...

 

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

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

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

; In-game run and creep keys
key_run = z
key_creep = c

; In-game manipulate key (recommended right mouse button: RButton)
key_manipulate = RButton

; In-game Next/Prev inventory keys
key_next = Right
key_prev = Left

; -------------------------------------
; 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)
state = speed; 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::
if (GetKeyState(key_manipulate))
{
    Send {%key_next%}
}
else
{
    state += 1
    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
    Sleep, 300
}
return

*wheeldown::
if (GetKeyState(key_manipulate))
{
    Send {%key_prev%}
}
else
{
    state -= 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
    Sleep, 300
}
return

Change-log:

  • v6.0: You can now use as many mouse wheel steps as you like to switch speeds. You can navigate the inventory, turn pages, numbered dials and move objects you are holding back and forth by using Parry/Manipulate plus the mouse wheel.
  • v5.0: 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.0: Altered so that when player is running and stops, you are back to walking mode.
  • v3.0: The script only runs when TDM is in focus (tested in Win 10)
  • v2.0: Second version by Obsttorte
  • v1.0: First version by Obsttorte
Edited by snatcher
  • Like 2

TDM Modpack

Link to comment
Share on other sites

Nice idea! I already have a lot of these mods included in the Unofficial Patch, because I like the all-in-one way to do things ;). but I like the loot-item-reversal mod, which I would like to include too. I'm not sure if a whistle mod is needed, I normally just hit a wall with the blackjack, but I will take a look how simple it is. If you need more ideas, snatcher, check out the "Things that could be improved" thread. A lot of cool ideas have been poster there over the years, but most never did make it into the game...

Edited by wesp5
Link to comment
Share on other sites

14 hours ago, wesp5 said:

Nice idea! I already have a lot of these mods included in the Unofficial Patch, because I like the all-in-one way to do things ;)

Both the Unofficial Patch and these set of mods can coexist independently and complement each other. Such effort would require coordination, a little work and some compromises.

14 hours ago, wesp5 said:

check out the "Things that could be improved" thread. A lot of cool ideas have been poster there over the years, but most never did make it into the game...

Many topics mixed in a single place but sure, I will keep checking pages at random. Thanks.

13 hours ago, wesp5 said:

P.S.: I checked out the whistle and I like it!

Glad you do!

TDM Modpack

Link to comment
Share on other sites

Well mission authors could certainly include modded mechanics such as these directly in their missions if they like - in that sense they would then be available in the mission downloader.

For example I like the flint tool which is now integrated in the unofficial patch and will probably incorporate this “patch” into my mission so all players experience it.

Might be worth pointing out these packs/patches are also tool boxes that represent opportunities for mappers to do more in designing their missions without having to start from scratch instead of solely focusing on the player base interested in altering existing missions - I don’t know how widespread that appeals tbh.

-=  IRIS  =-    ♦    = SLL =

Link to comment
Share on other sites

You can avoid any mod editors by using the Unofficial Patch which has just been updated :)! But speaking of modded mechanics: Snatcher, I noticed that there is loot in Thomas Porter 4 that doesn't have the fly animation. Please check out the Builder church and the loot on the altar and in the desk drawer. I looked inside the map and they are bound to the desk and altar, I also noticed that we don't get the animation when frobing bound items from NPCs. Can this be fixed?

Edited by wesp5
Link to comment
Share on other sites

1 hour ago, Wellingtoncrab said:

Well mission authors could certainly include modded mechanics such as these directly in their missions if they like - in that sense they would then be available in the mission downloader.

For example I like the flint tool which is now integrated in the unofficial patch and will probably incorporate this “patch” into my mission so all players experience it.

Sure but think twice.

A time capsule is a good snapshot of a point in time but content keeps aging the same. When it comes to base content and as of TDM 2.10, including a base script in the mission is like carving that script in stone. If there ever is an improvement or bug-fix for that script there's no (elegant) way players can get the enhancements unless the author updates the mission.

TDM Modpack

Link to comment
Share on other sites

56 minutes ago, wesp5 said:

You can avoid any mod editors by using the Unofficial Patch which has just been updated :)!

Different approaches but thanks for the continued effort and thanks for sharing!

56 minutes ago, wesp5 said:

I noticed that there is loot in Thomas Porter 4 that doesn't have the fly animation. Please check out the Builder church and the loot on the altar and in the desk drawer. I looked inside the map and they are bound to [...]

Interesting case. I will dig deeper if only to understand what's going on with that binding.

56 minutes ago, wesp5 said:

I also noticed that we don't get the animation when frobing bound items from NPCs. Can this be fixed?

I decided to limit the animation to (valuable) loot precisely to avoid the effort and amount of editing required to make other items work. See, I like mods to be as good as possible but as little intrusive as possible at the same time. The more you dig the more you go down the rabbit hole.

Having get used to it, I don't know if the following is a solid reason or simply a justification but: I like the idea that only static loot get the animation. The animation provides a gratifying moment for something that has no value other than numbers. For the rest of the items we have an instant grab and custom sounds to alert the player (keys, potions...) or tension (loot bound to AI).

I will add your request to the list but no promises.

Cheers!

TDM Modpack

Link to comment
Share on other sites

1 hour ago, snatcher said:

Sure but think twice.

I don’t follow really - your mod and others will need to be maintained as well and some very popular missions include alterations to base content of the game - which is one reason I don’t install patches/mods as a player because I know FM authors do this and a patch won’t even work in those circumstances - another benefit of integrating directly into missions is you don’t actually have to replace things when you can just add them.

Just pointing out there may be something of interest to mappers in these mods/patches instead of just players, as mechanics tend to shine when they are accounted for in the design. Even if it’s not for everyone you all seem to put a lot of work into these mechanics - I don’t know how many players mod the game but it’s pretty much a guarantee they all play fms so if you’ve got something cool getting some mappers on board seems like a way for more players to see your work.

  • Like 1

-=  IRIS  =-    ♦    = SLL =

Link to comment
Share on other sites

Very valid arguments, Wellingtoncrab. Food for a lengthy discussion with a couple of pints.

2 hours ago, Wellingtoncrab said:

I don’t follow really

Simple: perhaps someday players ask you directly why the cannot use the latest and greatest gadget or mod in your mission.

2 hours ago, Wellingtoncrab said:

your mod and others will need to be maintained

Yes, with every major version of TDM comes a revision to support +150 mission in one go.

Edited by snatcher

TDM Modpack

Link to comment
Share on other sites

If mission authors stick to the standard procedure and only use tdm_custom_scripts to add unique changes instead of tdm_user_addons which is intended for patches and mods, everything should be fine for most missions. The only exception would be if a mission changes the exact same script a patch or mod changes in another way, in which case I don't know which one is selected first. Maintaining a patch or mod to keep up with all core game revisions is a pain though, so it would be really cool if some of the new features could end up in the core game anyway. For example the reverting of the loot item is such a simple improvement that can't break anything and it should be considered to be part of 2.11 in my opinion! The loot animations are great too, but might need a switch to enable/disable them for players who don't want these. Finally I guess Obsttorte might get the fast doors in, as known developer, while I doubt we can get whistle and blow...

Edited by wesp5
Link to comment
Share on other sites

The script from the fm is selected first - unless the patch puts replacement scripts directly into the fm directory. IIRC That means if a patch edits bow handling for example and installs to the main directory, these would not be compatible with missions that have also edited this (which are many).

I like the loot animation as well and might crib that from the patch if I ever make another mission. The fast doors are cool but I’d be ecstatic to see that blackjack animation prompt make it into 2.11

-=  IRIS  =-    ♦    = SLL =

Link to comment
Share on other sites

@wesp5

Keepers of TDM ($), Senior and Junior Developers, Artists, Mappers, Modders, Players, Supporters, and the odd fellow nobody knows what's doing in here... We all have our place. As long as modders are allowed to exist we shall stick to our business. Nothing will ever be part of the core game, that's the starting point.

TDM Modpack

Link to comment
Share on other sites

9 hours ago, Wellingtoncrab said:

I’d be ecstatic to see that blackjack animation prompt make it into 2.11

Speaking of that, has this already be changed to be the other way around? I found the first version misleading with the blackjack being lowered when the timing is right and therefore didn't use it for the patch. Maybe I should reconsider?

Edited by wesp5
Link to comment
Share on other sites

9 hours ago, snatcher said:

Nothing will ever be part of the core game, that's the starting point.

Maybe right now it is, but I hope that with time more and more people might discover that some of the changes don't affect the core game as much as some purists here believe, and one or the other feature might creep in in the end ;)...

Edited by wesp5
Link to comment
Share on other sites

Ok but let's play safe and activate targets before the bird, in case inv_item triggers something or gets altered.
 

void frob_item(entity inv_item)
{
	// DYNAMIC LOOT INVENTORY MOD
	if ($player1.getCurInvItemName() != "Loot Info")
	{
		thread dynamic_frob_item_thread($player1.getCurInvItemName(), $player1.getLootAmount(LOOT_TOTAL) + inv_item.getFloatKey("inv_loot_value"));
	}

	inv_item.activateTargets($player1);

	// LOOT ANIMATIONS MOD
	// Original source: Noble Affairs mission by Goldwell
	// New functionality by Obsttorte, adjustments by snatcher and wesp
	if (inv_item != $null_entity)
	{
		inv_item.unbind();
		entity bird = sys.spawn("func_static");
		bird.setModel(inv_item.getKey("model"));
		bird.setFrobable(0);
		bird.becomeNonSolid();
		bird.setOrigin(inv_item.getOrigin());
		bird.setAngles(inv_item.getAngles());
//		vector plBody = $player1.getOrigin() + (($player1.getEyePos() - $player1.getOrigin()) * 0.65);
		vector plBody = $player1.getEyePos() - '0 0 20';
		vector moveVec = plBody - bird.getOrigin();
		moveVec_z += inv_item.getFloatKey("frob_offset");
		moveVec /= 24;
		float i;
		for(i = 0; i < 24; i++)
		{
			bird.setOrigin(bird.getOrigin() + moveVec);
			sys.waitFrame();
		}
		bird.remove();
	}
}
Edited by snatcher

TDM Modpack

Link to comment
Share on other sites

1 hour ago, snatcher said:

Ok but let's play safe and activate targets before the bird, in case inv_item triggers something or gets altered.

I will move the active line up there too, but why do we need the null_entity control? Also you changed hide to remove?

Edited by wesp5
Link to comment
Share on other sites

  • snatcher changed the title to Snatcher's Workshop - Mods for The Dark Mod

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.


×
×
  • Create New...