Jump to content
MasterPuffin

[Release] Holster Weapon Script

Recommended Posts

When executed, this script will holster your weapon, or puts it on your back. You can draw your weapon again using 1 or 2 on your keyboard.

player action ["SWITCHWEAPON",player,player,-1];
waitUntil {currentWeapon player == "" or {primaryWeapon player == "" && handgunWeapon player == ""}};

You can either use addaction or a keyhandler to execute the script. 

 

If you have any questions or need help with your mission feel free to ask!

Cheers

Puffin

  • Like 4

Share this post


Link to post
Share on other sites

Hey,

 

i tried to use your script for my private stratis trainingsfield server for me and my friendds.

I used copy and paste for the script into my addAction.sqf but it doesn't work .... did i forget something else? Please help me 😵

sincerely, Kilian 

Share this post


Link to post
Share on other sites
1 hour ago, Silberpfeil95 said:

I used copy and paste

 

There's an invisible/corrupt character present when you copy the code above:

 

99TcGZ1.png

 

When pasted into a code block, they appear as red dots. You can simply delete them. Here's a clean version:

player action ["SWITCHWEAPON",player,player,-1];
waitUntil {currentWeapon player == "" or {primaryWeapon player == "" && handgunWeapon player == ""}};
  • Like 1

Share this post


Link to post
Share on other sites

Hey Harzach,

thank you so much for your fast reply! I use your clean version for my addAction.sqf ... but i cant find any options inGame for weapon holster o.O 

 

Share this post


Link to post
Share on other sites
3 hours ago, Silberpfeil95 said:

my addAction.sqf

 

Show your code. Also, how are you calling the script?

Share this post


Link to post
Share on other sites

I used your code 1:1 into my addActions.sqf ... what do you mean with "how are you calling" ? 
Did i have to edit an other folder oder sqf file?

player action ["SWITCHWEAPON",player,player,-1];
waitUntil {currentWeapon player == "" or {primaryWeapon player == "" && handgunWeapon player == ""}};

 

Share this post


Link to post
Share on other sites

An .sqf file sitting in your mission folder does nothing until it is called - with the exception of event scripts, which we'll use below.

 

If you have an .sqf file in your mission folder named "addAction.sqf" then it needs to be called (I.E. run/executed/etc.) in some way. Since this is for your multiplayer scenario, it would probably be fine to call it from both initPlayerLocal.sqf and onPlayerRespawn.sqf (if you have respawns enabled.) If those event scripts don't already exist in your mission folder, you must create them.

 

initPlayerLocal.sqf:

params ["_player", "_didJIP"];

_player execVM "addAction.sqf";

onPlayerRespawn.sqf:

params ["_newUnit", "_oldUnit", "_respawn", "_respawnDelay"];

_newUnit execVM "addAction.sqf";

addAction.sqf:

params ["_player"];

_player action ["SWITCHWEAPON", _player, _player, -1];
waitUntil {currentWeapon _player == "" or {primaryWeapon _player == "" && handgunWeapon player == ""}};

Note that "player" is now the local variable "_player" in addAction.sqf.

  • Like 1

Share this post


Link to post
Share on other sites

Thank you so much for your help and your time !!! 😰

Your script worked perfectly! but i need a script like the holster script in wasteland ... with your script, the player holstered the weapon instantly after joining the server. but my wish is it to holster weapon whenever i want it. Do you understand what i mean? 😄

Share this post


Link to post
Share on other sites
15 hours ago, Silberpfeil95 said:

Thank you so much for your help and your time !!! 😰

Your script worked perfectly! but i need a script like the holster script in wasteland ... with your script, the player holstered the weapon instantly after joining the server. but my wish is it to holster weapon whenever i want it. Do you understand what i mean? 😄

 

If so, you must use the addaction command in your addAction.sqf script
Like:

params ["_player"];

_player addAction ["Text you like", {(_this select 0) action ["SWITCHWEAPON", (_this select 0), (_this select 0), -1];}];

It seems to me that for your idea, the waitUntil loop is useless.

  • Like 2

Share this post


Link to post
Share on other sites

Okay thank you for your help! I`ll test asap! 
But i have a other question .... i got this error report every time i start my private wasteland server:

Quote

No entry 'bin\confic.bin/CfgWorlds.Tanoa-dev'

But i cant find the right solution -.- can you help me pls? 🤕

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×