Jump to content

quickdagger

Member
  • Content Count

    221
  • Joined

  • Last visited

  • Medals

Posts posted by quickdagger


  1. Very nice reading, thank you for the directions.

     

    So, if this unit is spawned automatically by a KP Liberation server for example, what should be the issue?

     

    Because I have tested it in the editor, in multiplayer, on my local machine and it is working.

     

    Please correct me if I am wrong but I believe that, as the soldier spawns, it will create a local variable in whatever machine the server is, and this local variable will be deleted after call because it is local. Then, every player will see the created object soldier and he will be wearing a random loadout.

     

    If the variable was created public, not deleted because it is global, then, wouldn't it nullify the random effect?

     


  2. Well, I don't know what a local/global variable is and, what "pass a variable" is either.

    Nevertheless, it looks like I have found the solution 🙂

     

    The reason I want to do it in the configs is that, every time one of my units is added to a mission, by the editor, Zeus or dynamically spawned by the mission generator, it will bring the full package. It will always have random gear no matter what.

     

    Here is the code in case you are curious:

     

        class dgr_arulco_Soldier1 : dgr_soldier_rambo
    	{
    		scope = 2;
           	displayName = "Arulco Police Officer";
    		_generalMacro = "dgr_arulco_Soldier1";
           	side = 0;
           	faction = "dgr_arulco";
           	author = "Dagger";
    		disabled = 0;	
    		vehicleClass = "Men";
    		role = "Rifleman";
    		nameSound = "veh_infantry_s";
    		cost = 100000;
    		threat[] = {1,1,1};
    		canHideBodies = 1;
    		canDeactivateMines = 0;
    		attendant = 0;
    		engineer = 0;
    		canUseScanners = 0;
    		nightVision = 0;
    		uavHacker = 1;
    		woman = 0;
    
     		uniformClass = "dgr_uniform_police";
    		hiddenSelectionsTextures[] = {"\a3_dgr_equipment\data\dgr_uniform_police_co.paa"};
    
    		headgearList[] =									
    		{
    			"dgr_beret2", 
    			"dgr_beret2", 
    			//"dgr_ech28", 
    			"lxWS_H_PASGT_goggles_white_F",
    			""
    		};
    		identityTypes[] = {"LanguageFRE_F","Head_Tanoan"};
    
    		genericNames = "TanoanMen";
    		backpack = "dgr_holster";
    		Items[] = {"ACE_personalAidKit","ACE_tourniquet","ACE_tourniquet","ACE_morphine","ACE_morphine","ACE_epinephrine","ACE_CableTie","ACE_Banana","ACE_fieldDressing","ACE_fieldDressing","ACE_fieldDressing","ACE_fieldDressing","ACE_elasticBandage","ACE_elasticBandage","ACE_elasticBandage","ACE_elasticBandage","ACE_packingBandage","ACE_packingBandage","ACE_packingBandage","ACE_packingBandage"};
    		RespawnItems[] = {"ACE_personalAidKit","ACE_tourniquet","ACE_tourniquet","ACE_morphine","ACE_morphine","ACE_epinephrine","ACE_CableTie","ACE_Banana","ACE_fieldDressing","ACE_fieldDressing","ACE_fieldDressing","ACE_fieldDressing","ACE_elasticBandage","ACE_elasticBandage","ACE_elasticBandage","ACE_elasticBandage","ACE_packingBandage","ACE_packingBandage","ACE_packingBandage","ACE_packingBandage"};
    		linkedItems[] = {"ItemMap","ItemCompass","ItemRadio","dgr_vest_light_police5"};
    		respawnLinkedItems[] = {"ItemMap","ItemCompass","ItemRadio","dgr_vest_light_police5"};
    		weapons[] = {"Throw","Put","dgr_45"};
    		respawnWeapons[] = {"Throw","Put","dgr_45"};
    		magazines[] = {"DGR_45_FMJ_25Rnd","DGR_45_FMJ_25Rnd","DGR_45_FMJ_25Rnd","DGR_45_FMJ_25Rnd","ACE_CTS9"};
    		respawnMagazines[] = {"DGR_45_FMJ_25Rnd","DGR_45_FMJ_25Rnd","DGR_45_FMJ_25Rnd","DGR_45_FMJ_25Rnd","ACE_CTS9"};
    		
    		//https://forums.bohemia.net/forums/topic/229336-copying-vest-content-to-another-vest/?_fromLogin=1#replyForm		
    		class EventHandlers: EventHandlers 
    		{
    		//Headgear			
    			class Dgr_Headgear
    			{
    				init = "if (local (_this select 0)) then {[(_this select 0), [], []] call BIS_fnc_unitHeadgear;}";
    			};
    		//Switchable unit
    			class Dgr_SwitchableUnit
    			{
    				init = "if (local (_this select 0)) then {addSwitchableUnit (_this select 0)};";
    			};
    		//Private
    			class Dgr_PrivateItems
    			{
    				init = "(_this select 0) == _x;";
    			};
    			
    		//Copy loadout
    			class Dgr_CopyItems
    			{
    				init = "_DgrCopyItems = items (_this select 0);";
    			};
    			class Dgr_CopyAssignedItems
    			{
    				init = "_DgrCopyAssignedItems = assignedItems (_this select 0);";
    			};
    			class Dgr_CopyMagazines
    			{
    				init = "_DgrCopyMagazines = itemsWithMagazines (_this select 0);";
    			};
    			class Dgr_CopyUniformItems
    			{
    				init = "_DgrCopyUniformItems = uniformItems (_this select 0);";
    			};
    			class Dgr_CopyVestItems
    			{
    				init = "_DgrCopyVestItems = vestItems (_this select 0);";
    			};
    			class Dgr_CopyBackpackItems
    			{
    				init = "_DgrCopyBackpackItems = backpackItems (_this select 0);";
    			};
    		//Delete old gear
    			class Dgr_RemoveUniform
    			{
    				init = "removeUniform (_this select 0);";
    			};
    			class Dgr_RemoveVest
    			{
    				init = "removeVest (_this select 0);";
    			};
    			class Dgr_RemoveBackpack
    			{
    				init = "removeBackpack (_this select 0);";
    			};
    			
    			class Dgr_RemoveWeapon
    			{
    				init = "removeAllWeapons (_this select 0);";
    			};
    
    		//Spawn new gear			
    			class Dgr_SpawnUniform
    			{
    				init = "_DgrSpawnUniform = selectRandom [""dgr_uniform_police"",""dgr_rambo_police"",""dgr_uniform_mix_police""];";
    			};
    			class Dgr_SpawnVest
    			{
    				init = "_DgrSpawnVest = selectRandom [""dgr_vest_light_police5""];";
    			};
    			class Dgr_SpawnBackpack
    			{
    				init = "_DgrSpawnBackpack = selectRandom [""dgr_vest_belt"", ""dgr_holster""];";
    			};
    			class Dgr_SpawnWeapon
    			{
    				init = "_DgrSpawnWeapon = selectRandom [""dgr_45"", ""dgr_45_S2"", ""dgr_uzi_pdw""];";
    			};
    		//Add gear
    			class Dgr_AddUniform
    			{
    				init = "(_this select 0) addUniform _DgrSpawnUniform;";
    			};
    			class Dgr_AddVest
    			{
    				init = "(_this select 0) addVest _DgrSpawnVest;";
    			};
    			class Dgr_AddBackpack
    			{
    				init = "(_this select 0) addBackpack _DgrSpawnBackpack;";
    			};
    		//Paste items back
    /*
    			class Dgr_PasteItemsToUniform
    			{
    				init = "{(_this select 0) addItemToUniform _x} forEach _DgrCopyUniformItems;";
    			};
    			class Dgr_PasteItemsToVest
    			{
    			init = "{(_this select 0) addItemToVest _x} forEach _DgrCopyVestItems;";
    			};
    			class Dgr_PasteItemsToBackpack
    			{
    				init = "{(_this select 0) addItemToBackpack _x} forEach _DgrCopyBackpackItems;";
    			};
    			class Dgr_PasteItems
    			{
    				init = "{(_this select 0) addItem _x} forEach _DgrCopyItems;";
    			};
    			class Dgr_PasteAssignedItems
    			{
    				init = "{(_this select 0) addItem _x} forEach _DgrCopyAssignedItems;";
    			};			
    			
    */			
    			class Dgr_PasteMagazines
    			{
    				init = "{(_this select 0) addItem _x} forEach _DgrCopyMagazines;";
    			};
    			class Dgr_AddWeapon
    			{
    				init = "(_this select 0) addWeapon _DgrSpawnWeapon;";
    			};
    		//Insignia			
    			class Dgr_Insignia
    			{
    				init = "if (local (_this select 0)) then {[(_this select 0), ""dgr_logo_arulco""] call BIS_fnc_setUnitInsignia;}";
    			};
            };
        };

    It still comes with one less magazine, probably because it goes away when the event handler deletes the weapon, which contained it. In this case would you know how to fix it?

     

    Best!

    • Like 1

  3. Hi all,

     

    This discussion is really very interesting. I am trying to do the same but, adding random vests, uniforms and weapons. So far this part works but the containers are empty, the items don't add back to the inventory.

     

    @pierremgi, I wonder if you could could give a hand here.

    I am trying to do the same but, in the configs, with event handlers. It is not working and I can't figure out why. 

    Here is the config if you want to know:
     

        class dgr_arulco_Soldier1 : dgr_soldier_rambo
    	{
    		scope = 2;
           	displayName = "Arulco Police Officer";
    		_generalMacro = "dgr_arulco_Soldier1";
           	side = 0;
           	faction = "dgr_arulco";
           	author = "Dagger";
    		disabled = 0;	
    		vehicleClass = "Men";
    		role = "Rifleman";
    		nameSound = "veh_infantry_s";
    		cost = 100000;
    		threat[] = {1,1,1};
    		canHideBodies = 1;
    		canDeactivateMines = 0;
    		attendant = 0;
    		engineer = 0;
    		canUseScanners = 0;
    		nightVision = 0;
    		uavHacker = 1;
    		woman = 0;
    
     		uniformClass = "dgr_uniform_police";
    		hiddenSelectionsTextures[] = {"\a3_dgr_equipment\data\dgr_uniform_police_co.paa"};
    
    		headgearList[] =									
    		{
    			"dgr_beret2", 
    			"dgr_beret2", 
    			"dgr_ech28", 
    			""
    		};
    		identityTypes[] = {"LanguageFRE_F","Head_Tanoan"};
    		class EventHandlers: EventHandlers 
    		{
    //Headgear			
    			class Dgr_Headgear
    			{
    				init = "if (local (_this select 0)) then {[(_this select 0), [], []] call BIS_fnc_unitHeadgear;}";
    			};
    //Switchable unit
    			class Dgr_SwitchableUnit
    			{
    				init = "if (local (_this select 0)) then {addSwitchableUnit (_this select 0)};";
    			};
    //Copy loadout
    			class Dgr_CopyItems
    			{
    				init = "_DgrCopyItems[] = items (_this select 0);";
    			};
    			class Dgr_CopyAssignedItems
    			{
    				init = "_DgrCopyAssignedItems[] = assignedItems (_this select 0);";
    			};
    			class Dgr_CopyMagazines
    			{
    				init = "_DgrCopyMagazines[] = itemsWithMagazines (_this select 0);";
    			};
    			class Dgr_CopyUniformItems
    			{
    				init = "_DgrCopyUniformItems[] = uniformItems (_this select 0);";
    			};
    			class Dgr_CopyVestItems
    			{
    				init = "_DgrCopyVestItems[] = vestItems (_this select 0);";
    			};
    			class Dgr_CopyBackpackItems
    			{
    				init = "_DgrCopyBackpackItems[] = backpackItems (_this select 0);";
    			};
    //Delete old gear
    			class Dgr_RemoveUniform
    			{
    				init = "removeUniform (_this select 0);";
    			};
    			class Dgr_RemoveVest
    			{
    				init = "removeVest (_this select 0);";
    			};
    			class Dgr_RemoveBackpack
    			{
    				init = "removeBackpack (_this select 0);";
    			};
    			class Dgr_RemoveWeapon
    			{
    				init = "removeAllWeapons (_this select 0);";
    			};
    //Spawn new gear			
    			class Dgr_SpawnUniform
    			{
    				init = "_DgrSpawnUniform = selectRandom [""dgr_uniform_police"",""dgr_rambo_police"",""dgr_uniform_mix_police""];";
    			};
    			class Dgr_SpawnVest
    			{
    				init = "_DgrSpawnVest = selectRandom [""dgr_vest_light_police5""];";
    			};
    			class Dgr_SpawnBackpack
    			{
    				init = "_DgrSpawnBackpack = selectRandom [""dgr_vest_belt"", ""dgr_holster""];";
    			};
    			class Dgr_SpawnWeapon
    			{
    				init = "_DgrSpawnWeapon = selectRandom [""dgr_45"", ""dgr_45_S2"", ""dgr_uzi_pdw""];";
    			};
    //Add gear
    			class Dgr_AddUniform
    			{
    				init = "(_this select 0) addUniform _DgrSpawnUniform;";
    			};
    			class Dgr_AddVest
    			{
    				init = "(_this select 0) addVest _DgrSpawnVest;";
    			};
    			class Dgr_AddBackpack
    			{
    				init = "(_this select 0) addBackpack _DgrSpawnBackpack;";
    			};
    //Paste items back
    			class Dgr_PasteItemsToUniform
    			{
    				init = "(_this select 0) addItemToUniform _DgrCopyUniformItems[];";
    			};
    			class Dgr_PasteItemsToVest
    			{
    				init = "(_this select 0) addItemToVest _DgrCopyVestItems[];";
    			};
    			class Dgr_PasteItemsToBackpack
    			{
    				init = "(_this select 0) addItemToBackpack _DgrCopyBackpackItems[];";
    			};
    			class Dgr_PasteItems
    			{
    				init = "(_this select 0) addItem _DgrCopyItems[];";
    			};
    			class Dgr_PasteAssignedItems
    			{
    				init = "(_this select 0) addItem _DgrCopyAssignedItems[];";
    			};
    			class Dgr_PasteMagazines
    			{
    				init = "(_this select 0) addItem _DgrCopyMagazines[];";
    			};
    			class Dgr_AddWeapon
    			{
    				init = "(_this select 0) addWeapon _DgrSpawnWeapon;";
    			};
    //Insignia			
    			class Dgr_Insignia
    			{
    				init = "if (local (_this select 0)) then {[(_this select 0), ""dgr_logo_arulco""] call BIS_fnc_setUnitInsignia;}";
    			};
            };
    		genericNames = "TanoanMen";
    		backpack = "dgr_holster";
    		Items[] = {"ACE_personalAidKit","ACE_tourniquet","ACE_tourniquet","ACE_morphine","ACE_morphine","ACE_epinephrine","ACE_CableTie","ACE_Banana","ACE_fieldDressing","ACE_fieldDressing","ACE_fieldDressing","ACE_fieldDressing","ACE_elasticBandage","ACE_elasticBandage","ACE_elasticBandage","ACE_elasticBandage","ACE_packingBandage","ACE_packingBandage","ACE_packingBandage","ACE_packingBandage"};
    		RespawnItems[] = {"ACE_personalAidKit","ACE_tourniquet","ACE_tourniquet","ACE_morphine","ACE_morphine","ACE_epinephrine","ACE_CableTie","ACE_Banana","ACE_fieldDressing","ACE_fieldDressing","ACE_fieldDressing","ACE_fieldDressing","ACE_elasticBandage","ACE_elasticBandage","ACE_elasticBandage","ACE_elasticBandage","ACE_packingBandage","ACE_packingBandage","ACE_packingBandage","ACE_packingBandage"};
    		linkedItems[] = {"dgr_vest_light_police5"};
    		respawnLinkedItems[] = {"dgr_vest_light_police5"};
    		weapons[] = {"Throw","Put","dgr_45"};
    		respawnWeapons[] = {"Throw","Put","dgr_45"};
    		magazines[] = {"DGR_45_FMJ_25Rnd","DGR_45_FMJ_25Rnd","DGR_45_FMJ_25Rnd","DGR_45_FMJ_25Rnd","ACE_CTS9"};
    		respawnMagazines[] = {"DGR_45_FMJ_25Rnd","DGR_45_FMJ_25Rnd","DGR_45_FMJ_25Rnd","DGR_45_FMJ_25Rnd","ACE_CTS9"};
        };

    Thank you in advance!


  4. Hi all,

     

    This time I would like to know what should be your codes for spawning an enemy group when the player kills a civilian. Interpret that as the civilian's family and friends coming to take revenge.

     

    I am using Bangabob's COS - Civilian Occupation System, I am not placing civilian units on the map, in the editor, so, I presume I can't edit their init field.

    I am also using Bangabob's EOS - Enemy Occupation system.

    Both EOS and COS require that you place triggers on the map, which will serve as their spawn points. Somehow they recognize house interiors so, units respawn inside house if you config to do so. Really amazing.

    I am also using CBA and ACE.

    There could be a delay between killing the civilian and the spawn of the enemy group.

    The spawn point should be the nearest village/base but not the current village/base. Or the nearest trigger on the mao, which I use as the spawn points to EOS or COS ?

    EOS

     

    @Leopard20 @opusfmspol @stburr91 @froggyluv @Play3r @vilas

    Since you have provided great help the other day, I would like to invite you to this discussion but, pls feel free to move on with this idea or not if you will. 

     


  5. Insightful brainstorm @stburr91!

    I have followed you line and made a line of many terrorists, each one with a different init script, covering all the ideas that were exposed here.

     

    For my selection of mods, the code that produces the fastest reaction was:

     

    Init

    doStop this; 
    this disableAI "move"; 
    this setUnitPos "UP"; 
    this setBehaviour "COMBAT"; 
    this addEventHandler ["Dammaged", {h1 setCaptive false}];

    I was impressed by having the combat behavior assigned as well but, if you put in perspective it is not that bad. I mean, if the terrorist finds any BLUEFOR around he will shoot ... it could be. Since his movement is disabled then he is hunting for BLUEFOR all the time and will shoot the hostage at the moment the hostage becomes BLUEFOR. It also creates the tactical option of allowing players using ghillies to crawl closer to the hostage in order to do a better assessment of the situation.

     

     Also, I was thinking about that if (_shooter == player) thing. Then I have thought about a possible scenario where the player doesn't know the hostage is there, calls mortar fire, the explosion damages the terrorist. The terrorist would still shoot the hostage isn't it?

     

    I was also thinking about having a trigger to make the the terrorists shoot anyway if the player gets too close but, it is not the case of getting too close. It is a matter of the terrorists finding the BLUEFOR of not.

     

    About using ghillies to remain unseen, vanilla ones were not working but the ones in my mod are 🙂

     

    Any other evolution ideas?


  6. Hi all, thank you for the ideas, tku @Play3r for the mission.

    It is even better than before bust still they don't shoot the hostage if I shoot the terrorists in the leg with a pistol. The leg-pistol combo seems to be the issue.

     

    At this point I am using:

     

    Init for hostage h1: 

    this setcaptive true; doStop this; this disableAI "move"; this setUnitPos "UP";

    Init for bandit b1:

    doStop this; 
    this disableAI "move"; 
    this addEventHandler ["Dammaged", { 
     params ["_unit", "", "", "", "", "_shooter"]; 
     if (_shooter == player) then { 
      h1 setCaptive false ;
    [] spawn { 
    b2 doTarget H1;   
    b2 forceWeaponFire [weaponState b2 select 1, weaponState b2 select 2];}; }; 
    }];

    Init for bandit b2:

    doStop this; 
    this disableAI "move"; 
    this addEventHandler ["Dammaged", { 
     params ["_unit", "", "", "", "", "_shooter"]; 
     if (_shooter == player) then { 
      h1 setCaptive false ;
    [] spawn { 
    b1 doTarget H1;   
    b1 forceWeaponFire [weaponState b1 select 1, weaponState b1 select 2];}; }; 
    }];

    I have replaced Play3r's Bluefor player by a CSAT Marksman. For testing I have made the player be OPFOR so that I can get closer and shoot a leg with the pistol. Bandits are INDEPENDENT and I have made it be friends with OPFOR. Hostage is BLUEFOR. 

     


  7. Hey @Leopard20, the result is very weird ... If I shoot the terrorist on the chest, he falls on the ground but doesn't die, then the other terrorist shoots the hostage. Good! It is already an improvement.

    However, if I restart the mission and shoot the same terrorist's leg with a pistol then no one shoots the hostage.

     

    Does this code has something to do with the total damage per shoot?

     

    Sorry I am not a scripter and can't understand very well BI's Wiki's. I need the full explanation for rookies, like create a folder here and name it this, then paste this into the init field and bla bla.

     

    I am using ACE and CBA.


  8. Hi @Play3r,

     

    The player is a BLUEFOR sniper still kilometers away from the hostage. He and his group will still have to plan the operation and etc. So, they will chose whether to shoot from a distance, get in CQB range, use flashbangs, etc. But, I want everything to be possible.

     

    The hostage h1 is an AI BLUEFOR.

    The bandits b1 and b2 are AI OPFOR, 5 meters away from the hostage h1.


  9. Hi @stburr91,

     

    Thank you for the reply, I think you are almost there.

     

    I have shot one of the terrorists but he hasn't died and, the other terrorist didn't shoot the hostage. Well, I believe the second one should have shot isn't it?

     

    So, I think I should rephrase what I have just asked.

     

    Replace:

    When you kill one terrorist, the other shoots the hostage.

     

    by:

    When you shoot or hurt  one terrorist, the other shoots the hostage.

     

    🙂


  10. Hi all,

    I want to do a mission with 1 AI hostage and 2 AI terrorists. The terrorists are pointing at the hostage but they don't shoot. When you kill one terrorist, the other shoots the hostage.

    I don't want to use triggers detecting bluefor presence because I want to have snipers eliminating the terrorists from long distance, simultaneously. 

    How would you make this work?

    • Like 1
×