bennettonn 10 Posted October 18, 2014 Hi guys. I'm with a problem to finish a mission, I want to make a mission where I'll sneak in one place and want the OPFOR identify me as a friend, there's the difficulty, I want OPFOR identify me as if I'm the enemy with a specific weapon for example, if I'm with a katiba they consider me friend but if I'm with a MXM he consider me enemy. if you can help me thank. Share this post Link to post Share on other sites
jshock 513 Posted October 18, 2014 _unit = (_this select 0); _eastGrp = createGroup EAST; _westGrp = createGroup WEST; if (isNull _unit) exitWith {}; while (true) do { if (currentWeapon _unit == "Weapon_arifle_Katiba_F") then { _unit joinSilent _eastGrp; };//<<Change classname to type of weapon you want to be identified for OPFOR side if (currentWeapon _unit == "Weapon_arifle_MXM_F") then { _unit joinSilent _westGrp; };//<<Change classname to type of weapon you want to be identified for BLUFOR side sleep 3; }; Share this post Link to post Share on other sites
bennettonn 10 Posted October 19, 2014 dude sorry but I forgot another thing I want him to identify me as a friend if I'm with a specific outfit also Share this post Link to post Share on other sites
jshock 513 Posted October 19, 2014 dude sorry but I forgot another thing I want him to identify me as a friend if I'm with a specific outfit also Well do you want it identified as "friend" when you have both the uniform and the weapon, or just one or the other? I would recommend that you have to have both because if it's either the unit will switch sides constantly if he has a "friendly" uniform on, but has an "enemy" weapon. Below is with the recommended changes: //Forgot the call line for this script goes in the unit's init field as: null = [this] execVM "scriptName.sqf"; _unit = (_this select 0); _eastGrp = createGroup EAST; _westGrp = createGroup WEST; if (isNull _unit) exitWith {}; while (true) do { if ((currentWeapon _unit == "Weapon_arifle_Katiba_F") && (currentUniform _unit == "Classname")) then { _unit joinSilent _eastGrp; };//<<Change classname to type of weapon you want to be identified for OPFOR side if ((currentWeapon _unit == "Weapon_arifle_MXM_F") && (currentUniform _unit == "Classname")) then { _unit joinSilent _westGrp; };//<<Change classname to type of weapon you want to be identified for BLUFOR side sleep 3; }; Share this post Link to post Share on other sites
iceman77 19 Posted October 19, 2014 (edited) dude sorry but I forgot another thing I want him to identify me as a friend if I'm with a specific outfit also Jshock's code edited. Cheers. private ["_unit", "_eastGrp","_westGrp"]; _unit = player; _eastGrp = createGroup EAST; _westGrp = createGroup WEST; if (isNull _unit) exitWith {}; while { true } do { sleep 3; if ( ( currentWeapon _unit ) in ["Weapon_arifle_Katiba_F", "some_launcher", "some_pistol"] && { ( uniform _unit ) in ["uniform_className1","uniform_className2"] } ) then { if ( !( _unit in ( units _eastGrp ) ) ) then { _unit joinSilent _eastGrp; }; } else { _unit joinSilent _westGrp; }; }; Oops, ninja'd by Jshock :) ---------- Post added at 16:35 ---------- Previous post was at 16:26 ---------- Edit: Replaced the ( ) brackets for the while condition to { } brackets. Cheers. Edited October 19, 2014 by Iceman77 Wrong brackets in the while condition supposed to be {} ! () Share this post Link to post Share on other sites
jshock 513 Posted October 19, 2014 Edit: Replaced the ( ) brackets in the while condition to { } brackets. Cheers. OMG....thanks again Iceman, sorry we are using Java in my CS class....ugh........and while loop syntax is with ( ) not { } Share this post Link to post Share on other sites
iceman77 19 Posted October 19, 2014 (edited) Ha, I did that the otherday. While (_) do { //hehe }. Someone or another caught it thankfully. Except I don't have a legit excuse LOL. Brain farts :p ---------- Post added at 16:53 ---------- Previous post was at 16:40 ---------- Fixed one more syntax error with joinSilent and also added a check before joining the group. Cheers. private ["_unit", "_eastGrp","_westGrp"]; _unit = _this select 0; _eastGrp = createGroup EAST; _westGrp = createGroup WEST; if (isNull _unit) exitWith {}; while { true } do { sleep 3; if ( ( currentWeapon _unit ) in ["arifle_Katiba_ACO_F", "launch_RPG32_F", "hgun_Rook40_F"] && { ( uniform _unit ) in ["U_O_CombatUniform_ocamo", "someOther_uniform"] } ) then { if ( !( _unit in ( units _eastGrp ) ) ) then { [_unit] joinSilent _eastGrp; player sideChat "You've joined the east group."; }; } else { if ( !( _unit in ( units _westGrp ) ) ) then { [_unit] joinSilent _westGrp; player sideChat "You've joined the west group."; }; }; }; Edited October 19, 2014 by Iceman77 Share this post Link to post Share on other sites