Jump to content

Recommended Posts

After trying for weeks with my scripting and googling everything to find some answers, I am still without success. The script should be small and simple, I knew scripting isn’t easy but I can’t believe this hurts so much. I'm trying to make a script that will count all the dead units and destroyed vehicles of one side and put it in the trigger and activate it via radio.

 

_count = {side _x == resistance} count allunits;  
hintSilent format ["Alive AAF Units: %1", _count];  // Count all alive units of Resistance side, it works fine.

 

0 = [] spawn {while {true} do {sleep 0.1;} 
_aafScore = {getNumber (configfile >> "CfgVehicles" >> typeOf _x >> "side") == 2} count allDeadMen; 
hintSilent format ["Dead AAF Units: %1", _aafScore]}; // Count all dead units but it works not fine.

Share this post


Link to post
Share on other sites

Your syntax was a bit broken (misplaced/missing curly brackets) and there was a corrupt character due to copy/paste. This seems to work fine:

0 = [] spawn {
	while {true} do 
	{
		sleep 0.1; 
		_aafScore = {getNumber (configfile >> "CfgVehicles" >> typeOf _x >> "side") == 2} count allDeadMen; 
		hintSilent format ["Dead AAF Units: %1", _aafScore];
	};
};
  • Like 2

Share this post


Link to post
Share on other sites

Does not work. It shows the result nicely but when I activate another radio, it doesn't work anymore. I have four triggers.

Share this post


Link to post
Share on other sites
Just now, viel.kuul.10 said:

Does not work.

 

It does indeed work. In fact, 

1 minute ago, viel.kuul.10 said:

It shows the result nicely

 

This, however:

Just now, viel.kuul.10 said:

but when I activate another radio, it doesn't work anymore. I have four triggers.

 

is new information.

 

So perhaps you should explain exactly how you want this to go.

  • Like 3

Share this post


Link to post
Share on other sites
22 hours ago, Harzach said:

 

It does indeed work. In fact, 

 

This, however:

 

is new information.

 

So perhaps you should explain exactly how you want this to go.

 

All I want to know is simple, I would like to see the results of dead soldiers and destroyed vehicles after a battle but which I would activate myself, i.e. to see statistics whenever I want. I would also like to see the current number of living soldiers and vehicles.

I have four triggers, every via radio (Alpha, Bravo, Charlie, Delta). 

 

First trigger:

_count = {side _x == east} count allunits;  
hintSilent format ["Alive CSAT Units: %1", _count];

 

Second trigger:

0 = [] spawn { while {true} do { sleep 0.1; _csatScore = {getNumber (configfile >> "CfgVehicles" >> typeOf _x >> "side") == 0} count allDeadMen; hintSilent format ["Dead CSAT Units: %1", _csatScore]; }; };

 

Third trigger:

_count = {side _x == resistance} count allunits;  
hintSilent format ["Alive AAF Units: %1", _count];

 

Fourth trigger:

0 = [] spawn { while {true} do { sleep 0.1; _aafScore = {getNumber (configfile >> "CfgVehicles" >> typeOf _x >> "side") == 2} count allDeadMen; hintSilent format ["Dead AAF Units: %1", _aafScore]; }; };

 

 

20 hours ago, mr_centipede said:

Are you perhaps trying to do something like this?

Custom Debriefing Page

 

That's something I'm actually looking for. Men, vehicles, vessels, aircraft, on every side. I'm currently testing this your, I'm playing with mod Arma Commander, the trigger is synced with the main module of the mod. But after the mission, this briefing is not shown.

Share this post


Link to post
Share on other sites
9 hours ago, viel.kuul.10 said:

Why I have no answers?

This is because we are basically fat and lazy and only get moving when we really feel like it.


Just try to be patient, someone will answer eventually.

Share this post


Link to post
Share on other sites

This is your answer:

just delete those while do loops. its not needed in your case and it should be the issue for your 2nd radio trigger not working!

Share this post


Link to post
Share on other sites
On 6/17/2022 at 9:33 AM, sarogahtyp said:

This is your answer:

just delete those while do loops. its not needed in your case and it should be the issue for your 2nd radio trigger not working!

 

It works. Thanks!

Share this post


Link to post
Share on other sites

I realize this is an old thread, but If you have a custom garbage collector going. Possibly any garbage collector and already have a lot of killed EH that may delete units quick.  Try this. 

_allDead = allDead;
_allwestD = 0;
_alleastD = 0;
_allIndyD = 0;
_time = time + 7;
while {true} do {	
	sleep 1;
	if (!(_allDead isEqualTo allDead) || (_time <= time)) then {
		 {
		 	private _dead = _x;
		 	if !(_dead in _allDead) then {
		 		_allDead pushBack _dead;
		 		switch (getNumber (configfile >> "CfgVehicles" >> (typeOf _dead) >> "side")) do
				{
					case 0: { _alleastD = _alleastD + 1 };
					case 1: { _allwestD = _allwestD + 1 };
					case 2: { _allIndyD = _allIndyD + 1 };
					//default { };
				};
		 	}

	    } forEach allDead;
	    _allDead = allDead;
	    // Post the results
	    hint format ["BluFor casaulties: %1\n OpFor casaulties: %2\nIndFor casaulties: %3",_allwestD,_alleastD,_allIndyD];
		_time = time + 7;
	};


};

Ooops had a few thread open looking at this. I dont think it was meant for this thread. Probably this one 

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×