Nemorz 11 Posted January 28, 2011 Hey guys, looking to have an addAction on a High Commander who can request a SITREP from all specified forces under his command, and return a hint/sideChat as to how many units are remaining in the group. Right now I have a trigger doing this automatically but I'd prefer for him to be able to check the strengths, in detail, at will. In testing: Group 1 = CDFSection1 (has 10 units in total) Trigger: Condition: (count (units CDFSection1)) == 8; On Act: CDF_Commander sideChat "CDF Section 1 @ 80% strength." As I say, this all works fine but not as robust as I would like, besides there are going to be ALOT of groups under his command so I need something more versatile that will check all groups quickly and identify remaining numbers in each. Also, I realize that in a hint or sideChat there may be more units than this can handle scrolling at once (meaning he may miss some pertinant information). Any ideas on how to move forward would be appreciated. Regards, Nemor. Share this post Link to post Share on other sites
Andy455 11 Posted January 28, 2011 _aliveCount = {alive _x} count (units goup) // Will return the alive units in specified group Share this post Link to post Share on other sites
Nemorz 11 Posted January 28, 2011 (edited) Thanks I have that all working in addAction now. Is there any way I can make it give me a comprehensive list without it missing or overriding details? What I mean is, if I have say 20+ groups, and I ask it to return the values for each group, hint will only show the last one (unless I put in countless sleeps) and sideChat/vehicleChat etc spams my screen. Is there a way I can have it popup information on all groups on titleText or something, so it displays all group strengths in one swoop and have it hover on my screen for x seconds, or even add it to my notes section or something? Thanks for the return count Andy. Edit: never mind it was \n Edited January 28, 2011 by Nemorz Share this post Link to post Share on other sites
demonized 20 Posted January 29, 2011 Thanks I have that all working in addAction now.Is there any way I can make it give me a comprehensive list without it missing or overriding details? What I mean is, if I have say 20+ groups, and I ask it to return the values for each group, hint will only show the last one (unless I put in countless sleeps) and sideChat/vehicleChat etc spams my screen. Is there a way I can have it popup information on all groups on titleText or something, so it displays all group strengths in one swoop and have it hover on my screen for x seconds, or even add it to my notes section or something? Thanks for the return count Andy. Edit: never mind it was \n I think using notes will be the best way to acomplish this: Untested but you can try and do this: it requires some research on your part and some scripting knowledge. In the addaction script of yours (sitrep) create a task for the named unit or player and complete it imediatly using a variable, in tasks you can define notes, simply use call to run a script block wich checks the info you desire from each group in an array and and pass it with format to the notes section. Then when you run the addaction again have it delete the previous task and create a new one using same. Theory of how this would work: 1: you use the addaction. 2: addaction script checks if the task sitrep is completed, if it is completed it deletes task sitrep. 3: addaction script checks each group for amount of units alive, how many medics alive in group, other types, collects % of ammo left in group and combines the percentages to a group ammo percentage etc. other info you need. 4: creates a task and its completed imediatly, with notes that are passed with format from the addaction info part. Share this post Link to post Share on other sites
shuko 59 Posted January 29, 2011 (edited) Group member init: grpA = group this; grpA setgroupid ["Group A"]; Script to be called from action: private ["_groups","_str","_getGrpName"]; _groups = player getvariable "MARTA_REVEAL"; _getGrpName = { private "_g"; _g = toarray str _this; _g set [0,"DEL"]; _g set [1,"DEL"]; _g = _g - ["DEL"]; _g = tostring _g; _g }; _str = "Group Strengths\n"; { _str = _str + format ["%1: %2\n",(_x call _getGrpName),{alive _x} count (units _x)]; } foreach _groups; hint _str; Test/example mission Edited January 29, 2011 by Shuko Share this post Link to post Share on other sites
Nemorz 11 Posted January 30, 2011 (edited) Cheers for the follow ups guys, in case anyone is interested in the scripts I currently am using (hint seems to work just fine for me for the moment, but I may experiment with map notes and tasks at a later date, I just need something that works sooner rather than later) init.sqf if (local player) then { Joker addAction [ ("<t color=""#FF0000"">" + ("SITREP") + "</t>"), "Scripts\NP\SITREP.sqf" ]; }; Folders: Scripts\NP (As I plan to have a unit check for 3 seperate Factions) SITREP.sqf execVM "Scripts\NP\SITREP_Aircraft.sqf"; sleep 5; execVM "Scripts\NP\SITREP_Armour.sqf"; sleep 5; execVM "Scripts\NP\SITREP_Vehicle.sqf"; sleep 5; execVM "Scripts\NP\SITREP_Static.sqf"; sleep 5; execVM "Scripts\NP\SITREP_Infantry.sqf"; As you can see above, for the moment I have it on a cycle because often there can be too many units to put onto the screen all at once. SITREP_Infantry.sqf _aliveSniper1 = {alive _x} count (units NPSniper1); _aliveSniper2 = {alive _x} count (units NPSniper2); _aliveSniper3 = {alive _x} count (units NPSniper3); _aliveSniper4 = {alive _x} count (units NPSniper4); _aliveSniper5 = {alive _x} count (units NPSniper5); _aliveSniper6 = {alive _x} count (units NPSniper6); _aliveSniper7 = {alive _x} count (units NPSniper7); _aliveSniper8 = {alive _x} count (units NPSniper8); _aliveSniper9 = {alive _x} count (units NPSniper9); _aliveSniper10 = {alive _x} count (units NPSniper10); _aliveRecon1 = {alive _x} count (units NPRecon1); _aliveRecon2 = {alive _x} count (units NPRecon2); _aliveRecon3 = {alive _x} count (units NPRecon3); _aliveRecon4 = {alive _x} count (units NPRecon4); _aliveRecon5 = {alive _x} count (units NPRecon5); _alivePlatoon1 = {alive _x} count (units NPPlatoon1); _alivePlatoon2 = {alive _x} count (units NPPlatoon2); _alivePlatoon3 = {alive _x} count (units NPPlatoon3); _alivePlatoon4 = {alive _x} count (units NPPlatoon4); _alivePlatoon5 = {alive _x} count (units NPPlatoon5); _alivePlatoon6 = {alive _x} count (units NPPlatoon6); _alivePlatoon7 = {alive _x} count (units NPPlatoon7); _alivePlatoon8 = {alive _x} count (units NPPlatoon8); _alivePlatoon9 = {alive _x} count (units NPPlatoon9); _alivePlatoon10 = {alive _x} count (units NPPlatoon10); _alivePlatoon11 = {alive _x} count (units NPPlatoon11); sleep 2; if (!isDedicated) then { if (player == Joker) then { hint format[" SITREP: Infantry\n \n Sniper Team: %1 of 2\n Lone Sniper 1: %2 of 1\n Lone Sniper 2: %3 of 1\n Lone Sniper 3: %4 of 1\n Lone Sniper 4: %5 of 1\n Lone Sniper 5: %6 of 1\n Lone Sniper 6: %7 of 1\n Lone Sniper 7: %8 of 1\n Lone Sniper 8: %9 of 1\n Lone Sniper 9: %10 of 1\n \n Recon Team 1: %11 of 5\n Recon Team 2: %12 of 5\n Recon Team 3: %13 of 5\n Recon Team 4: %14 of 5\n Recon Team 5: %15 of 5\n \n Platoon 1: %16 of 30\n Platoon 2: %17 of 30\n Platoon 3: %18 of 30\n Platoon 4: %19 of 30\n Platoon 5: %20 of 30\n Platoon 6: %21 of 30\n Platoon 7: %22 of 30\n Platoon 8: %23 of 30\n Platoon 9: %24 of 30\n Platoon 10: %25 of 30\n Platoon 11: %26 of 30\n ", (_aliveSniper1), (_aliveSniper2), (_aliveSniper3), (_aliveSniper4), (_aliveSniper5), (_aliveSniper6), (_aliveSniper7), (_aliveSniper8), (_aliveSniper9), (_aliveSniper10), (_aliveRecon1), (_aliveRecon2), (_aliveRecon3), (_aliveRecon4), (_aliveRecon5), (_alivePlatoon1), (_alivePlatoon2), (_alivePlatoon3), (_alivePlatoon4), (_alivePlatoon5), (_alivePlatoon6), (_alivePlatoon7), (_alivePlatoon8), (_alivePlatoon9), (_alivePlatoon10), (_alivePlatoon11)]; } else { hint "Joker is requesting a SITREP."; }; }; SITREP_Vehicle.sqf (Just posting this because I like to know that if Crew members are lost, is the Vehicle itself still serviceable?) _aliveTech1Veh = alive vehicle NP_Technical_1; _aliveTech1 = {alive _x} count (units NPTechnical1); _aliveTech2Veh = alive vehicle NP_Technical_2; _aliveTech2 = {alive _x} count (units NPTechnical2); _aliveTech3Veh = alive vehicle NP_Technical_3; _aliveTech3 = {alive _x} count (units NPTechnical3); _aliveTech4Veh = alive vehicle NP_Technical_4; _aliveTech4 = {alive _x} count (units NPTechnical4); _aliveTech5Veh = alive vehicle NP_Technical_5; _aliveTech5 = {alive _x} count (units NPTechnical5); _aliveTech6Veh = alive vehicle NP_Technical_6; _aliveTech6 = {alive _x} count (units NPTechnical6); _aliveTech7Veh = alive vehicle NP_Technical_7; _aliveTech7 = {alive _x} count (units NPTechnical7); _aliveTech8Veh = alive vehicle NP_Technical_8; _aliveTech8 = {alive _x} count (units NPTechnical8); _aliveTech9Veh = alive vehicle NP_Technical_9; _aliveTech9 = {alive _x} count (units NPTechnical9); _aliveTech10Veh = alive vehicle NP_Technical_10; _aliveTech10 = {alive _x} count (units NPTechnical10); sleep 2; if (!isDedicated) then { if (player == Joker) then { hint format[" SITREP: Vehicle\n \n Technical (PKMT): %1\n Crew: %2 of 2\n Technical (PKMT): %3\n Crew: %4 of 2\n Technical (PKMT): %5\n Crew: %6 of 2\n Hilux (DShKM): %7\n Crew: %8 of 2\n Hilux (DShKM): %9\n Crew: %10 of 2\n Hilux (DShKM): %11\n Crew: %12 of 2\n Hilux (DShKM): %13\n Crew: %14 of 2\n Hilux (SPG-9): %15\n Crew: %16 of 2\n Hilux (SPG-9): %17\n Crew: %18 of 2\n Hilux (SPG-9): %19\n Crew: %20 of 2\n \n true = alive false = dead", (_aliveTech1Veh), (_aliveTech1), (_aliveTech2Veh), (_aliveTech2), (_aliveTech3Veh), (_aliveTech3), (_aliveTech4Veh), (_aliveTech4), (_aliveTech5Veh), (_aliveTech5), (_aliveTech6Veh), (_aliveTech6), (_aliveTech7Veh), (_aliveTech7), (_aliveTech8Veh), (_aliveTech8), (_aliveTech9Veh), (_aliveTech9), (_aliveTech10Veh), (_aliveTech10)]; } else { hint "Joker is requesting a SITREP."; }; }; Every vehicle has it's own unique name in the name field to check the vehicle, and every group has e.g. "NPTechnical1 = group this;" for calling the number of crew in every group. I will incorporate your code though shk as it will make my workload lighter in the future, not having to personally list every vehicle so many thanks, and to Demonized also. Only problems with this method, as it stands are; a) I have to cycle them because the hints screen and text can disappear off the bottom of the screen b) Vehicle alive returns either; true or false (Ideally like to have something in its place, but this isn't a breaker) SITREP Image 1 SITREP Image 2 SITREP Image 3 SITREP Image 4 SITREP Image 5 Edit: Wow shk only just noticed the example mission, I can't thank you enough for going that far. Much appreciated :] Edited January 30, 2011 by Nemorz Share this post Link to post Share on other sites