1ncontinentia / Incon-Undercover

Incontinentia's undercover / incognito simulation script for Arma 3
GNU General Public License v3.0
29 stars 8 forks source link

Issues getting script to work in latest version of Arma #28

Closed Jebudiah closed 5 years ago

Jebudiah commented 7 years ago

Noticed players being able to stay incognito permanently after successfully waiting out the spotted timer. https://github.com/Spearhead-Gaming-Milsim/Tanoa-Takedown/issues/11

1ncontinentia commented 7 years ago

Hi @Jebudiah - cheers for the report. I've responded in your linked issue but any more information would be really useful.

1ncontinentia commented 6 years ago

Nothing more heard... closing issue.

Will-Nichols commented 5 years ago

So I think we need to reopen this one since the initial report is from our community. We are attempting to run the incognito script again and our players are getting stuck in one mode or the other. Their base character is the vanilla Syndikat unit and I am scripting in a civilian clothing loadout as well as some items that are being called by the ucr_setup.sqf file.

1ncontinentia commented 5 years ago

I can’t solve this without more pointers. Could you run it in debug and provide a few more details? To start with, knowing what the debug hints and text say when the player is stuck would be really helpful. Also mod list would be useful too.

Will-Nichols commented 5 years ago

Will do; however I just updated yesterday to the newest version and now I can't get into incognito mode at all with the newer version. I will run it in debug as well and give you some more details..

Will-Nichols commented 5 years ago

Here is the modlist for the mission:

https://cdn.discordapp.com/attachments/342834553486049292/515909190175162369/Arma_3_Mod_Preset_Operation_Tanoa_Takedown.html

Will-Nichols commented 5 years ago

How do you get the hints for the debug? I was just running down the road in my clothing with setup as a civilian and got shot at and my gps was showing me as an independent instead of being in a civilian role.

Help

Will-Nichols commented 5 years ago

Here is my RPT for the test I just ran.

https://www.dropbox.com/s/673z5if8gqfrsvx/Tanoa_Takedown_RPT.rpt?dl=0

1ncontinentia commented 5 years ago

Have you tried running the script in debug with hints on (settings at the top of the setup.sqf)? Also if this wasn’t the most recent version, I can’t exactly support it... as for not being able to get into incognito mode, the chances are you’re wearing something that gives you away or carrying a weapon somewhere visible. Can you also send the setup.sqf you’re using? I’m going to close the other issue as we don’t need two.

1ncontinentia commented 5 years ago

Just seen the mod list. I suspect there’s a bit of user error here somewhere but we’ll need to track it down. Might be that a mod makes a duplicate uniform that the script doesn’t know about and you’re trying to use it to go incognito. Either way, I need your setup.sqf and a description of what the debug says on screen (will help if you use hints on easy mode, again in the setup.sqf) when you think you should be civilian and you’re not. The debug will also allow you to open up the virtual arsenal and add items until you find the offending one, so you can do that too.

Will-Nichols commented 5 years ago

I am running the latest Incognito files from your last release in August. If you are interested in taking a peek at the mission itself our Test server is up and running. I will be glad to let you run around in Zeus and see what is happening; also feel free to drop into our Discord or TeamSpeak whenever you want to in order to talk or go over what is happening with items or if you need a dedicated multiplayer ALiVE mission to test something on. SpyderBlack hangs out in there with us as does AuburnAlumni from the ALiVE boards.

When I am running debug I am not getting hints or able to open the virtual arsenal. I have coded the boxes to only load the civilian type clothing for the independent players to limit what they are able to wear outside of the Chinese uniforms they are able to take from the AI or the police forces. It is possible that I have a typo somewhere but I basically

Tanoa Takedown UCR_setup.sqf file

I added the postInitXEH.sqf file and have it called in the Description.ext as you have it in the readme

The unit that I used in the test last night was using the following script for loadout.

//comment "Exported from Arsenal by Nichols";
//[this,"Molokous4"] execVM "loadouts\Molokous4.sqf";

waitUntil {!isNull player};
_unit = _this select 0;

comment "Remove existing items";
removeAllWeapons _this;
removeAllItems _this;
removeAllAssignedItems _this;
removeUniform _this;
removeVest _this;
removeBackpack _this;
removeHeadgear _this;
removeGoggles _this;

comment "Add containers";
_this forceAddUniform "U_C_WorkerCoveralls";
_this addHeadgear "H_Bandanna_surfer";
_this addGoggles "G_Sport_BlackWhite";

comment "Add weapons";
_this addWeapon "Binocular";

comment "Add items";
_this linkItem "ItemMap";
_this linkItem "ItemCompass";
_this linkItem "ItemWatch";

comment "Set identity";
_this setFace "TanoanHead_A3_05";
_this setSpeaker "Male01FRE";

comment "Set Medical Class";
_this setVariable ["ace_medical_medicClass",2];

Also the unit code from the mission.sqm file:

                class Item3
                {
                    dataType="Object";
                    class PositionInfo
                    {
                        position[]={1352.1038,9.9704084,8093.4429};
                        angles[]={6.2671833,2.0839405,0.17162824};
                    };
                    side="Independent";
                    flags=4;
                    class Attributes
                    {
                        skill=0.40000001;
                        init="call{[this,""Molokous4""] execVM ""loadouts\Molokous4.sqf""; this setVariable [""isSneaky"",true,true]; this setdamage 1;}";
                        description="Molokous 4";
                        isPlayable=1;
                        class Inventory
                        {
                            class binocular
                            {
                                name="Binocular";
                            };
                            class uniform
                            {
                                typeName="U_C_WorkerCoveralls";
                                isBackpack=0;
                            };
                            map="ItemMap";
                            compass="ItemCompass";
                            watch="ItemWatch";
                            radio="ItemRadio";
                            goggles="G_Sport_BlackWhite";
                            headgear="H_Bandanna_surfer";
                        };
                    };
                    id=38556;
                    type="I_C_Soldier_base_unarmed_F";
                    class CustomAttributes
                    {
                        class Attribute0
                        {
                            property="acex_headless_blacklist";
                            expression="_this setVariable [""acex_headless_blacklist"",_value,true]";
                            class Value
                            {
                                class data
                                {
                                    class type
                                    {
                                        type[]=
                                        {
                                            "BOOL"
                                        };
                                    };
                                    value=0;
                                };
                            };
                        };
                        class Attribute1
                        {
                            property="speaker";
                            expression="_this setspeaker _value;";
                            class Value
                            {
                                class data
                                {
                                    class type
                                    {
                                        type[]=
                                        {
                                            "STRING"
                                        };
                                    };
                                    value="Male03FRE";
                                };
                            };
                        };
                        class Attribute2
                        {
                            property="pitch";
                            expression="_this setpitch _value;";
                            class Value
                            {
                                class data
                                {
                                    class type
                                    {
                                        type[]=
                                        {
                                            "SCALAR"
                                        };
                                    };
                                    value=1.03;
                                };
                            };
                        };
                        nAttributes=3;
                    };
                };

This is my Description.ext file:

//Author="Nichols (Task Force Red)";

OnLoadName = "Tanoa Takedown";
OnLoadMission = "Tanoa Archipelago; Fiji";
overviewPicture = "USSF_leading_patrol.jpg";

class Header
{
    gameType = COOP; // Game type, see 'class' columns in the table below
    minPlayers = 4; //min # of players the mission supports
    maxPlayers = 74; //max # of players the mission supports
};

enableDebugConsole = 1;
cba_settings_hasSettingsFile = 1;

respawn = 3;
respawndelay = 15;
respawnOnStart = -1;
respawnDialog = 0;
DisabledAI = true;

class Extended_InitPost_EventHandlers {
     class CAManBase {
        init = "_this call (compile preprocessFileLineNumbers 'postInitXEH.sqf')";
    };
};

class CfgFunctions
{
    #include "INC_undercover\cfgFunctions.hpp"
};

class CfgRemoteExec
{
   class Functions
   {
       mode = 2;
       jip = 1;
       #include "INC_undercover\functionsWhitelist.hpp"
   };
};

class Extended_PreInit_EventHandlers {
    VCM_CBASettings = call compile preprocessFileLineNumbers "Vcom\Functions\VCM_CBASettings.sqf";
};

Here is initPlayerLocal.sqf:

waitUntil {!isnull player};
missionNamespace setVariable ["tfr_playerSpawnData",[getpos player,getUnitLoadout player]]; 

player addMPEventHandler ["MPRespawn", { 

_parameters = missionNamespace getVariable "tfr_playerSpawnData"; 
_respawnLoadout = _parameters select 1;
_respawnPos = _parameters select 0;
player setUnitLoadout _respawnLoadout; 
_respawnPos 
}]; 

if (player getVariable ["isSneaky",false]) then {
    [player] execVM "INC_undercover\Scripts\initUCR.sqf";
};
1ncontinentia commented 5 years ago

Have you got:

this setVariable [“isSneaky”,true,true];

In the undercover unit object’s init?

1ncontinentia commented 5 years ago

If you’ve set debug to true in the setup file and you’re still not getting debug hints then the script isn’t initialising at all. Which might explain why you’re getting shot at too. Also, I’ve noticed on your github that your racial profiling is set pretty high. 1 is normal for most situations, 2 is already pretty extreme, 7 will likely cause enemies to be so sensitive it could break the script a bit. I’ll add a note to comment this in to the setup file when I can.

Will-Nichols commented 5 years ago

Have you got: this setVariable [“isSneaky”,true,true]; In the undercover unit object’s init?

Yes that setVariable command is in all non-SOCOM slots in the mission.

Will-Nichols commented 5 years ago

As for the racial profiling aspect I wasn't sure what the cutoff could be for that since the main protagonist in the mission is a Chinese invading force they would be extremely negative towards any non-Chinese forces wearing their clothing.

However I wasn't thinking that it would kick it over on the start of someone wearing the clothing for the civilian AI instead of the military or police. I will drop that back down to 1 and start from there.

Will-Nichols commented 5 years ago

I have no side declared in the _asymEnySide function; should I have a side declared instead of _asymEnySide = sideEmpty; because my next setting there is _asymBarbaric = true and I read that you can't have 2 sides listed as true or it gives out errors as well.

1ncontinentia commented 5 years ago

It shouldn’t give out visible errors, but the script will quit if there are incompatible elements. Having asym faction set up as it is should be fine (I think).

Thanks for all the info. I’ll try to have a proper look this weekend but am turbo busy at the moment and not playing Arma at all.

In the meantime, it might be worth just getting a little test mission up to see if you can see the script working properly in it’s vanilla habitat. That should be fairly straightforward, and if you have the same issue there it will be far easier to debug.

Will-Nichols commented 5 years ago

Will do and I will keep you updated.

Will-Nichols commented 5 years ago

OK now I can't get incognito to initialize at all. It appears to just say undercover initializing and then goes away but whenever I change clothing and remove all weapons with NO AI near me or in sight of my player it stays in the non-civilian state.

1ncontinentia commented 5 years ago

Is this in a simplified vanilla mission?

1ncontinentia commented 5 years ago

Honestly if the script was this badly broken I imagine I would have heard about it sooner... are you sure you’re following every step of the instructions in a clean vanilla environment?

Will-Nichols commented 5 years ago

Nope that is my next step. It worked briefly the other day with the debug function turned on but now it will not even show anything in Debug.

Will-Nichols commented 5 years ago

I might have just found a user error on my end that I had; which may have been breaking the whole dang thing. I honestly am not sure at the moment because I need to pull the initPlayerLocal.sqf from the server to make sure but I might have been missing an entire section of the code. I will am going to reupload this to the server and give it a shot tonight. If not then I don't know what I am going to do. I am at my wits end on this sucker.

1ncontinentia commented 5 years ago

Well it seems you’re trying to do step 5 without attempting step 1... seriously, just make a tiny mission locally (all it takes is adding a player and a couple of enemies nearby - the script itself is virtually a copy-paste job), see if it activates properly, then if it does, check it on the server. If that fails, we might have a bug, in which case send me the vanilla test mission and I can try to work out what is going wrong and make a fix. If on the other hand it works as expected, it most likely means it’s been added to your mission wrong. In the latter case, go through the steps one by one (there aren’t all that many) and ensure the script is added properly to the mission.

I am at my wits end on this sucker

Bit dramatic no? I spent a shit load of time earlier this year debugging this script and making it as foolproof as possible, partly as a result of your (not massively helpful) feedback on the alive forums about the script being “iffy”. Although I don’t play Arma anymore, I’m still happy to fix actual bugs, but if a bug can’t be reproduced in something resembling a vanilla environment that makes things difficult.

Last thing, have you tried not setting damage to 1 in the units’ inits?

Will-Nichols commented 5 years ago

I am sitting down this morning and giving it a shot to see what I can figure out with the basic repro; and haven't been around my game computer for a couple of days in order to toss those pieces together and get it done.

For the code I was sitting at a restaurant waiting on a customer to get there and I was looking at the different files from your GitHub. I haven't coded anything in the last 25+ years since learning Basic, Pascal and C way back in the old days. So I can pick up some variations and understand the tenets of the code but I am learning the functions used in Arma; so its pretty easy to sit somewhere and read the code and compare to mine.

With the drama part on the wits end comment...no; I am just confused as to why this isn't functioning. Having followed the steps and the code inserts as they should be done according to the BI Wiki for scripts and where they should be called in the mission files I am super confused about it because it works then it stops working. Personally; I tend to be a perfectionist when I build a mission and it frustrates me when I can't get something to function as I intend it to work.

Also; I thought what I wrote about the script not functioning 100% the time was spot on. For most of our mission makers if we are using the other script I used it does work but it doesn't allow customization to the point your does and I have been this mission and your script is the key to getting the functionality to work as I need it to work. However; sometimes mods and scripts get tweaked and adjusted and I can't catch the changes until I run it on the dedicated server we have.

1ncontinentia commented 5 years ago

code inserts as they should be done according to the BI Wiki for scripts and where they should be called in the mission files I am super confused about it because it works then it stops working

It should largely be a case of drag and drop for my script. You shouldn't have to code or call anything, apart from adding the variable to the unit inits.

When you say it works then stops, I still really need more specifics. How do you know it works? When does it stop? Have you run it in debug? What does debug say? Can you get it to run in a clean vanilla environment? If we're going to keep this issue open, I need more than just "it's sort of broken sometimes".

These are the instructions:

USAGE

  1. Add all files from Incon-Undercover folder into your mission folder. If you already have a description.ext or initPlayerLocal.sqf then add the code to your existing files. (Make sure to delete any previous version of my undercover scripts). In description.ext, if the class is already defined (for instance, cfgFunctions), just add the #include line to the given class.

  2. Configure your settings in the UCR_setup.sqf file in the INC_undercover folder (pay close attention to these, one wrong setting can lead to some weird behaviour).

  3. For each out of bounds area, place a marker over the area with "INC_tre" somewhere in the marker name (e.g. "MyMarkerINC_tre" or "INC_tre_sillyMarkerName_15"). The script will handle the rest. But if you want, you can also include other markers by listing them in the relevant array in UCR_setup.sqf.

  4. Add in Incon Persistence if you want your band of merry men to persist between ALiVE sessions (this is now a separate script but automatically persists reputation).

  5. For each playable undercover unit, put this in their unit init in the editor:

this setVariable ["isSneaky",true,true];

Does the script not initialise when you follow these? Do I need to take another look at them?

Will-Nichols commented 5 years ago

Got a pretty in depth write up; at least I think so for you; but I can't finish it up tonight. I will post it tomorrow when I get back from work.

Will-Nichols commented 5 years ago

OK I went through it step by step yesterday and found something that I have never seen before. Indulge me for a minute so I don't forget this. Also its on the last page of notes I took yesterday.

Steps I took for reproduction....

  1. Files and folders are added into the different existing description.ext and initPlayerLocal.sqf files. Since it was a basic non-Alive reproduction I rebuilt from the ground up.

Description.ext follows:

//Author="Nichols (Task Force Red)";

OnLoadName = "Incon-Undercover Vanilla Testing Mission";
OnLoadMission = "Testing Incon-Undercover vanilla no mods";
overviewPicture = "";

class Header
{
    gameType = COOP; // Game type, see 'class' columns in the table below
    minPlayers = 1; //min # of players the mission supports
    maxPlayers = 10; //max # of players the mission supports
};

enableDebugConsole = 1;
cba_settings_hasSettingsFile = 1;

respawn = 3;
respawndelay = 15;
respawnOnStart = -1;
respawnDialog = 0;
DisabledAI = true;

class Extended_InitPost_EventHandlers {
     class CAManBase {
        init = "_this call (compile preprocessFileLineNumbers 'postInitXEH.sqf')";
    };
};

class CfgFunctions
{
    #include "INC_undercover\cfgFunctions.hpp"
};

class CfgRemoteExec
{
   class Functions
   {
       mode = 2;
       jip = 1;
       #include "INC_undercover\functionsWhitelist.hpp"
   };
};`

**InitPlayerLoad.sqf follows:**

`waitUntil {!isnull player};
missionNamespace setVariable ["tfr_playerSpawnData",[getpos player,getUnitLoadout player]]; 

player addMPEventHandler ["MPRespawn", {
    _parameters = missionNamespace getVariable "tfr_playerSpawnData"; 
    _respawnLoadout = _parameters select 1;
    _respawnPos = _parameters select 0;
        player setUnitLoadout _respawnLoadout; 
    _respawnPos
}]; 

if (player getVariable ["isSneaky",false]) then {

    [player] execVM "INC_undercover\Scripts\initUCR.sqf";
  1. UCR_setup.sqf file completed and fleshed out for a vanilla test. No mods used at all for this other than ALiVE, ACE, TFR Tanoa Takedown Mission ACE3 Files (ACE Optionals for allowing uniforms) and CBA.

UCR_setup.sqf follows:

/*

Setup options for INC_undercover undercover / civilian recruitment script by Incontinentia.

Please check each setting carefully otherwise the script may not function properly in your scenario. All classnames must have quotation marks ("Item_Random_F")

*/

//-------------------------Player settings-------------------------

_undercoverUnitSide = independent;             //What side is/are the undercover unit(s) on? (Can be east, west or independent - only one side supported)

//-------------------------General Settings-------------------------

_debug = true;                         //Set to true for debug
_fullAIfunctionality = true;            //Enable all checks on AI (may degrade performace very slightly for large groups, 15+)
_easyMode = true;                       //Disguise checks will also reveal if the player's disguise is working or not

_racism = true;                         //Enemies will notice if you aren't the race of the faction you're pretending to be (making you easier to detect if nothing is covering your face)
_racProfFacCiv = 1;                     //(Number) Multiplies the effect of racial profiling. Lower this number to simulate more multicultural civilian population
_racProfFacEny = 1;                     //(Number) Multiplies the effect of racial profiling. Lower this number to simulate more multicultural enemy forces

_regEnySide = east;                     //Units of this side will be classed as regular enemies (Side: can be east, west, independent) - if you don't need this, comment the line out (i.e. put // before _regEnySide, as in //_regEnySide = east;).
_regBarbaric = false;                   //(Bool - true or false) Will this side lash out on civilians if it takes casualties and doesn't know the attacker?
_regDetectRadius = 10;                  //Default detection radius for regular troops (this will expand and contract based on weather, time of day, and how the undercover unit is acting - civilians within this radius will be under much more scrutinty)

//_asymEnySide = sideEmpty;              //Units of this side will be classed as asymetric enemies (Side: can be east, west, independent) - if you don't need this, comment the line out (i.e. put // before _asymEnySide, as in //_asymEnySide = east;).
//_asymBarbaric = true;                   //(Bool - true or false) Will this side have a small chance of lashing out on civilians if it takes casualties and doesn't know the attacker?
//_asymDetectRadius = 15;                 //Default detection radius for asym troops (this will expand and contract based on weather, time of day, and how the undercover unit is acting - civilians within this radius will be under much more scrutinty)

_globalSuspicionModifier = 1;           //Scales the level of suspicion of enemies. 1 is default, 2 means units are twice as likely to see through undercover unit's disguises, 0.5 means half as likely etc.

//-------------------------Civilian Disguise settings-------------------------

_civFactions = ["CIV_F"]; //Array of factions whose vests are safe for undercover units to wear

//(Array of classnames) Safe vests (on top of the specific factions above - useful if faction has randomisation script or to add items that are not used by the faction)
_civilianVests = [];

//(Array of classnames) Safe uniforms (on top of the specific factions above - useful if faction has randomisation script or to add items that are not used by the faction)
_civilianUniforms = [];

//(Array of classnames) Safe headgear (will automatically include civilian headgear classes - useful if faction has randomisation script or to add items that are not used by the faction)
_civilianHeadgear = [];

//(Array of classnames) Safe backpacks (will automatically include civilian backpack classes - useful if faction has randomisation script or to add items that are not used by the faction)
_civilianBackpacks = ["B_FieldPack_blk","B_FieldPack_cbr","B_FieldPack_khk","B_Carryall_khk","B_TacticalPack_blk","B_TacticalPack_rgr","B_TacticalPack_oli"];

//(Array of classnames) Safe vehicles to drive in (automatically includes vehicles from the civilian factions above).
_civilianVehicleArray = [];

_HMDallowed = false; //(Bool - true or false) Are HMDs (night vision goggles etc.) safe to wear for units pretending to be civilians? Set to false if wearing HMDs will cause suspicion (must be stored in backpack).

_noOffRoad = false; //Civilian vehicles driving more than 50 meters from the nearest road will be considered hostile

//-------------------------Enemy Disguise settings-------------------------
_incogFactions = ["OPF_F"]; //Array of enemy factions whose items and vehicles will allow the player to impersonate the enemy

 //Names of additional markers for areas that would be considered trespassing (any with "INC_tre" - case sensitive - somewhere in the marker name will automatically be included)
_trespassMarkers = ["highsecurity1"];

//(Array of classnames) Safe vests (on top of the specific factions above - useful if faction has randomisation script or to add items that are not used by the faction)
_incognitoVests = [];

//(Array of classnames) Safe headgear (will automatically include incog headgear classes - useful if faction has randomisation script or to add items that are not used by the faction)
_incognitoHeadgear = [];

//(Array of classnames) Safe backpacks (will automatically include incog backpack classes - useful if faction has randomisation script or to add items that are not used by the faction)
_incognitoBackpacks = [];

//(Array of classnames) Safe uniforms (on top of the specific factions above - useful if faction has randomisation script or to add items that are not used by the faction)
_incognitoUniforms = [];

_incogVehArray = []; //(Array of classnames) Additional incognito vehicles (vehicles from the faction above will automatically count, as will all _highSecVehicles)

//-------------------------High security zone settings-------------------------
/*
High security zones are areas that can only be entered with specific uniforms / items, even if the unit is disguised as an enemy.
For instance, it could be a radar installation or a marker in the vicinity of a high value target that only specially designated units are allowed near.
All high security zones are automatically considered non-civilian territory, but units dressed as enemies can enter without being instantly considered hostile, but they will attract a LOT more attention.
In these settings, you can .
*/

_highSecMarkers = ["highsecurity1"];                    //Names of additional markers for areas that are designated high security zones that require specific uniforms to enter without raising suspicion (any with "INC_highSec" - case sensitive - somewhere in the marker name will automatically be included)

_highSecInstantHostile = false;         // If true, units entering high security areas with the wrong uniform will be instantly deemed hostile by enemy forces. If false, it will be highly suspicious.

_highSecVehicles = [];                  // (Array of classnames) Vehicles that can enter high security areas without raising suspicion (uniforms will still be noticed according to how open the vehicle is)

_highSecurityUniforms = [];             // (Array of classnames) Uniforms that allow entry into high security areas (defined by high security markers)

_highSecItemCheck = true;               // Check for disallowed items that aren't in the permitted list? Each non-permitted item will incur a suspicion penality. Set to false if high security checks just include uniform only.

_highSecItems = [];                     // (Array of classnames) List of items such as vests, headgear, hats etc., that won't cause suspicion in high security areas (only works on foot for now)

_hsItChkOutside = true;                 // The high security item check will occur if wearing a high security uniform even in non-high security zones. Useful if the high security uniform is, for example, a businessman or scientist, who would look weird carrying a gun and helmet.

_hsMustBeUnarmed = true;               // Units carrying weapons will be considered hostile (requires _highSecItemCheck to be set to true).

_highSecItemCheckScalar = 1;            // Multiplies the level of suspicion caused by each suspect item when in a high security zone

//-------------------------Civilian recruitment settings-------------------------
/*
By enabling civilian recruitment, undercover can recruit any ambient civilians they see into their group (if their reputation allows / the civvy wants to join).
Civilians will operate under similar restrictions to the player.
You can also dismiss your new teammates and they will leave your group and carry on doing whatever it is they fancy doing (usually sitting cross-legged in the middle of a field).
*/

_civRecruitEnabled = true;          //(Bool - true or false) Set this to false to prevent undercover units from recruiting civilians
_armedCivPercentage = 70;           //(Number - 0 to 100) Max percentage of civilians armed with weapons from the array below, either on their person or in their backpacks (will only work if _civRecruitEnabled is set to true, otherwise this is ignored)

//Weapon classnames for armed civilians (array of classnames)
_civWpnArray = ["arifle_AKS_F","arifle_AKM_F","hgun_Pistol_01_F","hgun_Rook40_F","hgun_ACPC2_F","hgun_Rook40_F"];

//Items that civilians may carry
_civItemArray = ["ACE_Cellphone","ACE_Flashlight_KSF1","ACE_SpraypaintBlack","itemRadio","ACE_RangeCard","ACE_key_civ","ACE_key_lockpick","ACE_fieldDressing"];

//Civilian backpack classes (array of classnames)
_civPackArray = ["B_FieldPack_blk","B_FieldPack_cbr","B_FieldPack_khk","B_FieldPack_oucamo","B_Carryall_cbr"];

3. In the UCR_setup.sqf as you can see I created a single high security zone but I also created a single trespassing area as well and it is named "INC_tre1".
  1. Didn't add in the persistence aspect....thinking about it for the future but not for the test.

  2. When building the simple mission for reproduction in the editor I found that when I entered the code this setVariable ["isSneaky", true,true]; into the unit init field it got a return of the following in this linked picture ; never had that pop up before yesterday that I can remember. So since it was missing a variable I had to name the slot in the variable text field for the unit before it would allow me to move on in the editor.

So the follow up I have on this is; does this matter at all when setting up the unit?

The ones in my insurgent mission do not have variable names but they are named for their individual slots so the guys know where they are loading in but their loadout script that sets their clothing is called via the object init field in the following manner:

[this,"Molokous1"] execVM "loadouts\Molokous1.sqf"; this setVariable ["isSneaky",true,true];

So short answer when I did that in a reproduction mission with base assets I got nothing.

Will-Nichols commented 5 years ago

As a follow up and in the same thing I did another test with my existing mission.

Last night I fired up my mission I have been working on after I got frustrated with not getting anything from the repro mission and I found that it worked...almost. I still had debug on with the UCR_Setup.sqf file. I went into my player and the initial spawn in I was able to change clothing and it would register as having a solid disguise. BUT as soon as I went into the inventory of anything at all; car, off-road, police vehicle, military vehicle, backpack, crate, etc... I would get a statement that would say you are acting suspicious and my icon on my GPS would change from purple to green and back to purple. Then I got into a jeep and was still purple and drove into an area that was listed as a high security zone and as soon as I turned off the main road I started getting shot by the enemy AI in the area. Once that happened I was not able to return to having a solid disguise for the next hour of play testing the mission.

It didn't matter if I went into another town in a different car, plane, helo, teleport to the middle of the jungle with no AI within 2000 meters of my character the second I changed clothing it would pop up with the statement that "you have been compromised" and immediately follow that with a statement of "your disguise is solid" but I would still get shot by the AI. It didn't matter if I was using Asian faces or Tanoan faces and appropriate clothing, gear, etc...

My screenshots and video of this did not save so I am going to test it again today after I push all the newest ACE updates that came out after the update broke a few things. It could be that the test last night was effected by the broken aspects of ACE but I will not know until I can update it.

1ncontinentia commented 5 years ago

Amazing write up, that definitely gives me something to work with. Thanks so much. I'll try to look at this properly when I get time. Could you dropbox your vanilla mission file over?

Two things to test in the meantime (it might be a while before I can look at this).

First, in the initPlayerLocal.sqf (also check this file's name as you wrote InitPlayerLoad.sqf, which would definitely cause the script to fail), instead of:

if (player getVariable ["isSneaky",false]) then {[player] execVM "INC_undercover\Scripts\initUCR.sqf";}

Just put:

[player] execVM "INC_undercover\Scripts\initUCR.sqf";

Second, drop the ace uniforms thing for the time being. I haven't tested how this works and it might be incompatible. You can change disguise via the addAction that comes up when you close the inventory in the meantime.

The inventory behaviour is really weird. I wonder if something's changed in a recent Arma update. The compromised stuff might be weird too but I'll have to check that. Also, I have no idea why the setVariable is throwing errors. Maybe another Arma update issue. Which sucks if so.

Cheers again man, this is really helpful.

Will-Nichols commented 5 years ago

Sorry about the mistype on my end. The file is named initPlayerLocal.sqf . I think I might have found a problem with my initPlayerLocal.sqf on my end. I didn't copy/paste the " } " to close out the statement in the file. Which may be why it either isn't running or is just looping the entire time.

I will test it out again here in a minute with your suggestion on the change in the file and will post up my vanilla mission in dropbox shortly.

I started using the ACE optionals "no_uniformrestrictions.pbo" file this week as we were not able to change uniforms at all before I found that in the ACE mod optionals folder. I will give it another shot and see what happens.

1ncontinentia commented 5 years ago

Yeah that missing } would definitely prevent the script from running too. (EDIT: does that mean that wasn't an issue?)

The no_uniformrestrictions.pbo might work and would be super helpful if it does. But for now, best just to keep it off in case that's where the issues lie.

Will-Nichols commented 5 years ago

yeah wasn't the issue; I was hurrying through the change while on my lunch break to get it done and looked at it wrong.

Will-Nichols commented 5 years ago

Link to Basic Repro Test Mission Incognito

1ncontinentia commented 5 years ago

Thanks man. Will hopefully get some time to have a look this weekend if not sooner. I'll keep you updated and let you know as soon as I've worked out what is going wrong.

Will-Nichols commented 5 years ago

Forgot to say that I am also running Achilles with this mission as well since it is what I use to do GM stuff for the community. It runs server side so there is no dependency for the client to run it.

Will-Nichols commented 5 years ago

OK just got it the debug functioning. However it would say my disguise was solid but I would end up getting shot by bad guys as I drove past them on the road in civilian pickup truck or if I was walking around outside of truck without a weapon exposed.

Server RPT file for you to look over; if you need it.

1ncontinentia commented 5 years ago

So I can't reproduce the setvariable issue. Still works without any issues on my end. I'm on old versions of CBA and ACE but can't see how that would change anything.

One thing that is clearly throwing a shit ton of errors and would definitely create weird behaviour is the commented out lines in the setup.sqf (only the _asymEnySide or _regEnySide entries could be commented out, the rest could not — my fault for labelling badly, and I will fix this). I've changed the setup to the below and the script is initialising fine on my end now:

/*

Setup options for INC_undercover undercover / civilian recruitment script by Incontinentia.

Please check each setting carefully otherwise the script may not function properly in your scenario. All classnames must have quotation marks ("Item_Random_F")

*/

//-------------------------Player settings-------------------------

_undercoverUnitSide = independent; //What side is/are the undercover unit(s) on? (Can be east, west or independent - only one side supported)

//-------------------------General Settings-------------------------

_debug = true; //Set to true for debug _fullAIfunctionality = true; //Enable all checks on AI (may degrade performace very slightly for large groups, 15+) _easyMode = true; //Disguise checks will also reveal if the player's disguise is working or not

_racism = true; //Enemies will notice if you aren't the race of the faction you're pretending to be (making you easier to detect if nothing is covering your face) _racProfFacCiv = 1; //(Number) Multiplies the effect of racial profiling. Lower this number to simulate more multicultural civilian population _racProfFacEny = 1; //(Number) Multiplies the effect of racial profiling. Lower this number to simulate more multicultural enemy forces

_regEnySide = east; //Units of this side will be classed as regular enemies (Side: can be east, west, independent) - if you don't need this, comment the line out (i.e. put // before _regEnySide, as in //_regEnySide = east;). _regBarbaric = false; //(Bool - true or false) Will this side lash out on civilians if it takes casualties and doesn't know the attacker? _regDetectRadius = 10; //Default detection radius for regular troops (this will expand and contract based on weather, time of day, and how the undercover unit is acting - civilians within this radius will be under much more scrutinty)

_asymEnySide = sideEmpty; //Units of this side will be classed as asymetric enemies (Side: can be east, west, independent) - if you don't need this, comment the line out (i.e. put // before _asymEnySide, as in //_asymEnySide = east;). _asymBarbaric = true; //(Bool - true or false) Will this side have a small chance of lashing out on civilians if it takes casualties and doesn't know the attacker? _asymDetectRadius = 15; //Default detection radius for asym troops (this will expand and contract based on weather, time of day, and how the undercover unit is acting - civilians within this radius will be under much more scrutinty)

_globalSuspicionModifier = 1; //Scales the level of suspicion of enemies. 1 is default, 2 means units are twice as likely to see through undercover unit's disguises, 0.5 means half as likely etc.

//-------------------------Civilian Disguise settings-------------------------

_civFactions = ["CIV_F"]; //Array of factions whose vests are safe for undercover units to wear

//(Array of classnames) Safe vests (on top of the specific factions above - useful if faction has randomisation script or to add items that are not used by the faction) _civilianVests = [];

//(Array of classnames) Safe uniforms (on top of the specific factions above - useful if faction has randomisation script or to add items that are not used by the faction) _civilianUniforms = [];

//(Array of classnames) Safe headgear (will automatically include civilian headgear classes - useful if faction has randomisation script or to add items that are not used by the faction) _civilianHeadgear = [];

//(Array of classnames) Safe backpacks (will automatically include civilian backpack classes - useful if faction has randomisation script or to add items that are not used by the faction) _civilianBackpacks = ["B_FieldPack_blk","B_FieldPack_cbr","B_FieldPack_khk","B_Carryall_khk","B_TacticalPack_blk","B_TacticalPack_rgr","B_TacticalPack_oli"];

//(Array of classnames) Safe vehicles to drive in (automatically includes vehicles from the civilian factions above). _civilianVehicleArray = [];

_HMDallowed = false; //(Bool - true or false) Are HMDs (night vision goggles etc.) safe to wear for units pretending to be civilians? Set to false if wearing HMDs will cause suspicion (must be stored in backpack).

_noOffRoad = false; //Civilian vehicles driving more than 50 meters from the nearest road will be considered hostile

//-------------------------Enemy Disguise settings------------------------- _incogFactions = ["OPF_F"]; //Array of enemy factions whose items and vehicles will allow the player to impersonate the enemy

//Names of additional markers for areas that would be considered trespassing (any with "INC_tre" - case sensitive - somewhere in the marker name will automatically be included) _trespassMarkers = ["highsecurity1"];

//(Array of classnames) Safe vests (on top of the specific factions above - useful if faction has randomisation script or to add items that are not used by the faction) _incognitoVests = [];

//(Array of classnames) Safe headgear (will automatically include incog headgear classes - useful if faction has randomisation script or to add items that are not used by the faction) _incognitoHeadgear = [];

//(Array of classnames) Safe backpacks (will automatically include incog backpack classes - useful if faction has randomisation script or to add items that are not used by the faction) _incognitoBackpacks = [];

//(Array of classnames) Safe uniforms (on top of the specific factions above - useful if faction has randomisation script or to add items that are not used by the faction) _incognitoUniforms = [];

_incogVehArray = []; //(Array of classnames) Additional incognito vehicles (vehicles from the faction above will automatically count, as will all _highSecVehicles)

//-------------------------High security zone settings------------------------- / High security zones are areas that can only be entered with specific uniforms / items, even if the unit is disguised as an enemy. For instance, it could be a radar installation or a marker in the vicinity of a high value target that only specially designated units are allowed near. All high security zones are automatically considered non-civilian territory, but units dressed as enemies can enter without being instantly considered hostile, but they will attract a LOT more attention. In these settings, you can . /

_highSecMarkers = ["highsecurity1"]; //Names of additional markers for areas that are designated high security zones that require specific uniforms to enter without raising suspicion (any with "INC_highSec" - case sensitive - somewhere in the marker name will automatically be included)

_highSecInstantHostile = false; // If true, units entering high security areas with the wrong uniform will be instantly deemed hostile by enemy forces. If false, it will be highly suspicious.

_highSecVehicles = []; // (Array of classnames) Vehicles that can enter high security areas without raising suspicion (uniforms will still be noticed according to how open the vehicle is)

_highSecurityUniforms = []; // (Array of classnames) Uniforms that allow entry into high security areas (defined by high security markers)

_highSecItemCheck = true; // Check for disallowed items that aren't in the permitted list? Each non-permitted item will incur a suspicion penality. Set to false if high security checks just include uniform only.

_highSecItems = []; // (Array of classnames) List of items such as vests, headgear, hats etc., that won't cause suspicion in high security areas (only works on foot for now)

_hsItChkOutside = true; // The high security item check will occur if wearing a high security uniform even in non-high security zones. Useful if the high security uniform is, for example, a businessman or scientist, who would look weird carrying a gun and helmet.

_hsMustBeUnarmed = true; // Units carrying weapons will be considered hostile (requires _highSecItemCheck to be set to true).

_highSecItemCheckScalar = 1; // Multiplies the level of suspicion caused by each suspect item when in a high security zone

//-------------------------Civilian recruitment settings------------------------- / By enabling civilian recruitment, undercover can recruit any ambient civilians they see into their group (if their reputation allows / the civvy wants to join). Civilians will operate under similar restrictions to the player. You can also dismiss your new teammates and they will leave your group and carry on doing whatever it is they fancy doing (usually sitting cross-legged in the middle of a field). /

_civRecruitEnabled = true; //(Bool - true or false) Set this to false to prevent undercover units from recruiting civilians _armedCivPercentage = 70; //(Number - 0 to 100) Max percentage of civilians armed with weapons from the array below, either on their person or in their backpacks (will only work if _civRecruitEnabled is set to true, otherwise this is ignored)

//Weapon classnames for armed civilians (array of classnames) _civWpnArray = ["arifle_AKS_F","arifle_AKM_F","hgun_Pistol_01_F","hgun_Rook40_F","hgun_ACPC2_F","hgun_Rook40_F"];

//Items that civilians may carry _civItemArray = ["ACE_Cellphone","ACE_Flashlight_KSF1","ACE_SpraypaintBlack","itemRadio","ACE_RangeCard","ACE_key_civ","ACE_key_lockpick","ACE_fieldDressing"];

//Civilian backpack classes (array of classnames) _civPackArray = ["B_FieldPack_blk","B_FieldPack_cbr","B_FieldPack_khk","B_FieldPack_oucamo","B_Carryall_cbr"];

1ncontinentia commented 5 years ago

So an update on the above; basically with the lines in the setup.sqf not commented out, it all seems to initialise and work as expected (in the sense that I got in a civilian vehicle and it showed I was in disguise but acting very weirdly as I was dressed in a combatant uniform). This isn't conclusive as I didn't get the chance to test all the functions beyond that, but this means it's not been broken by the latest Arma updates at least. So my testing back in August is probably still fine.

If you've always commented out the lines like you did here, the script would definitely be completely broken. So that's the first thing to check. Second thing is I didn't use Achilles tonight as I didn't have the time. So if it still acts all weird, try removing that. If Achilles breaks it, I probably won't be able to provide a fix in the short term but would be useful to know if there are incompatibilities. If there is still some weird behaviours even after trying both steps, I will dig a bit deeper.

Will-Nichols commented 5 years ago

Sounds like a plan.

I will have to go back and see if I can find some of the older (+1 year) versions of the mission to see if we were commenting them out. My memory says we would have been doing that but I would feel a lot better knowing for sure. I appreciate the effort on your end. It's good to have a guy that makes stuff who is willing to keep it working. Some guys just don't care after the fact and far too often that is the case for the majority of the mod/script makers.

Will-Nichols commented 5 years ago

Question: You mentioned earlier that increasing the number in the following section of the setup file will likely cause the script function to break or not work as intended.

_racProfFacEny = 1; //(Number) Multiplies the effect of racial profiling. Lower this number to simulate more multicultural enemy forces

OK so I have more than one question about the racial profiling side;

Will-Nichols commented 5 years ago

Update: So far changing that in the initPlayerLocal.sqf seems to be working as is the function of leaving the " // " off the _asymEnySide = sideEmpty; line of code seems to be working.

However a funny thing though is if someone is gifted a set of enemy clothing via Zeus it does not appear that they are able to actually change into incognito. We are testing that part further but it might be an issue with Achilles since I was using Achilles during the test. Next test tomorrow will be without Achilles on the server.

1ncontinentia commented 5 years ago

If the uniform changes the script should pick it up, but it might be that Zeus uses a different classname of that particular uniform so that's why it doesn't recognise it as one of the undercover ones. In which case, you'd need to find out the classname and add it to the list of incognito uniforms in the setup.sqf manually. You can do that by giving yourself a uniform that doesn't work in Zeus, then running the following in the console (which will copy the uniforms classname to your clipboard) and pasting it into the setup.sqf with parenthesis:

copyToClipboard (uniform player);

In terms of the racial profiling multiplier, I'd maybe experiment with 2 or 3. That should be plenty to get enemies to find you super weird if you aren't covering your face somehow. You can push it higher, it might just mean you get engaged from a distance much easier.

As for going back to older missions, it's probably not worth it. There were a few loopholes that might allow the script to stop working as intended in certain (specific) situations. So the bug was probably real back then, but with the loophole fixing I did it may not be real anymore. Haven't had the chance to do a long playtest with Alive to check though. The commenting out would have caused a catastrophic failure of the script so you wouldn't have any of the functions running properly if you did that before.

Will-Nichols commented 5 years ago

Was looking back through the older missions early this morning; I keep everything I do for ALiVE missions on a thumb drive and pulled one from April 2017. Its the same mission just older mod dependencies; anyway it has the same section commented out that you found yesterday. So its a combination then of not knowing the effects of telling users to do that or not do that and the people like myself who trust guys to have things 100% right.

Now I think I need to track down another portion of it with mod incompatibility in my mission.

1ncontinentia commented 5 years ago

Well no wonder you thought it was iffy; it's quite amazing that you thought the script worked at all! But in fairness, that's not actually bug at all but user error. Most scripts don't do well if you remove variables from their setup files, unless the script maker has specifically planned for users doing this.

Unless I code for redundancy (which I did in the specific lines for _asymEnySide and _regEnySide, but nothing more as it is less performant), commenting out variables in the setup file will completely break it. May be best to check other scripts in your missions too if this is a common habit?

Will-Nichols commented 5 years ago

Agreed and I am and always have been 100% behind using this script; just have been banging my head against a wall with a spike sticking out of it because I was not thinking about how the scripts were interdependent. I didn't get too deep into the weeds on the functions other than trying to determine if it was not initialized correctly.

I think I read in part of the internal functions of the script that enemies share information automatically across the map. Is that true?

Did you give some thought to me attempting to turn this into an editor modules?

1ncontinentia commented 5 years ago

Only regular forces share information across the entire map. Asym forces are limited to (around) 1 km or so. The cooldown period is long, as long as there are enemies who are still alive who know your current disguise. If you kill everyone who has seen you before they can get the word out, it is almost immediate. Also, there is a chance when spreading information, only part of your disguise will be shared (depending on how long the enemy gets eyes on you, your distance, the time of day, and a host of other factors). Best bet is always to break contact fully and change disguises. Being compromised will tail off much quicker the further you are from the last location you were spotted.

As for editor modules, that would require a learning curve on my part and I just don't have the capacity at the moment to do that unfortunately. It would also not really add any functionality save for being slightly easier to set up, at the cost of a mod dependency.

I might well close this issue for now and if you find a possible bug now that it's set up properly, you can open a new issue. The thread is getting pretty long and it's in danger of just turning into a general support thread, which can be a bit confusing if someone is trying to find a specific bug.

Will-Nichols commented 5 years ago

I would say close it and if something else pops up I can either comment on it or hopefully not the case find something else entirely.

As for the 3Den modules I am learning the basics on how to do it and would like to give it a shot if that is OK with you. I would not release anything without speaking/writing you about it first.

Thanks for taking the time and being patient on this with me but I think it may well help others in the long run.

1ncontinentia commented 5 years ago

The more feedback I get hopefully the easier I can make the install / setup process, so cheers again. You are more than welcome to do whatever you want with the code; I'm not going to pretend it's particularly well written (honestly if I had the time to re-write now I know better what I'm doing to make it easier to read I would!) but if you can make sense of it, it's an open license so feel free to make your own refinements and publish. Let me know if you have any more issues.