Home   Help Search Login Register  

Author Topic: Mine lay - objective completed.  (Read 826 times)

0 Members and 1 Guest are viewing this topic.

Offline nettrucker

  • Members
  • *
  • Too young to die-OFP Campaign by TOY & nettrucker
Mine lay - objective completed.
« on: 28 Dec 2007, 11:12:16 »
Hi everybody.
I hope you passed all a nice Xmas.
I'm struggling with that issue. I searched but I couldn't find any related stuff You are in charge of an engineer team and your task is to place mines in a certain area. After you ordered your 4 men team to place all the mines . . . the objective should tick off as done. What would be the right syntax to check if the men has still mines in his inventory. Do I have to use an eventhandler or what? Thanks for any help in advance.
nettrucker :dunno: :D

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Mine lay - objective completed.
« Reply #1 on: 28 Dec 2007, 15:23:52 »
To find out if no-one has any mines left ("Mine" for west mines, "MineE" for east mines).
Code: [Select]
    ({ "Mine" in (magazines _x) } count (units (group player))) == 0;

You could use this in a trigger condition or in a waitUntil block. One possible issue with this is that if someone dies then they wouldn't be in the group any more and so whether they'd placed a mine or not wouldn't be counted (This checks that all living members of the group are not carrying mines). With this technique, one also has the problem that it makes no distinction between dropped and placed mines. An alternative would be to count the number of mines on the ground with a nearestObjects check, as I think placed mines are "Mine" and mines that are dropped from inventory are seen as "WeaponHolder" or something (can't check that right now, though).
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline nettrucker

  • Members
  • *
  • Too young to die-OFP Campaign by TOY & nettrucker
Re: Mine lay - objective completed.
« Reply #2 on: 28 Dec 2007, 18:26:35 »
Thanks Spooner
that worked perfectly!!! :good:
Regards
nettrucker :D