Welcome, Guest Wednesday 23rd April 2014, 19:12:08
   Home   Help Search Login Register  

OFPEC Forum

Author Topic: Alive troops check  (Read 455 times)
0 Members and 1 Guest are viewing this topic.
SaS TrooP
*
Offline Offline

n00b always & everywhere


« on: 13 Jul 2010, 23:45:37 »

I make a mission, where you have to hold your line against numerous enemies. And here 2 questions:

1. I can commence retreat, then all units alive from your platoon joins you and are under your command. When each squad join, player should receive SITREP of alive and killed soldiers. How to do this? Notice fact, that all of these troops (nearly) are single (not in teams etc.), and then join player by "joinsilent" command.
I guess I need a label or something like this for each future squad (called A to E) deleting killed members and reporting number of troops in that squad. But how to do this?

2. This is is easy I guess, but I have never used that before: I want to finish mission, when ALL RESISTANCE side will loose 70% of their strength at the very beginning. There was command connected with that, but I am not pretty sure how to make it working.

Can you help me?
Logged
nominesine
Intel Depot
Administrator
*****
Offline Offline


I'm NOT back!


WWW
« Reply #1 on: 14 Jul 2010, 11:31:57 »

1. If you change joinsilent to join you will get a verbal confirmation from each soldier that joins your squad. It's not a Sitrep per se. But serves the same purpose.

2. Look up the count command in the Comref. The trigger should read something like this (ad hoc code):

count units side guer <= X
Logged

OFPEC | Intel Depot
RETARDED Ooops... Retired!
SaS TrooP
*
Offline Offline

n00b always & everywhere


« Reply #2 on: 14 Jul 2010, 22:05:25 »

count units side guer <= X

Error occurs, though count units guer <= X works probably fine. Probably, because for test purpose i tried to check out this command with hint. With "guer" trigger works, but nothing happens if theoretically I killed enough units.
Like:
Cond: count units guer <= 190 (there are 196-198 units from guer on the map)
Activ: hint "works";

Trigger is west activated (west is in the area)/

What is more, when I replace guer with east or west, I get info "type side, needed object". I dont get it.
Logged
nominesine
Intel Depot
Administrator
*****
Offline Offline


I'm NOT back!


WWW
« Reply #3 on: 14 Jul 2010, 22:42:57 »

Sorry if it was confusing. I'm out of testing possibilities right now and my example wasn't meant as a working code snippet. There's a countside command that may solve your problem. Check this.
Logged

OFPEC | Intel Depot
RETARDED Ooops... Retired!
Wolfrug
Addons Depot
Administrator
*****
Offline Offline


Official OFPEC Old Timer


« Reply #4 on: 15 Jul 2010, 08:21:41 »

2: Make a trigger covering the whole playing area, activated by Resistance/Guer. In the Condition field, write:

Code:
{alive _x} count units thisList < 60

(supplanting 60 with whatever number corresponds to "less than 70% left"). Then just add whatever lose code you want in the On Activation field.

1: It's easy enough to make a sitrep of LIVING soldiers, but a lot harder to make one which differentiates between living and dead Smiley I.e., how many casualities. That is, unless each group has exactly as many soldiers - which I doubt. Also, this would obviously not be voiced, unless you get really creative with the voice acting.

Just reporting living (called just before the actual join, so that there is still a 'leader' for the group):
Code:
(leader joinedgrp) sidechat format ["This is %1, joining you now. Our strength is at %2 men.", joinedgrp, {alive _x} count units joinedgrp];
As to reporting casualities, well. What you'd have to do is initially, at the start of the mission, count the number of soldiers in each group. You could either do this with a global array, or by for instance giving each member of the group a vehiclevariable with the information (each member because you never know who's going to die). After that you simply use the above code to count living members, and grab the amount of original members from the array, and hey presto. Here'd be the vehiclevariable one:

(start of mission, in e.g. group leader's init field. Untested):

Code:
{_x setvariable ["SAST_GroupSize", {alive _x} count units (group _x)]} foreach units group this;

(when joining):

Code:
(leader joinedgrp) sidechat format ["This is %1, joining you now. Our strength is at %2 men. We have had %3 casualities.", joinedgrp, {alive _x} count units joinedgrp, (((leader joinedgrp) getVariable "SAST_GroupSize") - ({alive _x} count units joinedgrp))];

Of course, this line doesn't make any sense if the group hasn't had any casualities, which means you'd have to make an extra check for that and so on and so on. It gives a nice feeling to the mission, of course, but it is a lot of extra work too Smiley

Hope these instructions make sense - wish you luck!

Wolfrug out.
Logged

"When 900 years YOU reach, look as good you will not!"
SaS TrooP
*
Offline Offline

n00b always & everywhere


« Reply #5 on: 15 Jul 2010, 18:56:49 »

All saved and it seems I understand most, but there are 2 things:

1. {alive _x} count units thisList < 185 with test "hint "works";"
Game returns arror with such a condition. "Type field, needed Object/Group" [translate from my language, maybe in original version that info looks a bit different].
Trigger set as you said, but error occurs :|

2. This is a little more complicated than it looks with squads that join you. You see, I have platton with 37 people in it, where nearly everyone is a SINGLE group. There is no group one, group two etc.
Troops crouch behind sandbags as long as you will not commence retreat, but they are grouped in fire teams. These fireteams (I repeat again) consist of eg. 4 troops who create 4 SEPARATE groups.

Of course, I can first put all those troops info one group led by NCO, report with casualties and join them into player's platoon.

But what if NCO is dead? In "join" command I have to point unit.
Well, I am not good scripter, but while can't write scripts on my own I can read them. I think, that table counting all units from all squads should do this, but I have no idea how to get it working.

Well, I mean something like:
Code:
alpha = [a1,a2,a3,a4 etc.];
bravo [b1,b2 etc.];
_alpha_count = counts units alpha;
\\ and then eg.
unit sidechat format ["SITREP etc. - %1",_alpha_count];

If I could get that working, troops could be in separate teams and report anyway?
Logged
Wolfrug
Addons Depot
Administrator
*****
Offline Offline


Official OFPEC Old Timer


« Reply #6 on: 15 Jul 2010, 19:21:10 »

thisList automatically returns the units >_> D'oh, my bad:

Code:
{alive _x} count thisList < 185

That should work. Sorry.

As to 2: am I understanding correctly that:

You have 37 units that you've placed around in defensive positions. In addition to that, you have 'imaginary' fireteams, which are the ones that you'd want to "report in" as they join you? So, for instance, fireteam 1 has 3 soldiers left, and you'd like them to say stuff like "This is FT 1, we've had x causalities...3 of us left"? Even though they're not 'really' grouped together according to Arma logic?

Well. Hum. I would suggest doing what you suggested, and just making the 'reporting in' work somehow...not sure how. Anyway:

Code:
_group1= [a1, a2, a3, a4];
_group2= [b1, b2, b3, b4];

_group1alive = {alive _x} count _group1 - (count _group1);
(_group1 select 0) sidechat "bla bla lba";

I'm assuming however that the 37 units are all separate because that's the only way you've found to make them stay behind their sandbags etc? How about instead making the fireteams real groups, but instead using this code in the init field of each:

Code:
this disableAI "MOVE"; this disableAI "TARGET";

That will make them not move from their positions. Just make sure they're set to "None" (not "In Formation") and they will behave just like if they were alone - or actually better, since they will share target data etc. Now you can instead name groups, and use leader to determine who does the reporting in (if no-one is alive in the group, there is no leader, and thus no reporting in).

Yep. Complicated stuff, sometimes, but it can be done.  Good

Wolfrug out.
Logged

"When 900 years YOU reach, look as good you will not!"
SaS TrooP
*
Offline Offline

n00b always & everywhere


« Reply #7 on: 16 Jul 2010, 20:09:24 »

Works fine now.
About {alive _x} count thisList < 185, I also removed units previously, but later accidentally found that vehicles count as 1 enemy, not as eg. 4x crew and I was wodering why condition does not work fine Tongue

Groups also work fine as table, but bug occurs your method:
Code:
_group1alive = {alive _x} count _group1 - (count _group1);

I dont get why you subtract _group1 again, but when I removed:
Code:
_group1alive = {alive _x} count _group1;

Everything works fine ;D

Anyway, thanks to your hints and examples everything works quite fine now, so thank you very much!
Logged
SaS TrooP
*
Offline Offline

n00b always & everywhere


« Reply #8 on: 04 Aug 2010, 21:43:02 »

One more question. I am using this script you put me here quite often, and one thing put me into concern:
If there is infantry mounter on APC/other vehicles, do they count into thislist? Because I think the are not. I just want to make sure of this.
Logged
johnnyboy
OFPEC Patron
****
Offline Offline

Matan los Pantalones!!!


« Reply #9 on: 05 Aug 2010, 02:38:55 »

It counts the vehicle as one unit (it does not count all the units in the vehicle). 

I did this simple test.  Start a new mission in the editor:

Place a Blufor soldier, and a Blufor tank (not empty) on the map.

Place a trigger around them for Blufor Present.

In the On Action field of trigger put this code:

hint format ["unit count=%1", count thislist];

Preview the mission, and the hint says:

unit_count=2

If you want a true unit count you would have to write a script that loops through all units returned by thislist, and checks to see if unit is a a vehicle or not. If vehicle, then you need to count the crew of the vehicle.  Add count for each unit in loop to get a total count.
Logged

El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...
SaS TrooP
*
Offline Offline

n00b always & everywhere


« Reply #10 on: 05 Aug 2010, 17:22:15 »

Yea, while making exactly the same I found that. Just needed confirmation if I am right. Thanks a lot.
Logged
Pages: [1]   Go Up
  Send this topicPrint  
 
Jump to: