Jump to content
Sign in to follow this  
Khankore

Tracking Multiple Unit Status - How to?

Recommended Posts

Precursor - I've searched using the above title, and many variations, but have not found an answer for this problem.

I've created a simple mission with 6 OPFOR air craft and 2 BLUEFOR air craft. BLUEFOR is the playable side - Coop, Multiplayer.

I'm attempting to activate my trigger for the first task in my briefing. The first task is to eliminate all opposing aircraft. (OPFOR) I've tried using several different methods, such as:

1.

!alive enemy1 and !alive enemy2 and !alive enemy3... This gives me an error stating -expecting boolen - and if I put everything in brackets, it says ' missing )' , even though I've formated it correctly.

2.

OPFOR - PRESENT (check entire map)

Condition: thislist <=0

- the problem I'm having is that when an enemy plane is shot down, sometimes the enemy pilot will bail out, and is therefor alive...

Other then making 6 triggers, each incrimenting a variable by 1, then triggering the task completion when that value reaches 6, I'm finding no easy way to do it.

Any help?

Share this post


Link to post
Share on other sites

for air vehicles its wise to use the canMove command, wich means if vehicle can move, needs to be alive, repaired, with fuel etc.

(!canMove vehicle1 AND !canMove vehicle2 AND !canMove vehicle3)

above will trigger when vehicle 1, 2, 3 can NOT move, meaning if they crash or gets blown up, if they go down and have no fuel, if they get damaged and goes down.

use a time delay if you dont want it to trigger while last vehicle is in air on its way down.

Share this post


Link to post
Share on other sites

Now I'm trying to wrap my head around Arrays. Here's the scenario - 3 groups of enemy AI planes, each group containing 4 planes. I'm trying to find the easiest way to set a trigger for when all planes have been shot down.

So far I've tried this...but have no idea what I'm doing as it's errored out.

_planedead = [plane1, plane2, plane3, plane4, etc];

!alive count _planedead <1;

Sorry to bug you guys with trivial stuff, but I'm a learn by making errors kinda guy. Thanks for any help.

Khan

Share this post


Link to post
Share on other sites

_planedead = [plane1, plane2, plane3, plane4, etc];

if ( ({!canMove _x} count _planedead) == 0 ) then {hint "all down or going down"};

this will activate when the amount of vehicles in array can NOT move, meaning shot down.

Share this post


Link to post
Share on other sites

({!canMove _x} count _planedead) == 0

Isnt it the other way around, without the exclamation mark? Once 0 planes canmove, they all must be going down?

({canMove _x} count _planedead) == 0

Share this post


Link to post
Share on other sites

Thanks to both of you for contributing. It's they syntax and order of elements that's holding me back. I get the concept, but not knowing where the { or [ or even ( apply, is driving me batty. Reading the wiki only makes it worse for me hehe.

Thankfully there are helpful people in this community.

Oddly Enough - This example results in an error [Local Variable in a Global Space] ???

Any Clues?

:bounce3:

---------- Post added at 23:36 ---------- Previous post was at 23:28 ----------

_planedead = [plane1, plane2, plane3, plane4, etc];

if ( ({!canMove _x} count _planedead) == 0 ) then {hint "all down or going down"};

Oh, something caught my eye - what is the purpose of the _x in the above statement? Is it just a place holder variable?

Edited by Khankore

Share this post


Link to post
Share on other sites
It's they syntax and order of elements that's holding me back. I get the concept, but not knowing where the { or [ or even ( apply, is driving me batty. Reading the wiki only makes it worse for me hehe.

this guide will guaranteed give you alot more insight into when to use what how.

Oddly Enough - This example results in an error [Local Variable in a Global Space] ???

Any Clues?

outside a script you cannot use local variables, meaning NO underscore infront of any name.

_local - can only be used inside script.

global - can be used anywhere.

_planedead has underscore, so therefore its local and cannot be used outside a script.

planedead has NO underscore and will work anywhere.

Oh, something caught my eye - what is the purpose of the _x in the above statement? Is it just a place holder variable?

yes, its a placeholder used together with count and foreach commands, maybe some more but i cant think of any, its a magic variable, and you cannot replace it with _o or _w you need to use _x.

Also _x is not considered a local variable just incase that was confusing.

Example, works in a trigger, object init or anywhere.

{_x setDammage 1} foreach [unit1,unit2,unit3];

imagine this is what happens with the above foreach command:

unit1 setDammage 1; unit2 setDammage 1, unit3 setDammage 1;

As you can maybe see, this command has much potential power.

Edited by Demonized

Share this post


Link to post
Share on other sites

Thanks much Demon - I'll brush up on the posting and you've been a tremendous help. Last time I programmed was on a TRS80 back in Highschool - (1980) so I'm a bit rusty :)

Khan

Share this post


Link to post
Share on other sites

Don't worry we all started slowly. But it's the most basic things at the start that are making the difference between an independant scripter and somebody just trying to patch code snippets of other ppl together later on.

If you have problems with syntax i really really recommend taking a step back and look things up. It will free your mind. :)

http://www.ofpec.com/COMREF/index.php?action=read&id=70

http://www.armaholic.com/page.php?id=838

http://www.assaultmissionstudio.de/downloads.php?page_id=300

Edited by ])rStrangelove

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
Sign in to follow this  

×