Home   Help Search Login Register  

Author Topic: Add several units to a list  (Read 993 times)

0 Members and 1 Guest are viewing this topic.

ollestolpe

  • Guest
Add several units to a list
« on: 15 Jul 2005, 17:10:25 »
I want to make an Objective where you take out a convoy.
When the convoy is taken out objStatus of objective "1" will be set to "DONE".

I want to add the bunch of units to a list and do this in a trigger.

Condition: ? not alive LISTOFUNITS
On Activation: "1" ObjStatus "DONE"


Also it would be great if I could make it so that the objective is failed when any part of the convoy reaches the town.

How do I do this. I'd be SO happy if you could help me out.

ProudPotter2490

  • Guest
Re:Add several units to a list
« Reply #1 on: 15 Jul 2005, 17:24:46 »
Simple really this is. Type in the convoy leaders unit field: myConvoy = group this;. Then, in the objective trigger (if the convoy is dead) type: (count units myConvoy == 0). Put in the 'On Activation' field: ""1" objStatus "DONE";";

If the convoy reaches the town. Give individual names to the convoys trucks and type in the condition field of another trigger: "convoyMan1 in thisList OR convoyMan2 in thisList OR convoyMan3 in thisList;" etc... Follow this up with ""1" objStatus "FAILED";"

Essentially, you'll basically have two triggers with the following 'On Activation' field and 'Condition' field:-
If Convoy Dead:-
Condition: (count units myConvoy == 0)
On Activation: this exec "endScriptWin.sqs";

If Convoy Reaches Town:-
Condition: convoyMan1 in thisList OR convoyMan2 in thisList OR convoyMan3 in thisList
On Activation: this exec "endScriptLose.sqs";

Good luck ;D!
« Last Edit: 15 Jul 2005, 17:30:43 by ProudPotter2490 »

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Add several units to a list
« Reply #2 on: 15 Jul 2005, 17:28:43 »
It might be a bit more complicated.  What is important to you?  The vehicles being dead or the units in the vehicles being dead?

For vehicles it is better not to use the alive command.  Better is canMove.

If you want to check for the units being dead you will need to use the crew command.
« Last Edit: 15 Jul 2005, 20:04:52 by THobson »

ProudPotter2490

  • Guest
Re:Add several units to a list
« Reply #3 on: 15 Jul 2005, 17:32:44 »
THobson has a point. It may be worth de-PBOing one of the official "Ground Attack" missions to see how BIS did it :).

ollestolpe

  • Guest
Re:Add several units to a list
« Reply #4 on: 15 Jul 2005, 19:33:03 »
Thank you so much.
I will look into it right away.

I have a troop that is moved into an empty truck.
Two manned Ammo Trucks and one Repair Truck is also grouped with the soldiers.
The soldiers and the trucks should be destroyed.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Add several units to a list
« Reply #5 on: 15 Jul 2005, 20:07:20 »
What about if one of the vehicles is not destroyed but has been captured by the player? You probably will need to check the side of the driver.  This is how I check the health of a convoy in my mission:

if ((canmove e_convoy_1) and ((side driver e_convoy_1) == east)) then {goto"conv_alive"}
if ((canmove e_convoy_2) and ((side driver e_convoy_2) == east)) then {goto"conv_alive"}
if ((canmove e_convoy_3) and ((side driver e_convoy_3) == east)) then {goto"conv_alive"}
if ((canmove e_convoy_4) and ((side driver e_convoy_4) == east)) then {goto"conv_alive"}
;Convoy is dead if you get here - but the loons inside may have got out and still be alive so you need to deal with them separately


#conv_alive

 Are you sure you want to kill all the loons?  This might cause the lost loon problem.
« Last Edit: 15 Jul 2005, 20:14:30 by THobson »