Home   Help Search Login Register  

Author Topic: All living units in a zone  (Read 1204 times)

0 Members and 2 Guests are viewing this topic.

Offline Vortrog

  • Members
  • *
  • Ski'in, Fish'in, Shoot'in, OFP'in
    • Vortrog's Lair
All living units in a zone
« on: 21 Oct 2002, 07:48:27 »
Ive really got myself tied up in trying to write a condition to detect when every living unit is within a defined radius. Its for a MP mission where players might shoot off all over the place even though they are in one group.
I have one friendly group that reaches a safe zone. Once all living guys make it, the trigger goes off. there are 9 in the group, called Romeoleader.
The distance command does not allow to use of a group as an operator, and I dont want just the leader of the group to set of the trigger...it has to be ALL LIVING UNITS IN THE GROUP.
I was trying something like
[RomeoLeader] Exec "win.sqs" for each units group _grp
Where "win.sqs"
?(_grp distance Home <25) && (alive _grp): goto win

Does that sound right? or will that let me win if the leader is alive and makes it to the safe zone?

Vortrog

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:All living units in a zone
« Reply #1 on: 21 Oct 2002, 10:31:00 »
Hey Vortrog,

Try grouping your trigger with your group leader (Hit F2 and drag a line across). Now from the drop down condition menu you will be able to select "Whole Group Present".

Now your trigger should only activate if the whole group is within it's radius ;)

Offline Vortrog

  • Members
  • *
  • Ski'in, Fish'in, Shoot'in, OFP'in
    • Vortrog's Lair
Re:All living units in a zone
« Reply #2 on: 21 Oct 2002, 23:58:31 »
Yes, that will do the job...if I was lazy and was only ever going to play the mission over a LAN.
I wanted the trigger I have in the zone to be a Resistance Present trigger that activated a script to check a number of things:
1. How many vehicles were captured by the resistance (these are linked to hidden objectives..hence the reason for a script.)
2. If all living members made it out.

Ive written the subroutines for the objective checks, but the crucil line for checking if all units are in the "zone" eludes me.

I could do this by 2 triggers, but this mission has heaps of units,triggers and waypoints already, and the less triggers I have reduces the lag and processor burden. And scripts with timed delays also help. Hence why I have chosen the difficult path. :)

So, you can say...well, your choice work it out. But Id rather some of the guru's out there lend me some advice, because, yes, I need it   ;)

Vortrog

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:All living units in a zone
« Reply #3 on: 22 Oct 2002, 00:20:06 »
Ok then.

I'd suggest getting all the units in the trigger:

Init.sqs or someone's init line

Numintrig = 0

Trigger

Radius: as Required
Condition: Resistance present (repeatedly)
Condition field: resistance countside units thislist != Numintrig
OnActivation field: thislist exec "Countem.sqs"; Numintrig = resistance countside units thislist

Countem.sqs... something like this:

list0r = _this

? "_x in list0r" count units group == resistance countside units group: All living units in trigger

? "tank" counttype list0r > 5: Six tanks captured
? "air" counttype list0r > 0: The helicopter has been captured

Anyway, that's how you'd go about checking for your group, and for any specific type of unit

Offline Vortrog

  • Members
  • *
  • Ski'in, Fish'in, Shoot'in, OFP'in
    • Vortrog's Lair
Re:All living units in a zone
« Reply #4 on: 23 Oct 2002, 00:34:48 »
Cheers...thats a great help

Offline Vortrog

  • Members
  • *
  • Ski'in, Fish'in, Shoot'in, OFP'in
    • Vortrog's Lair
Re:All living units in a zone
« Reply #5 on: 23 Oct 2002, 00:35:08 »
Cheers...thats a great help