Jump to content

stuguy

Member
  • Content Count

    107
  • Joined

  • Last visited

  • Medals

Everything posted by stuguy

  1. Overthrow 1.0.27 won't start on Reforger 0.9.7.61: Scripts/Game/GameMode/OVT_OverthrowGameMode.c(122): Overloading event 'OnPlayerDisconnected' is not allowed
  2. Long time no talk. I am currently working with the high command module with some old scripts I dusted off. I was able to get some easy scripts to create the HC and add all the units on a particular side to the player: if (count (allMissionObjects "HighCommand") == 0) then { _Group = createGroup (sideLogic); _Group_HC_C = _Group createUnit ["HighCommand", [0, 0, 0], [], 0, "NONE"]; _Group_HC_S = _Group createUnit ["HighCommandSubordinate", [0, 0, 0], [], 0, "NONE"]; player synchronizeObjectsAdd [_Group_HC_C]; _Group_HC_C synchronizeObjectsAdd [_Group_HC_S]; { if (side _x == resistance) then { leader _x synchronizeObjectsAdd [_Group_HC_S]; }; }forEach allGroups; } else .... The else condition is what I am having problems with: else { _Groups_HC = hcAllGroups player; _Group_HC_C = synchronizedObjects player select (side player == sideLogic); _Group_HC_S = synchronizedObjects _Group_HC_C select 0; // or 1? Neither works { if (side _x == resistance && !(_x in _Groups_HC)) then { leader _x synchronizeObjectsAdd [_Group_HC_S]; }; }forEach allGroups; }; I've tried all sorts of ways of tracking down the objects in the allMissionObjects: _Groups = allMissionObjects "HighCommand"; _Group = allMissionObjects "HighCommand" select (side player == sideLogic); //This looks like a subordinate _Group = synchronizedObjects player select 0; //it's definitely a group in this case //and _Group_HC_C = synchronizedObjects player select 0; //primary group _Group_HC_S = synchronizedObjects _Group_HC_C select 0; //p1 //and _Group_HC_C = synchronizedObjects player select 0; //primary group _Group_HC_S = synchronizedObjects _Group_HC_C select 1; //looks like the sub I'm stumped on how to pull the same data I injected so I can add more groups. The goal is getting a basic example working and sort out a simple admin script to add basic high command group management, nothing more. Anyone have any ideas? edit: wait, I think the else isn't adding leaders. checking... Ok, i updated the else to reflect what I needed it to do, but I am still unable to properly lookup and find the variables I created.
  3. I more or less have a working solution now, but I'm still puzzled as to why: // creating the HC module from scratch _Group = createGroup (sideLogic); _Group_HC_C = _Group createUnit ["HighCommand", [0, 0, 0], [], 0, "NONE"]; _Group_HC_S = _Group createUnit ["HighCommandSubordinate", [0, 0, 0], [], 0, "NONE"]; player synchronizeObjectsAdd [_Group_HC_C]; _Group_HC_C synchronizeObjectsAdd [_Group_HC_S]; _grp = allGroups select {side _x == independent}; // get independent groups _grp = _grp - [group player]; // remove player group _g1 = (_grp select 0); // group 1 active //_g2 = (_grp select 1); // group 2 commented out leader _g1 synchronizeObjectsAdd [_Group_HC_S]; // added group to HC system via leader injection This can be used as a way to create High Command modules and groups for a unit, found similar on the forum. Note that we bind groups to the logic via the leader, similarly to syncing the leader to the module in the editor. BUT: Can't call up the logic from synchronizedObjects and bind new groups using the same setup. // recalling modules _Group_HC_C = synchronizedObjects player select { _x isKindOf "HighCommand" } select 0; _Group_HC_S = synchronizedObjects _Group_HC_C select { _x isKindOf "HighCommandSubordinate" } select 0; // The subordinate is already bound, so we skip that part... Yes? // _Group_HC_C synchronizeObjectsAdd [_Group_HC_S]; // The player is already bound to the HC module, so we skip that too... Yes? // player synchronizeObjectsAdd [_Group_HC_C]; _grp = allGroups select {side _x == independent}; // get independent groups _grp = _grp - [group player]; // remove player group //_g1 = (myside select 0); // group 1 commented out _g2 = (_grp select 1); // group 2 active leader _g1 synchronizeObjectsAdd [_Group_HC_S]; // called back the modules, which I checked are there... but adding groups to HC system via leader injection fails. It's not overly important at this point. I am just curious why I can't jam units back into these logics, or perhaps I am doing it wrong with this method? NOTE: In my specific test cases, I added a selection of one of the resistance groups minus the player. Then later tried to add the other selection. It won't add it. My new work around program works, but I would like to know why I can't work with the logics directly, or how I correctly recall them?
  4. 0 spawn { highCommandFunc = { params ["_unit", "_grpArry"]; not_done = true; while { not_done } do { _unit_hc_count = count (synchronizedObjects _unit select { _x isKindOf "HighCommand" }); switch (_unit_hc_count) do { case 0: { _Group = createGroup (sideLogic); _Group_HC_C = _Group createUnit ["HighCommand", [0, 0, 0], [], 0, "NONE"]; _Group_HC_S = _Group createUnit ["HighCommandSubordinate", [0, 0, 0], [], 0, "NONE"]; _unit synchronizeObjectsAdd [_Group_HC_C]; _Group_HC_C synchronizeObjectsAdd [_Group_HC_S]; _grpArry = _grpArry - [group _unit]; { _unit hcSetGroup [_x]; }forEach _grpArry; not_done = false; }; case 1: { _hc_grps = hcAllGroups _unit; _grpArry = _grpArry - _hc_grps; _grpArry = _grpArry - [group _unit]; if (count (_grpArry) > 0) then { { _unit hcSetGroup [_x]; } forEach _grpArry; }; not_done = false; }; default { _hc_grps = hcAllGroups _unit; _hc_grps = _hc_grps - _grpArry; _grpArry = _grpArry + _hc_grps; hcRemoveAllGroups _unit; sleep 0.25; hc_module = synchronizedObjects player select { _x isKindOf "HighCommand" }; if (count (hc_module) > 1) then { { hc_sub_module = synchronizedObjects _x select { _x isKindOf "HighCommandSubordinate" }; if (count (hc_sub_module) > 0) then { { deleteVehicle _x; } forEach hc_sub_module; }; deleteVehicle _x; } forEach hc_module; }; sleep 0.25; }; }; }; }; _grp = allGroups select { side _x == resistance }; [player, _grp] call highCommandFunc; }; edit: yup, I have to spawn it and add sleep threads. Definitely goes over the the 3 ms per frame scheduler execution limit.
  5. Thanks for the response. I was reading () as syntax for boolean and {} as syntax for an expression. I saw some conditions work with select using () and some expressions work with select using {}. I noticed that the primary synchronizedObjects returned array, hence I was using the forEach and select statements because it was an iterable. hc_module = synchronizedObjects player select {_x isKindOf "highCommand"} select 0; hc_sub_module = synchronizedObjects hc_module select {_x isKindOf "highCommandSubordinate"} select 0; I definitely did this one. If we are going off of my original post, I created a basic high command and subordinate logic and synchronized them. I then attach high command to the player, and iterate through all the groups in a side and make them subordinate. The old code I found was unable to select the old modules stored on the player object and make additions to it. So naturally, I needed to access the synchronized object that I placed on the player, but I am unable to bind new groups to the subordinate module. Working: _Groups_HC = hcAllGroups player; _grp = allGroups select { side _x == resistance }; _grp = _grp - _Groups_HC; _grp = _grp - [group player]; { player hcSetGroup [_x]; } forEach _grp; Not Working: hc_module = synchronizedObjects player select { _x isKindOf "highCommand" } select 0; hc_sub_module = synchronizedObjects hc_module select { _x isKindOf "highCommandSubordinate" } select 0; _Groups_HC = hcAllGroups player; _grp = allGroups select { side _x == resistance }; _grp = _grp - _Groups_HC; _grp = _grp - [group player]; { leader _x synchronizeObjectsAdd [hc_sub_module]; } forEach _grp; I want to use the synchronize objects system for multiplayer, and I need to be able to grab the items on the individual _unit I want to avoid using hcSetGroup, if possible. I want to select a specific object to bind teams to and avoid conflict, more on that later. I will migrate off of player once I have a working setup The end goal is making a simple action menu that allows a player to manage its own teams and avoid conflict with built in HC commands or complexities with the other HC management systems. And for good measure, I also tried your script which was overly complicated: _subLogic = synchronizedObjects (synchronizedObjects player select {_x isKindOf "highCommand"} select 0) - [player] select 0; It's no different from my two step process, but is way more difficult to read. So in a nutshell, I am stumped on accessing the sublogic and using it like I did when I invoked it. I can create and attach, but am unable to recall and modify.... Though I can collect the groups, destroy it and rebuild it, though, not ideal.
  6. I scripted a bunch of child tasks to go inside of a parent task. In this case, I have 7 locations that a unit may randomly spawn in and if the player finds him, the parent succeeds. If the location is empty when the player arrives, the child cancels out so the task WP isn't there. I would just love it if the left over child tasks complete with the parent when I find the unit. And yes, I succeed the parent and the parent task is crossed out, but the children are wide open and ready to go still. Are there any particulars about parent and child tasks that I may not be in the BIS wiki? If you see this Image, my tasks are listing as children.
  7. support ticket created: https://feedback.bistudio.com/T123456 just realized it is ticket 123456...
  8. So nobody can explain why children aren't closing out with parents then?
  9. Just good practice when scripting in SQF to use semicolons after each command in your then {}; block. Also close out the then block with the semi colon. if (condition) then {command1; command2;}; if (condition) then {command1; command2;} else {command3;}; if (condition) exitWith {command1;}; I use isEqualTo instead of == so I can use the script in multiplayer.
  10. That's what I gathered so far. Though the documentation says otherwise.
  11. I made a work around, though I am still not sure why my child tasks will not clear automatically when I set the parent to succeed. I created a trigger that activates when the Connors character joins my group. The trigger then executes this command to clean up the mission a bit: {if (_x find "rand_ally" isEqualto 0) then {deleteMarker _x;};} forEach allMapMarkers; {if (taskDescription _x find "Search location for Connors" isEqualto 1) then{_x setTaskState "Succeeded"; player removeSimpleTask _x;};}forEach simpleTasks player; task04 setTaskState "Succeeded"; I manually succeed and remove all of the child tasks that have the "Search location for Connors" string so the task list isn't populated with redundant child tasks that aren't relevant anymore. They are indeed child tasks, so I am still curious why they do not complete with the parent?
  12. @serena I read Lou Montana's entry, hence I came to the forum and asked if there was something amiss with how I was scripting my tasks. When I succeed the parent, the remaining children (and cancelled ones) should also succeed, but they aren't. If I am not doing something goofy, I will make a bug report. Who knows, it could be a mod that I am using or something? I appreciate you submitting a code, but it doesn't work because you forgot semicolons and a few other things. You also need to use isEqualTo instead of ==.
  13. //A trigger in mission editor activates startingIslandTasks myCreateTask2 = { params ["_unit", "_pos", "_name", "_desc", "_brief","_task"]; _newTask = _unit createSimpleTask [_name,_task]; _newTask setSimpleTaskDescription [_desc, _brief, _name]; _newTask setSimpleTaskDestination (_pos); _newTask setTaskState "CREATED"; _newTask; }; myCreateTask3 = { params ["_unit", "_name", "_desc", "_brief"]; _task = _unit createSimpleTask [_name]; _task setSimpleTaskDescription [_desc, _brief, _name]; _task setTaskState "CREATED"; _task; }; //A trigger in mission editor activates startingIslandTasks startingIslandTasks = { "rand_ally1" setMarkerAlpha 1; "rand_ally2" setMarkerAlpha 1; "rand_ally3" setMarkerAlpha 1; "rand_ally4" setMarkerAlpha 1; "rand_ally5" setMarkerAlpha 1; "rand_ally6" setMarkerAlpha 1; "rand_ally7" setMarkerAlpha 1; task02 = [player, getMarkerpos "tuvanaka_radio", "Reconnoitre GSM Station.", "Reconnoitre the GSM radio broadcasting station. Gather any possible intelligence about the facility or island. If possible, sequester the station and recruit any personnel willing to fight against the QDA. Should the facility be under QDA protection, it is recommended that you do not engage in hostilities until you comprehend the full capability of the local QDA forces.", "Reconnoitre GSM Station.",taskEnd] call myCreateTask2; task03 = [player, getMarkerpos "tuvanaka_comms", "Reconnoitre Comms Whiskey", "Reconnoitre the Comms Whiskey military broadcasting station. This station is likely the hub for all local military short range radio communications. If possible, do not engage in open hostilities with the local QDA forces. It is highly likely that Dedrianna's generals will order reestablishment of communications at this facility should they be disrupted.", "Reconnoitre Comms Whiskey",taskEnd] call myCreateTask2; task04 = [player, "Find Michael Connors", "Search possible remote locations for insights to the whereabouts of Michael Connors.", "Find Michael Connors"] call myCreateTask3; task04a = [player, getMarkerpos "rand_ally1", "Search location for Connors", "Search this location for signs of Michael Connors.", "Search location for Connors", task04] call myCreateTask2; task04b = [player, getMarkerpos "rand_ally2", "Search location for Connors", "Search this location for signs of Michael Connors.", "Search location for Connors", task04] call myCreateTask2; task04c = [player, getMarkerpos "rand_ally3", "Search location for Connors", "Search this location for signs of Michael Connors.", "Search location for Connors", task04] call myCreateTask2; task04d = [player, getMarkerpos "rand_ally4", "Search location for Connors", "Search this location for signs of Michael Connors.", "Search location for Connors", task04] call myCreateTask2; task04e = [player, getMarkerpos "rand_ally5", "Search location for Connors", "Search this location for signs of Michael Connors.", "Search location for Connors", task04] call myCreateTask2; task04f = [player, getMarkerpos "rand_ally6", "Search location for Connors", "Search this location for signs of Michael Connors.", "Search location for Connors", task04] call myCreateTask2; task04g = [player, getMarkerpos "rand_ally7", "Search location for Connors", "Search this location for signs of Michael Connors.", "Search location for Connors", task04] call myCreateTask2; task05 = [player, getMarkerpos "tuvanaka_afb", "Capture Tuvanaka AB", "Capture and hold the Tuvanaka air base. Holding this location will allow me to bring in equipment and mercenaries and make reinforcing the opposition more logistically complicated. I should not attack this facility head on, it is highly likely that the entirety of the QDA forces on this island are stationed here. I should have a full understanding of what I am up against before blindly assaulting a heavily gaurded air base.", "Capture Tuvanaka AB",taskEnd] call myCreateTask2; task06 = [player, getMarkerpos "Tuvanaka", "Capture the harbor city Tuvanaka", "Capture and hold the harbor city of Tuvanaka. This harbor is the second pier location in which supplies may be shipped to the island by sea. By holding this region, I may launch small boats, assault craft, landing vessels, and ferry troops and vehicles to other harbor locations that I own. By removing this city from the hands of the QDA, I can prevent my enemy from ferrying over heavy armor. The size and scope of the military presence located in Tuvanaka is unknown. It is likely to be gaurded by a security detail originating from Tuvanaka AB. Should the city fall into my hands, I can expect enemy forces to make an attempt to take it back.", "Capture the harbor city Tuvanaka",taskEnd] call myCreateTask2; task07 = [player, getMarkerpos "tuv_hosp", "Reconnoitre the Tuvanaka hospital.", "The Tuvanaka hospital is likely to be a great location to requisition medical supplies and expertise should I be unable to outsource. According to my intel, this private general hospital has working generators, an ER, clean water, and sanitation. Perhaps not the most advanced hospital in the world, they should be able to pry a bullet or two from your rear end in a pinch.", "Reconnoitre the Tuvanaka hospital.",taskEnd] call myCreateTask2; }; //A trigger in mission editor activates startingIslandTasks
  14. That's why I always use unique variables or I select units or vehicles through logic.
  15. stuguy

    How to create a custom squad?

    edit: I haven't been giving you solid programs. So I checked all of my work and made you a script that does work, assuming the BIS randomizer doesn't give the unit an armor that isn't large enough for the loadout, in that case, make the randomizer false. _reconGroups = []; _reconGroups resize 4; _reconGroups = _reconGroups apply {[grpNull]}; fn_myMarker = { _marker = []; _num = floor random 9; hint str _num; switch (_num) do{ case 1: {_marker = getMarkerPos "p1_1";}; case 2: {_marker = getMarkerPos "p1_2";}; case 3: {_marker = getMarkerPos "p1_3";}; case 4: {_marker = getMarkerPos "p1_4";}; case 5: {_marker = getMarkerPos "p1_5";}; case 6: {_marker = getMarkerPos "p1_6";}; case 7: {_marker = getMarkerPos "p1_7";}; case 8: {_marker = getMarkerPos "p1_8";}; case 9: {_marker = getMarkerPos "p1_9";}; }; _marker; }; { _x = createGroup east; _marker = call fn_myMarker; _unit1 = _x createUnit [ "O_T_Recon_M_F", _marker, [], 0, "NONE" ]; [_unit1] joinSilent _x; _unit1 setVariable ["BIS_enableRandomization", true]; _unit1 setRank "SERGEANT"; comment "Exported from Arsenal by stuguy"; comment "Remove existing items"; removeAllWeapons _unit1; removeAllItems _unit1; removeAllAssignedItems _unit1; removeUniform _unit1; removeVest _unit1; removeBackpack _unit1; removeHeadgear _unit1; removeGoggles _unit1; comment "Add containers"; _unit1 forceAddUniform "U_O_CombatUniform_ocamo"; _unit1 addItemToUniform "FirstAidKit"; for "_i" from 1 to 2 do {_unit1 addItemToUniform "30Rnd_65x39_caseless_green";}; _unit1 addVest "V_TacVest_khk"; _unit1 addItemToVest "30Rnd_65x39_caseless_green"; for "_i" from 1 to 2 do {_unit1 addItemToVest "30Rnd_65x39_caseless_green_mag_Tracer";}; for "_i" from 1 to 2 do {_unit1 addItemToVest "16Rnd_9x21_Mag";}; for "_i" from 1 to 2 do {_unit1 addItemToVest "HandGrenade";}; for "_i" from 1 to 2 do {_unit1 addItemToVest "O_IR_Grenade";}; _unit1 addItemToVest "SmokeShell"; _unit1 addItemToVest "SmokeShellRed"; _unit1 addItemToVest "SmokeShellOrange"; _unit1 addItemToVest "SmokeShellYellow"; for "_i" from 1 to 2 do {_unit1 addItemToVest "Chemlight_red";}; _unit1 addHeadgear "H_HelmetLeaderO_ocamo"; comment "Add weapons"; _unit1 addWeapon "arifle_Katiba_F"; _unit1 addPrimaryWeaponItem "acc_pointer_IR"; _unit1 addPrimaryWeaponItem "optic_Arco_blk_F"; _unit1 addWeapon "hgun_Rook40_F"; _unit1 addWeapon "Binocular"; comment "Add items"; _unit1 linkItem "ItemMap"; _unit1 linkItem "ItemCompass"; _unit1 linkItem "ItemWatch"; _unit1 linkItem "ItemRadio"; _unit1 linkItem "ItemGPS"; _unit1 linkItem "NVGoggles_OPFOR"; _unit2 = _x createUnit [ "O_T_Recon_M_F", _marker, [], 0, "NONE" ]; [_unit2] joinSilent _x; _unit2 setVariable ["BIS_enableRandomization", true]; _unit2 setRank "CORPORAL"; removeAllWeapons _unit2; removeAllItems _unit2; removeAllAssignedItems _unit2; removeUniform _unit2; removeVest _unit2; removeBackpack _unit2; removeHeadgear _unit2; removeGoggles _unit2; _unit2 forceAddUniform "U_O_CombatUniform_ocamo"; _unit2 addItemToUniform "FirstAidKit"; for "_i" from 1 to 2 do {_unit2 addItemToUniform "30Rnd_65x39_caseless_green";}; _unit2 addVest "V_HarnessO_brn"; for "_i" from 1 to 3 do {_unit2 addItemToVest "30Rnd_65x39_caseless_green";}; for "_i" from 1 to 2 do {_unit2 addItemToVest "16Rnd_9x21_Mag";}; for "_i" from 1 to 2 do {_unit2 addItemToVest "HandGrenade";}; _unit2 addItemToVest "SmokeShell"; _unit2 addItemToVest "SmokeShellRed"; _unit2 addItemToVest "SmokeShellOrange"; _unit2 addItemToVest "SmokeShellYellow"; for "_i" from 1 to 2 do {_unit2 addItemToVest "Chemlight_red";}; _unit2 addBackpack "B_FieldPack_cbr_Repair"; for "_i" from 1 to 2 do {_unit2 addItemToBackpack "ToolKit";}; _unit2 addHeadgear "H_HelmetO_ocamo"; _unit2 addWeapon "arifle_Katiba_C_F"; _unit2 addPrimaryWeaponItem "acc_pointer_IR"; _unit2 addPrimaryWeaponItem "optic_ACO_grn"; _unit2 addWeapon "hgun_Rook40_F"; _unit2 linkItem "ItemMap"; _unit2 linkItem "ItemCompass"; _unit2 linkItem "ItemWatch"; _unit2 linkItem "ItemRadio"; _unit2 linkItem "NVGoggles_OPFOR"; _unit3 = _x createUnit [ "O_T_Recon_M_F", _marker, [], 0, "NONE" ]; [_unit3] joinSilent _x; _unit3 setVariable ["BIS_enableRandomization", true]; _unit3 setRank "PRIVATE"; removeAllWeapons _unit3; removeAllItems _unit3; removeAllAssignedItems _unit3; removeUniform _unit3; removeVest _unit3; removeBackpack _unit3; removeHeadgear _unit3; removeGoggles _unit3; _unit3 forceAddUniform "U_O_CombatUniform_ocamo"; _unit3 addItemToUniform "FirstAidKit"; _unit3 addItemToUniform "ACE_Clacker"; _unit3 addItemToUniform "ACE_DefusalKit"; _unit3 addItemToUniform "30Rnd_65x39_caseless_green"; for "_i" from 1 to 2 do {_unit3 addItemToUniform "Chemlight_red";}; _unit3 addItemToUniform "HandGrenade"; _unit3 addVest "V_TacVest_khk"; for "_i" from 1 to 4 do {_unit3 addItemToVest "30Rnd_65x39_caseless_green";}; for "_i" from 1 to 2 do {_unit3 addItemToVest "16Rnd_9x21_Mag";}; for "_i" from 1 to 3 do {_unit3 addItemToVest "APERSMine_Range_Mag";}; _unit3 addItemToVest "HandGrenade"; _unit3 addItemToVest "SmokeShell"; _unit3 addItemToVest "SmokeShellRed"; _unit3 addBackpack "B_Carryall_ocamo_Exp"; for "_i" from 1 to 2 do {_unit3 addItemToBackpack "MineDetector";}; for "_i" from 1 to 6 do {_unit3 addItemToBackpack "APERSBoundingMine_Range_Mag";}; for "_i" from 1 to 4 do {_unit3 addItemToBackpack "ClaymoreDirectionalMine_Remote_Mag";}; for "_i" from 1 to 3 do {_unit3 addItemToBackpack "SLAMDirectionalMine_Wire_Mag";}; _unit3 addItemToBackpack "DemoCharge_Remote_Mag"; _unit3 addHeadgear "H_HelmetO_ocamo"; _unit3 addWeapon "arifle_Katiba_C_F"; _unit3 addPrimaryWeaponItem "acc_pointer_IR"; _unit3 addPrimaryWeaponItem "optic_ACO_grn"; _unit3 addWeapon "hgun_Rook40_F"; _unit3 linkItem "ItemMap"; _unit3 linkItem "ItemCompass"; _unit3 linkItem "ItemWatch"; _unit3 linkItem "ItemRadio"; _unit3 linkItem "NVGoggles_OPFOR"; _unit4 = _x createUnit [ "O_T_Recon_M_F", _marker, [], 0, "NONE" ]; [_unit4] joinSilent _x; _unit4 setVariable ["BIS_enableRandomization", true]; _unit4 setRank "PRIVATE"; removeAllWeapons _unit4; removeAllItems _unit4; removeAllAssignedItems _unit4; removeUniform _unit4; removeVest _unit4; removeBackpack _unit4; removeHeadgear _unit4; removeGoggles _unit4; _unit4 forceAddUniform "U_O_CombatUniform_ocamo"; _unit4 addItemToUniform "FirstAidKit"; for "_i" from 1 to 2 do {_unit4 addItemToUniform "30Rnd_65x39_caseless_green";}; _unit4 addVest "V_TacVest_khk"; for "_i" from 1 to 3 do {_unit4 addItemToVest "30Rnd_65x39_caseless_green";}; for "_i" from 1 to 2 do {_unit4 addItemToVest "16Rnd_9x21_Mag";}; _unit4 addItemToVest "SmokeShell"; _unit4 addItemToVest "SmokeShellRed"; _unit4 addItemToVest "SmokeShellOrange"; _unit4 addItemToVest "SmokeShellYellow"; for "_i" from 1 to 2 do {_unit4 addItemToVest "Chemlight_red";}; _unit4 addBackpack "B_FieldPack_ocamo_Medic"; for "_i" from 1 to 2 do {_unit4 addItemToBackpack "Medikit";}; for "_i" from 1 to 20 do {_unit4 addItemToBackpack "FirstAidKit";}; _unit4 addHeadgear "H_HelmetO_ocamo"; _unit4 addWeapon "arifle_Katiba_F"; _unit4 addPrimaryWeaponItem "acc_pointer_IR"; _unit4 addWeapon "hgun_Rook40_F"; _unit4 linkItem "ItemMap"; _unit4 linkItem "ItemCompass"; _unit4 linkItem "ItemWatch"; _unit4 linkItem "ItemRadio"; _unit4 linkItem "NVGoggles_OPFOR"; [_x,_marker, 100] call BIS_fnc_taskPatrol; //_reconGroups set [_forEachIndex, _grp]; }forEach _reconGroups; This function creates four squads of 4 and randomly places them to waypoints. Below this post is a link for the full mission file to show how this works. It sometimes throws errors because too many man spawn on top of each other at one spot, or the loadouts prevent the unit equipment settings from firing off. This can be fixed by playing with the unit creation settings to spread them out a bit and setting "BIS_enableRandomization", false. This script was just an example on how to quickly make 4 dudes in 4 recon teams and randomize their patrols and spawn locations. Tweak it to fit your needs.
  16. stuguy

    How to create a custom squad?

    fn_setPatrol = { params ["_reconsquad"]; _RandomPatrol = ""; switch (floor random 6) do{ case 1: {_RandomPatrol = [_reconsquad, getMarkerPos "ANOTHERLOC0", 2000] call BIS_fnc_taskPatrol;}; case 2: {_RandomPatrol = [_reconsquad, getMarkerPos "ANOTHERLOC1", 2000] call BIS_fnc_taskPatrol;}; case 3: {_RandomPatrol = [_reconsquad, getMarkerPos "ANOTHERLOC2", 2000] call BIS_fnc_taskPatrol;}; case 4: {_RandomPatrol = [_reconsquad, getMarkerPos "ANOTHERLOC3", 2000] call BIS_fnc_taskPatrol;}; case 5: {_RandomPatrol = [_reconsquad, getMarkerPos "ANOTHERLOC4", 2000] call BIS_fnc_taskPatrol;}; default : {_RandomPatrol = [_reconsquad, getMarkerPos "MAINAOLOC", 2000] call BIS_fnc_taskPatrol;}; }; _RandomPatrol; }; edited to turn into a function that accepts a group.
  17. stuguy

    Custom keys to activate scripts

    yes. Player key binds are not broadcasted to the server. Only resulting actions that are specifically broadcast to the server are not local.
  18. stuguy

    How to create a custom squad?

    This is what I usually did back in the day. In the mission editor, I created a bunch of dot markers and set the transparency to 0%. I then named the marker stuff like, p1_1, and copied it a bunch of times, making p1_2, p1_3, etc. I copied them into waypoint positions that I wanted my patrols to go to. For each new "random" patrol, I would add 1 to the p, IE, p2_1. Eventually, I would have like 11 or 12 possible p#_# routes. Then in my script, I have a switch do statement with random in my condition. I would have random pick a number between 1 and the total number of my patrols. That switch statement would then assign the markers as waypoint positions for my patrol. edit: I also reused a lot of patrol points for other patrols. I made sure vehicle waypoints went into intersections and major road hubs. I would name particularly important waypoints, like intersections in populated areas, uniquely. IE: townName_intersection_1. I also added invisible markers for AI helicopter landing zones and regroup positions. So I would have triggers that would send special forces or counter attacks to certain waypoints if the player was detected in a certain spot, or if certain mission parameters became true. edit2: getMarkerPos: https://community.bistudio.com/wiki/getMarkerPos
  19. vehicle player returns the vehicle the player is in. vehicle player != player is always true if the player is in a vehicle. It is false if the player is not in a vehicle. I just tested: if(vehicle player != player) then {hint "player in vehicle";}else{hint "player not in vehicle";}; In a car, truck, tank, helicopter, and enemy tank in the VR. When I was in a vehicle, the "player in vehicle" fired off. When I was a foot mobile, the "player not in vehicle" fired off. It may be possible that your tank is a mod and is not properly setup in its class configs.
  20. With @Larrow's assistance, I was able to hash out the program I wanted to manage my soldiers with addAction menus. I will create a mod thread when I have the vehicle assignment actions added. Full script: myGrps = []; myGrps resize 10; myGrps = myGrps apply { [ grpNull ] }; TAG_fnc_hasBlankHC = { _bool = false; { _x params[ "_HCGrp", "_HCActionID" ]; if ( isNull _HCGrp ) exitWith {_bool = true;}; }forEach myGrps; _bool; }; TAG_fnc_isLastHCMan = { _bool = false; { _x params[ "_HCGrp", "_HCActionID" ]; if (( Group cursorTarget isEqualTo _HCGrp ) && {{ alive _x }count units _HCGrp isEqualTo 1}) exitWith {_bool = true;}; }forEach myGrps; _bool; }; TAG_fnc_JoinFunction = { _unit = _this select 0; _grp = _this select 1; _str = _this select 2; //accepting variable "unit or from Group" and "target group" if (_str == "unit") then { [_unit] joinSilent _grp; }else { { [ _x ] joinSilent _grp; }forEach units _unit; }; _leader = Leader _grp; { if(!(_leader isEqualTo _x) && {(rankId _x) > (rankId _leader)}) then { _leader = _x; }; }forEach units _grp; _grp selectLeader _leader; }; TAG_fnc_createNewHCGroup = { params[ "_unit", [ "_create", true ], [ "_wholeGroup", false ] ]; _CompanyNames = ["CompanyXray","CompanyNovember","CompanyNovember","CompanyNovember","CompanyNovember","CompanyWhiskey","CompanyWhiskey","CompanyWhiskey","CompanyWhiskey","CompanyXray"]; _PlatoonNames = ["Platoon1","Platoon1","Platoon1","Platoon2","Platoon2","Platoon1","Platoon1","Platoon2","Platoon2","Platoon1"]; _SquadNames = ["Squad1","Squad1","Squad2","Squad1","Squad2","Squad1","Squad2","Squad1","Squad2","Squad2"]; { _x params[ "_HCGrp", "_HCActionID" ]; if ( !isNull _HCGrp && { { alive _x }count units _HCGrp isEqualTo 0 } ) then { deleteGroup _HCGrp; player hcRemoveGroup _HCGrp; if ( _HCActionID isEqualType 0 ) then { player removeAction _HCActionID; }; myGrps set [ _forEachIndex, [ grpNull ] ]; _HCGrp = grpNull; }; if ( _create && { isNull _HCGrp } ) then { private [ "_group" ]; if !( isPlayer _unit ) then { _group = createGroup side player; }else{ _group = group player; }; _group setGroupIdGlobal [ "%GroupNames %GroupCompany %GroupPlatoon-%GroupSquad", "Yankee", _CompanyNames select _forEachIndex, _PlatoonNames select _forEachIndex, _SquadNames select _forEachIndex ]; if !( _unit in units _group ) then { _oldGroup = group _unit; if ( _wholeGroup ) then { units _oldGroup joinSilent _group; }else{ [ _unit ] joinSilent _group; }; if ( count units _oldGroup isEqualTo 0 ) then { deleteGroup _oldGroup; }; }; _actionID = if !( isPlayer _unit ) then { player hcSetGroup [ _group ]; [ _group ] call TAG_fnc_joinHCGroup; [ _group ] call TAG_fnc_groupJoinHCGroup; }else{ objNull; }; myGrps set [ _forEachIndex, [ _group, _actionID ] ]; _create = false; }; }forEach myGrps; }; TAG_fnc_grpJoinMe = { player addAction [ "Group Join Me", { cursorTarget setCaptive false; {[ _x ] joinSilent group player;}forEach units group cursorTarget; [ objNull, false ] call TAG_fnc_createNewHCGroup; }, [], 1, false, true, "", " !(isnull cursortarget) && (_this isEqualTo _target) && { (cursorTarget isKindof 'Man') && { (alive cursortarget) && { ( side cursortarget isEqualTo side player || captive cursorTarget ) && { (leader group cursorTarget isEqualTo cursorTarget) && { ({alive _x} count units group cursorTarget > 1) && (({ alive _x } count units group cursorTarget) + ({ alive _x } count units group player) < 12) } } } } }" ]; }; TAG_fnc_joinMe = { player addAction [ "Join Me", { cursorTarget setCaptive false; [ cursorTarget ] joinSilent group player; [ objNull, false ] call TAG_fnc_createNewHCGroup; }, [], 1, false, true, "", " !(isnull cursortarget) && _this isEqualTo _target && { cursorTarget isKindof 'Man' && { alive cursortarget && { ( side cursortarget isEqualTo side player || captive cursorTarget ) && { !(group cursortarget isEqualTo group player) && { ({ alive _x } count units group player < 12) } } } } }" ]; }; TAG_fnc_groupJoinHCGroup = { params[ "_HCGrp" ]; _actionID = player addAction [ format [ "Group Join %1", groupID _HCGrp ], { params[ "_target", "_caller", "_ID", "_args" ]; [ Group cursorTarget, _args, "" ] call TAG_fnc_JoinFunction; if (Group cursorTarget in myGrps) then { [ objNull, false ] call TAG_fnc_createNewHCGroup; }; }, _HCGrp, 1, false, true, "", format [" _group = %1 call BIS_fnc_groupFromNetId; !(isnull cursortarget) && (_this isEqualTo _target) && { (cursorTarget isKindof 'Man') && { (alive cursortarget) && { ( side cursortarget isEqualTo side player || captive cursorTarget ) && { (call TAG_fnc_hasBlankHC) && { !(Group cursorTarget isEqualTo _group) && { !(Group player isEqualTo _group) && { (leader group cursorTarget isEqualTo cursorTarget) && { ({ alive _x } count units (group cursorTarget) > 1) && { ({ alive _x } count units (_group) > 0) && (({ alive _x } count units (_group)) + ({ alive _x } count units cursorTarget) < 12) } } } } } } } } }", str ( _HCGrp call BIS_fnc_netId ) ] ]; _actionID; }; TAG_fnc_joinHCGroup = { params[ "_HCGrp" ]; _actionID = player addAction [ format [ "Join %1", groupID _HCGrp ], { params[ "_target", "_caller", "_ID", "_args" ]; [ cursorTarget, _args, "unit" ] call TAG_fnc_JoinFunction; [ objNull, false ] call TAG_fnc_createNewHCGroup; }, _HCGrp, 1, false, true, "", format [ " _group = %1 call BIS_fnc_groupFromNetId; !(isnull cursortarget) && _this isEqualTo _target && { cursorTarget isKindof 'Man' && { alive cursortarget && { ( side cursortarget isEqualTo side player || captive cursorTarget ) && { !(group cursortarget isEqualTo _group) && { ({ alive _x } count units (_group) > 0) && ({ alive _x } count units (_group) < 12) } } } } }", str ( _HCGrp call BIS_fnc_netId ) ] ]; _actionID }; TAG_fnc_HCActions = { player addAction [ "Unit to HC Group", { [ cursorTarget, true ] call TAG_fnc_createNewHCGroup; }, [], 1, false, true, "", " !(isnull cursortarget) && _this isEqualTo _target && { cursorTarget isKindof 'Man' && { alive cursortarget && { ( side cursortarget isEqualTo side player || captive cursorTarget ) && { (call TAG_fnc_hasBlankHC) } } } }" ]; player addAction [ "Group to HC Group", { [ cursorTarget, true, true ] call TAG_fnc_createNewHCGroup; }, [], 1, false, true, "", " !(isnull cursortarget) && _this isEqualTo _target && { cursorTarget isKindof 'Man' && { alive cursortarget && { ( side cursortarget isEqualTo side player || captive cursorTarget ) && { !(hcLeader Group cursorTarget isEqualTo player) && { (call TAG_fnc_hasBlankHC) && { leader group cursorTarget isEqualTo cursorTarget && count units group cursorTarget > 1 } } } } } }" ]; player addAction [ "Dismiss HC Group", { player hcRemoveGroup group cursorTarget; { _x params[ "_group", "_action" ]; if ( _group isEqualTo group cursorTarget ) exitWith { player removeAction _action; player hcRemoveGroup _group; myGrps set [ _forEachIndex, [ grpNull ] ]; }; }forEach myGrps; }, [], 1, false, true, "", " !(isnull cursortarget) && _this isEqualTo _target && { cursorTarget isKindof 'Man' && { alive cursortarget && { ( side cursortarget isEqualTo side player || captive cursorTarget ) && { leader group cursorTarget isEqualTo cursorTarget && { group cursorTarget isEqualTo ( _x select 0 ) }count myGrps > 0 } } } }" ]; }; _null = [ player, true ] call TAG_fnc_createNewHCGroup; _null = [] call TAG_fnc_joinMe; _null = [] call TAG_fnc_grpJoinMe; _null = [] call TAG_fnc_HCActions;
  21. Now I got most of the issues sorted. Most everything works. There is a problem with the conditions in one of the functions. Somehow they are always true, but when tested individually, they are not. function that is always true after I assign an HC squad: Entire program, works with the exception that the group add to HC group function is true for everyone, even though the conditions specify that the guy has to be a leader and he can't join the player or same group as himself: I got some sleep and followed up the next day. I forgot a simple brace to close out some conditions. That fixed the add action. I posted the full script at the top of this thread.
  22. stuguy is fine. Glad I could help. Enjoy :)
  23. you can also add more cases obviously. Like if you want a heavy weapons team or something. If you want a bunch of rifleman, but one of each of the specialists, then riflemen can use case default and default will execute for all cases that aren't being handled manually. Like the code I sent you way above with the default case. Should you have had a squad leader, grenadier, medic, marksman, and AT soldier, the default case could have been a standard rifleman, and however many extra men in the squad you had would have been riflemen, assuming you didn't handle case # for the position of the current index.
×