Script that will holster/un-holster your weapon by holding the reload key.
A little script I originally wrote for myself that will holster/un-holster your weapon when you press and hold your reload key. Figured others might enjoy it too.
Created for Anomaly 1.5.1.
This comment is currently awaiting admin approval, join now to view.
Looks like someone playerd too much fallout games)
"Patrolling the CNPP almost makes you wish for a blowout."
Guilty as charged.
Kudos. Cheers.
or you could simply press the button of the wpns location e.g. 2.....
Thanks for sharing this, much much appreciated.
Regards,
Leshen
Incredible idea, thanks for sharing, there you have my vote 10/10
Thanks for sharing, now i have more keybinds for me use with my muscular memory
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?
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)
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.
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.
like a from fallout
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.
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.
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
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
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.
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
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!
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
Who needs this mod? Just press key of weapon slot that you want equip or unequip. What a reason invent bicycle again?
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.
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.
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!
Nice!
Could you make something similar to gasmask wipe?
Like a hold use key to wipe visor
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.
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 !