OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: marcinko on 09 Feb 2004, 22:01:18

Title: getting a group to join another group
Post by: marcinko on 09 Feb 2004, 22:01:18
I have a mission where i have a group of civilians being transported as prisoners.  I want the civilians to join my group when i kill all the guards involved in their transport to the prison camp.  Is there a way to do this with a trigger or should it be scripted?  The transport guards aren't the only enemy in the area.
Title: Re:getting a group to join another group
Post by: dmakatra on 09 Feb 2004, 22:05:27
type this in one of the civvies init field:

group this = mygrp

and in the players group do the same but replace mygrp with playergrp

then in the triggers on act field:

"[_x] join playergrp" foreach units mygrp

or something like that, syntax not guaranteed.

:beat: *Gets SHot* :beat:
Title: Re:getting a group to join another group
Post by: macguba on 09 Feb 2004, 23:17:28
Armsty's on the right lines.    You need to put it other way round when you define something

prisonerGroup = group this

The activation field is right so the only remaining bit is the condition line of the trigger.    You could have something like this:-

(leader prisonerGroup distance player < 5) and ("alive _x" count guardGrp1 == 0) and ("alive _x" count guardGrp2 == 0)


Syntax not guaranteed.  Of course you may want slightly different conditions.   If there is only one guard group it's easier - group the guard group to the trigger and you will get new options in the Activation box.    Play with those - you might end up with

this and (leader prisonerGroup distance player < 5)



Now we come to the important bit of your question.

Quote
Is there a way to do this with a trigger or should it be scripted?

If you want to detect something happening during a mission, the best way is usually a trigger.  That is what triggers are for.    

Sometimes, the consequence of a trigger (the activision as LCD calls it) is controlled by a line of code, in which case it goes in the On activation field.    If the code is too long to go there conveniently, it may be easier to get the trigger to call a script file and write all the consequences in there instead.

In other words, a lot of the time a script file is just a way of making the on activation box of a trigger a bit bigger and easier to use.

There are of course exceptions to that and there are things that can be done with scripts that can't be done with triggers and waypoints.    But triggers and waypoints, perhaps with a couple of lines of code in them, should always be your starting point.   Many official BIS missions have no scripts at all.    




Title: Re:getting a group to join another group
Post by: marcinko on 14 Feb 2004, 06:38:31
I tried the condition line (leader prisonergroup distance player <5) and ("alive_x" count guardgroup == 0) and i received a message when i run the mission "error count: type object, expected array".

Just wondering what's wrong with the syntax?
Title: Re:getting a group to join another group
Post by: DrStrangelove on 14 Feb 2004, 11:12:40
Add 'units' to it like this:

... count units guardgroup...