The stand-alone mod S.T.A.L.K.E.R. Anomaly aims to be the most stable and customizable experience for fans of the S.T.A.L.K.E.R. games. It's powered by the Monolith 64-bit engine, a custom fork of the X-Ray engine.

Description

Script that will holster/un-holster your weapon by holding the reload key.

Preview
Quick Holster Script for Anomaly 1.5.1
Post comment Comments
Guest
Guest - - 691,020 comments

This comment is currently awaiting admin approval, join now to view.

Freedom_is_garbage
Freedom_is_garbage - - 106 comments

Looks like someone playerd too much fallout games)

Reply Good karma Bad karma+10 votes
Zerk.
Zerk. - - 487 comments

"Patrolling the CNPP almost makes you wish for a blowout."

Reply Good karma Bad karma+7 votes
razfarg Author
razfarg - - 9 comments

Guilty as charged.

Reply Good karma+2 votes
templeofninpo
templeofninpo - - 20 comments

Kudos. Cheers.

Reply Good karma Bad karma+1 vote
L4U6H1N6-LUN4T1C
L4U6H1N6-LUN4T1C - - 1,173 comments

or you could simply press the button of the wpns location e.g. 2.....

Reply Good karma Bad karma+11 votes
LESHEN1
LESHEN1 - - 27 comments

Thanks for sharing this, much much appreciated.

Regards,
Leshen

Reply Good karma Bad karma+1 vote
alisen88
alisen88 - - 288 comments

Incredible idea, thanks for sharing, there you have my vote 10/10

Reply Good karma Bad karma+1 vote
Ecklemir
Ecklemir - - 16 comments

Thanks for sharing, now i have more keybinds for me use with my muscular memory

Reply Good karma Bad karma+2 votes
WaddleSquatt
WaddleSquatt - - 6 comments

is it possible to edit this to lower the weapon instead of putting it away?
better yet is it possible to assign it to use the check-ammo script addon?

Reply Good karma Bad karma+1 vote
Freedom_is_garbage
Freedom_is_garbage - - 106 comments

You have button for lowering weapons

(Sorry if it's not what you mean, it's 4 A.M. don't patronise me i had no sleep for 4 days and i'm doing heroin whole time)

Reply Good karma Bad karma0 votes
WaddleSquatt
WaddleSquatt - - 6 comments

i know that but i have a crowded area for keys as it is and it would be amazing to reassign it to holding reload button.

im not familiar with the scripting in this game and i didnt know press_and_hold actions were a possibility and seeing this addon has inspired me to say the least.

if i can manage to script the reload button to run the check ammo addon script bind that would free the key i would originally use to wipe gas mask.

Reply Good karma Bad karma+1 vote
razfarg Author
razfarg - - 9 comments

That should be possible. The general idea was to use CreateTimeEvent on key down to call the relevant function after a delay, and cancel the event if the key is released early.

Reply Good karma+1 vote
Sosoyer
Sosoyer - - 96 comments

like a from fallout

Reply Good karma Bad karma+1 vote
RamseySparrow
RamseySparrow - - 833 comments

good shout thx!

you know what would be even more awesome if you could code it?
Exactly the same mechanic but with weapon ammo selection instead of holstering.

Perhaps if you know how, you could smartly double up on various such elements of the game, to make bindings a little less tedious i.e. tap key for companion menu, hold down the same key to issue move command etc.

Reply Good karma Bad karma+1 vote
WaddleSquatt
WaddleSquatt - - 6 comments

exactly man. the fact that this addon alone brings the ability for press and hold input for binds is bigger than holstering in itself. since last night ive about an hour troubleshooting in stripping down and re-editting the script and re-examining the structure of the scripts language since i have no experience with scripting howeveri do know that this is the only script i noticed so far that i have that has:

RegisterScriptCallback('on_key_release',on_key_release)

as a command.

as well ive noticed:

CreateTimeEvent("quick_holster","toggle",holsterDelay,toggleHolster)
not including holsterdelay in;
RemoveTimeEvent("quick_holster","toggle") - probably due to it likely removing the delay in of itself therefore making it useless

and the fact that "toggle" within the TimeEvent parameters is the only one that doesnt have a function slot present in the script itself.

i sort of get the jist but im trying to figure out what the binds in

elseif bind<28 and bind>21 and gameActive() then
prevSlot = bind-21

means cause i dont have a clue after trying to locate it within the keybinds file and not matching up with whats present.

Reply Good karma Bad karma+1 vote
razfarg Author
razfarg - - 9 comments

Apologies for the lack of comments in the file.

Check out axr_main.script, _g.script, and lua_help.script for info on the callbacks, time events, and key_bindings respectively.

lua_help.script also has a list of available game functions

For the last bit:
--If the pressed key's bound ID is between 22 and 27(bindings for weapon slots 1-6)
elseif bind<28 and bind>21 and gameActive() then
--Subtract 21 to translate keybind ID into equip slot number(1-6)
prevSlot = bind-21
end

Reply Good karma+1 vote
WaddleSquatt
WaddleSquatt - - 6 comments

so say since it would just be pressing the single key that i have ammo_check assigned to just to make it easier and quicker being kCUSTOM24 being = 90 it look like

function on_key_press(key)
local bind = dik_to_bind(key)
if bind == key_bindings.kWPN_RELOAD and gameActive() then
holster_key_pressed()
elseif bind<91 and bind>89 and gameActive() then
prevSlot = bind-91

Reply Good karma Bad karma+1 vote
RamseySparrow
RamseySparrow - - 833 comments

Are you going to be experimenting with that? It really would be kinda groundbreaking if one of you guys with the know-how could smartly streamline some of the game's controls that way, there's huge potential here.

Reply Good karma Bad karma+3 votes
WaddleSquatt
WaddleSquatt - - 6 comments

Man ive been experimenting to a degree in which even my brain rose an eyebrow of concern with my pursuit. im taking a break from it for a while until my eyes stop burning and the frustration buildup to chill out. the last time i went full on into researching and learning code was 6+ years ago when i did the same for CS.1.6 and the 60gb+ folder of editted skins, models and general jumbled unorganized beast that going down that rabbit hole brings.

so far ive got 2 files from the 20+ scripts and edits ive made and even though im still sort of going in blind, i think after a little more tinkering or crashing ill upload it for the community to finish

Reply Good karma Bad karma+1 vote
RamseySparrow
RamseySparrow - - 833 comments

whoa, make sure you don't go blind over this, health and sanity first haha
if it ever comes to fruition I'll be looking out for it, thanks.

my suggestion would be to pair things smartly into tap/hold scheme for:
underbarrel/silencer
firing mode/ammo type
companion menu/quick move here
torch/night vision
toggle walk / hold walk
etc

good luck!

Reply Good karma Bad karma+1 vote
razfarg Author
razfarg - - 9 comments

Here's a stripped down example with all the holstering logic removed and a 1.0 second delay:

function on_game_start()
RegisterScriptCallback('on_key_press',on_key_press)
RegisterScriptCallback('on_key_release',on_key_release)
end

function delayedFunction(parameters)
--Do stuff here
end

function on_key_press(key)
local bind = dik_to_bind(key)
if bind == key_bindings.kCUSTOM24 then
CreateTimeEvent("UniqueEventID","UniqueActionID",1.0,delayedFunction,"optionalParameters")
end
end

function on_key_release(key)
local bind = dik_to_bind(key)
if bind == key_bindings.kCUSTOM24 then
RemoveTimeEvent("UniqueEventID","UniqueActionID")
end
end

Reply Good karma+1 vote
GalaxiT
GalaxiT - - 104 comments

Who needs this mod? Just press key of weapon slot that you want equip or unequip. What a reason invent bicycle again?

Reply Good karma Bad karma+2 votes
razfarg Author
razfarg - - 9 comments

It came from more of a want than a need to be fair. It can cut down on the finger gymnastics if you want to holster or un-holster a weapon, especially if you're using the movement keys at the same time.

Reply Good karma+1 vote
RamseySparrow
RamseySparrow - - 833 comments

as waddlesquatt mentioned, it's less about actual holster specifically and more about ability to code such multi functions since Anomaly is choke-full of keys already some of which could definitely use smart streamlining.

Reply Good karma Bad karma+2 votes
GabeCPB0
GabeCPB0 - - 354 comments

Thanks for this mod! The player can press the reference number of the gun he's using at the said moment, but I find it much more practical, and pleasant, to simply press and hold the reload button.

Cheers!

Reply Good karma Bad karma+1 vote
Ksyphos
Ksyphos - - 2 comments

Nice!
Could you make something similar to gasmask wipe?
Like a hold use key to wipe visor

Reply Good karma Bad karma+2 votes
PradaGT
PradaGT - - 74 comments

Hi. I’m trying to figure out if it’s possible to create an addon that holsters weapons/devices upon entering dialogue. I’d appreciate it if you could try and help me figure this out. It would compliment the DynamicDialogueUI addon perfectly.

Reply Good karma Bad karma+1 vote
BitoOblib
BitoOblib - - 250 comments

Excellent ! I also wish other commands would have been made on the same idea, but this is the one I wanted the most anyway. Thanks !

Reply Good karma Bad karma+1 vote
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account:

Tags

QoL