viel.kuul.10 0 Posted May 11, 2021 I managed to split this script into three parts or three hints individually. Spoiler addMissionEventHandler ["entityKilled",{ params ["_unit"]; private _grp = group _unit; private _side = side _grp; private _type = getText (configOf _unit / "displayName"); if (isNil {_grp getVariable "dataKilled"}) then { _grp setVariable ["dataKilled",[[_side,_type,0]]]; } else { if !([_side,_type] in ((_grp getVariable "dataKilled") apply {[_x#0,_x#1]})) then { (_grp getVariable "dataKilled") pushBack [_side,_type,0]; }; }; private _idx = (((_grp getVariable "dataKilled") apply {[_x#0,_x#1]}) find [_side,_type]); private _cnt = (_grp getVariable "dataKilled") #_idx#2; (_grp getVariable "dataKilled") set [_idx, [_side,_type,_cnt +1]]; }]; [] spawn { while {true} do { waitUntil {sleep 1; triggerActivated trig1}; private _txtWEST = "DEAD HELLENIC UNITS "; { _grp = _x; { _x params ["_side","_type","_cnt"]; call { if (_side isEqualTo WEST) exitWith { if !(str _grp in str _txtWEST) then { _txtWEST = composeText [_txtWEST,lineBreak,str _grp] }; _txtWEST = composeText [_txtWEST,' ' +_type + ' ' + str _cnt]; }; }; } forEach (_grp getVariable "dataKilled"); } forEach (allGroups select {!isNil {_x getVariable "dataKilled"}}); if (_txtWEST isEqualTo "DEAD HELLENIC UNITS ") then {_txtWEST = "DEAD HELLENIC UNITS: 0 casualty"}; hint composeText [_txtWEST]; waitUntil {sleep 1; !triggerActivated trig1}; }; }; [] spawn { while {true} do { waitUntil {sleep 1; triggerActivated trig2}; private _txtEAST = "DEAD TURKISH UNITS "; { _grp = _x; { _x params ["_side","_type","_cnt"]; call { if (_side isEqualTo EAST) exitWith { if !(str _grp in str _txtEAST) then { _txtEAST = composeText [_txtEAST,lineBreak,str _grp] }; _txtEAST = composeText [_txtEAST,' ' +_type + ' ' + str _cnt]; }; }; } forEach (_grp getVariable "dataKilled"); } forEach (allGroups select {!isNil {_x getVariable "dataKilled"}}); if (_txtEAST isEqualTo "DEAD TURKISH UNITS ") then {_txtEAST = "DEAD TURKISH UNITS: 0 casualty"}; hint composeText [_txtEAST]; waitUntil {sleep 1; !triggerActivated trig2}; }; }; [] spawn { while {true} do { waitUntil {sleep 1; triggerActivated trig3}; private _txtINDEP = "DEAD MAIDEN UNITS "; { _grp = _x; { _x params ["_side","_type","_cnt"]; call { if (_side isEqualTo INDEPENDENT) exitWith { if !(str _grp in str _txtINDEP) then { _txtINDEP = composeText [_txtINDEP,lineBreak,str _grp] }; _txtINDEP = composeText [_txtINDEP,' ' +_type + ' ' + str _cnt]; }; }; } forEach (_grp getVariable "dataKilled"); } forEach (allGroups select {!isNil {_x getVariable "dataKilled"}}); if (_txtINDEP isEqualTo "DEAD MAIDEN UNITS ") then {_txtINDEP = "DEAD MAIDEN UNITS: 0 casualty"}; hint composeText [_txtINDEP]; waitUntil {sleep 1; !triggerActivated trig3}; }; }; Share this post Link to post Share on other sites
viel.kuul.10 0 Posted December 8, 2022 This code works perfectly if only a couple of soldiers in one group are killed. But when an entire group is killed, the code doesn't work. Like as if that group had never been spawned. I'm trying to figure out where the problem is. I guess I might get an answer. Share this post Link to post Share on other sites
Harzach 2517 Posted December 9, 2022 1 hour ago, viel.kuul.10 said: But when an entire group is killed ...the group is automatically deleted. Share this post Link to post Share on other sites
viel.kuul.10 0 Posted December 9, 2022 19 hours ago, Harzach said: ...the group is automatically deleted. It seems.hHow to save the results, especially after the battle? I would like that to always show the results once the whole group is killed. The same thing is also with individual vehicles Share this post Link to post Share on other sites
viel.kuul.10 0 Posted December 10, 2022 Why haven't I received an answer yet? I hope they don't hold anything against me. Share this post Link to post Share on other sites
RCA3 591 Posted December 11, 2022 Try adding this outside the scope of your other script. On init.sqf addMissionEventHandler ["GroupCreated", { params ["_group"]; _group deleteGroupWhenEmpty false; }]; Share this post Link to post Share on other sites
viel.kuul.10 0 Posted December 11, 2022 18 hours ago, RCA3 said: Try adding this outside the scope of your other script. On init.sqf addMissionEventHandler ["GroupCreated", { params ["_group"]; _group deleteGroupWhenEmpty false; }]; Can you show where your code should be in my code? I tried it a couple of times and it doesn't work. Share this post Link to post Share on other sites
RCA3 591 Posted December 11, 2022 It might just not work. But add it anywhere on init.sqf. Excluded from your code (outside scope { }). Share this post Link to post Share on other sites
Harzach 2517 Posted December 12, 2022 55 minutes ago, RCA3 said: It might just not work The function of deleteGroupWhenEmpty can be confusing. In general, when all units in a group are dead, the group will be automatically deleted. An exception to this is when the units are deleted (via deleteVehicle or similar) - the group will remain. That is what this command is for, to set the delete flag on a group which, for whatever reason, will not be auto-deleted. If a group will normally be auto-deleted, this command will not prevent it from being deleted. TL;DR - this will not work in this situation Share this post Link to post Share on other sites
RCA3 591 Posted December 12, 2022 20 minutes ago, Harzach said: In general, when all units in a group are dead, the group will be automatically deleted. Not if you set this flag to false. I kinda used this before. And tested it again now. Dedmen was discussing this with Lou this week actually. Quote 13:37]Dedmen (ง •̀_•́)ง: setting to false doesn't prevent deleteGroup command or other engine things deleting it. (Oh My God the hour is 1337 🤣) 20 minutes ago, Harzach said: If a group will normally be auto-deleted, this command will not prevent it from being deleted. Ye, this is false. Share this post Link to post Share on other sites
Harzach 2517 Posted December 12, 2022 Quote Dedmen (ง •̀_•́)ง: setting to false doesn't prevent deleteGroup command or other engine things deleting it. Quote Harzach said: If a group will normally be auto-deleted, this command will not prevent it from being deleted. Two of these things are the same. So you are saying Dedmen is wrong? Share this post Link to post Share on other sites
RCA3 591 Posted December 12, 2022 8 minutes ago, Harzach said: Two of these things are the same. So you are saying Dedmen is wrong? He's talking about deleteGroup, not deleteGroupWhenEmpty Or better, both, but referencing deleteGroupWhenEmpty false. 8 minutes ago, Harzach said: Two of these things are the same. One is saying deleteGroupWhenEmpty false won't prevent deleteGroup from deleting it. Other is saying group will be deleted regardless what deleteGroupWhenEmpty is set. Hardly the same 😋 Share this post Link to post Share on other sites
Harzach 2517 Posted December 12, 2022 28 minutes ago, RCA3 said: One is saying deleteGroupWhenEmpty false won't prevent deleteGroup from deleting it. You forgot the important part: Quote or other engine things 27 minutes ago, RCA3 said: Other is saying group will be deleted regardless what deleteGroupWhenEmpty is set. No, I said setting that flag won't prevent a group from being auto-deleted (aka other engine things). Dedmen's statement and mine are in full agreement. Share this post Link to post Share on other sites
RCA3 591 Posted December 12, 2022 1 hour ago, Harzach said: aka other engine things He was referencing Garbage Collector and/or other commands/stuff. You can test it, kill the guy and check for group, won't delete. Share this post Link to post Share on other sites
viel.kuul.10 0 Posted December 12, 2022 20 hours ago, RCA3 said: It might just not work. But add it anywhere on init.sqf. Excluded from your code (outside scope { }). So I did. Does not work. I don't understand why the group is automatically deleted when it is killed. Share this post Link to post Share on other sites
RCA3 591 Posted December 12, 2022 4 hours ago, viel.kuul.10 said: So I did. Does not work. I don't understand why the group is automatically deleted when it is killed. It works here. Maybe you didn't paste outside of scope. This is my init.sqf: Spoiler addMissionEventHandler ["GroupCreated", { params ["_group"]; _group deleteGroupWhenEmpty false; }]; addMissionEventHandler ["entityKilled",{ params ["_unit"]; private _grp = group _unit; private _side = side _grp; private _type = getText (configOf _unit / "displayName"); if (isNil {_grp getVariable "dataKilled"}) then { _grp setVariable ["dataKilled",[[_side,_type,0]]]; } else { if !([_side,_type] in ((_grp getVariable "dataKilled") apply {[_x#0,_x#1]})) then { (_grp getVariable "dataKilled") pushBack [_side,_type,0]; }; }; private _idx = (((_grp getVariable "dataKilled") apply {[_x#0,_x#1]}) find [_side,_type]); private _cnt = (_grp getVariable "dataKilled") #_idx#2; (_grp getVariable "dataKilled") set [_idx, [_side,_type,_cnt +1]]; }]; [] spawn { while {true} do { waitUntil {sleep 1; triggerActivated trig1}; private _txtWEST = "DEAD HELLENIC UNITS "; { _grp = _x; { _x params ["_side","_type","_cnt"]; call { if (_side isEqualTo WEST) exitWith { if !(str _grp in str _txtWEST) then { _txtWEST = composeText [_txtWEST,lineBreak,str _grp] }; _txtWEST = composeText [_txtWEST,' ' +_type + ' ' + str _cnt]; }; }; } forEach (_grp getVariable "dataKilled"); } forEach (allGroups select {!isNil {_x getVariable "dataKilled"}}); if (_txtWEST isEqualTo "DEAD HELLENIC UNITS ") then {_txtWEST = "DEAD HELLENIC UNITS: 0 casualty"}; hint composeText [_txtWEST]; waitUntil {sleep 1; !triggerActivated trig1}; }; }; [] spawn { while {true} do { waitUntil {sleep 1; triggerActivated trig2}; private _txtEAST = "DEAD TURKISH UNITS "; { _grp = _x; { _x params ["_side","_type","_cnt"]; call { if (_side isEqualTo EAST) exitWith { if !(str _grp in str _txtEAST) then { _txtEAST = composeText [_txtEAST,lineBreak,str _grp] }; _txtEAST = composeText [_txtEAST,' ' +_type + ' ' + str _cnt]; }; }; } forEach (_grp getVariable "dataKilled"); } forEach (allGroups select {!isNil {_x getVariable "dataKilled"}}); if (_txtEAST isEqualTo "DEAD TURKISH UNITS ") then {_txtEAST = "DEAD TURKISH UNITS: 0 casualty"}; hint composeText [_txtEAST]; waitUntil {sleep 1; !triggerActivated trig2}; }; }; [] spawn { while {true} do { waitUntil {sleep 1; triggerActivated trig3}; private _txtINDEP = "DEAD MAIDEN UNITS "; { _grp = _x; { _x params ["_side","_type","_cnt"]; call { if (_side isEqualTo INDEPENDENT) exitWith { if !(str _grp in str _txtINDEP) then { _txtINDEP = composeText [_txtINDEP,lineBreak,str _grp] }; _txtINDEP = composeText [_txtINDEP,' ' +_type + ' ' + str _cnt]; }; }; } forEach (_grp getVariable "dataKilled"); } forEach (allGroups select {!isNil {_x getVariable "dataKilled"}}); if (_txtINDEP isEqualTo "DEAD MAIDEN UNITS ") then {_txtINDEP = "DEAD MAIDEN UNITS: 0 casualty"}; hint composeText [_txtINDEP]; waitUntil {sleep 1; !triggerActivated trig3}; }; }; Share this post Link to post Share on other sites
viel.kuul.10 0 Posted December 13, 2022 I just tested. Does not work. Share this post Link to post Share on other sites