Forum Jump :

Author Message


Posts: 7
Rank:


Level: Member

Country: us
Location: Pittsburgh
Occupation: Mechanical Engineer
Age: 28
In-game name: [RQ]Viper0317

 
#1 Posted at 2014-08-04 22:19        
     
Hello All,

I am trying to make a mission where we can operate undercover if need be. Undercover being a "setcaptive true/false" state. I do not know/can't figure out how to accomplish this using the Arma 3 scripting language, I barely know enough arma 3 script language to get me by, and really lack the amount of free time to learn at anything but a very slow pace. The mission is persistent so I would like to have this work independently of respawns, such that the code won't stop working after a player dies and respawns. Although it isn't preferred, having an add-action on an object to re-initialize the script after respawn would be ok.

Here's my "code concept" of what I'm trying to accomplish:

IF the 3 weapon slots are empty then "player setcaptive true; hint "Status: Non-Combatant";"
If there is anything in any of those slots then "player setcaptive false; hint "Status: Combatant";"

The 3 weapon slots being the primary, launcher, and sidearm slots on the right side of the inventory menu. This condition will make us appear unarmed and thus a non-combatant, but still allow us to have weapons hidden in a backpack or uniform.

If I knew how to make mods, this would make a cool addon, one could expand on this further and say if distance to an enemy is less than 5 meters they'll point their gun at you and tell you to back off, if it's less than 2 meters they open fire. Along with any number of other conditions one can think of. This would add more immersion and a whole new slew of options for Blufor FIA missions! :)

Thank You in advance!

-Viper0317

#RageQuit [RQ] - Admin, Recruiting and Arma 3 Logistics

Author Message


Posts: 250
Rank:


Level: Member

Country: ca
Location:
Occupation:
Age:
In-game name: austinXmedic

 
#2 Posted at 2014-08-04 23:17        
     
I got something that should work, though I don't think theres any way for me to find if the players got a pistol, if there is one then its named something stupid.

AUSMD_combatantcheck.sqf:
player addEventHandler["Respawn",{execVM "AUSMD_combatantcheck.sqf";}];
while{alive player} do
{
	player setcaptive true; 
	waitUntil{primaryWeapon player != "" || secondaryWeapon player != ""};
	player setcaptive false;
	sleep 5;
};

init.sqf:
execVM "AUSMD_combatantcheck.sqf";

EDIT: Flipped around the condition check so it'll be less stressful on the game.

EDIT EDIT: Nvm that doesn't work, added code that does work.

EDIT EDIT EDIT: Got some other stuff too, will upload it as a script package later.

This post was edited by austin(medic) (2014-08-04 23:56, ago)

Some of my work:
http://steamcommunity.com/sharedfiles/filedetails/?id=287343671 -- Unit Play/ Unit Capture Functions Guide
http://steamcommunity.com/sharedfiles/filedetails/?id=265454265 -- Zeus Guide
add me on steam: austin_medic

Advertisement


Author Message


Posts: 7
Rank:


Level: Member

Country: us
Location: Pittsburgh
Occupation: Mechanical Engineer
Age: 28
In-game name: [RQ]Viper0317

 
#3 Posted at 2014-08-09 04:52        
     
Finally got the chance to give this a shot, all seems to be working pretty well,
Thanks Austin! and thanks for sticking me in the "credit and thanks" on the post!

#RageQuit [RQ] - Admin, Recruiting and Arma 3 Logistics