Jump to content
Sign in to follow this  
xclusiv8

Wait until loaded?

Recommended Posts

Im working on a mission currently. Ive put out a truck with a driver in it and i want the truck to wait so that my soldiers can board it before it moves out to its destination. I dont wanna do this with timers since, yeah if im late the truck is gone. I want it to wait until me and my soldiers are in.

Ive been trying to do this with a trigger. Ive searched everywhere but i dont know if there is a command that tells the truck to wait until soldier1, soldier2 are in its cargo before driving to next waypoint.

Thanks for the help.

Share this post


Link to post
Share on other sites

First give the truck a name, e.g. mytruck. Next give your group a name, e.g. mygroup.

To do this type in the init line of the groupleader:

mygroup=group this

Next, a trigger which is activated by the truck only. To do this place a trigger with the necessary dimensions and group it (F2) with the truck.

In the onActivation line of that trigger type:

driver mytruck disableAI "MOVE"

Next, another trigger. Dimensions can be set to 0.

In the condition line type:

({_x in mytruck} count units mygroup) == (count units mygroup)

In the onActivation line type:

driver mytruck enableAI "MOVE"

What then happens is this:

As soon as the truck enters the first trigger his ability to move is removed.

The second trigger gets activated once your whole group is in the truck. Once that's the case the truck driver gets his move ability back and continues with his movement.

Share this post


Link to post
Share on other sites
First give the truck a name, e.g. mytruck. Next give your group a name, e.g. mygroup.

To do this type in the init line of the groupleader:

mygroup=group this

Next, a trigger which is activated by the truck only. To do this place a trigger with the necessary dimensions and group it (F2) with the truck.

In the onActivation line of that trigger type:

driver mytruck disableAI "MOVE"

Next, another trigger. Dimensions can be set to 0.

In the condition line type:

({_x in mytruck} count units mygroup) == (count units mygroup)

In the onActivation line type:

driver mytruck enableAI "MOVE"

What then happens is this:

As soon as the truck enters the first trigger his ability to move is removed.

The second trigger gets activated once your whole group is in the truck. Once that's the case the truck driver gets his move ability back and continues with his movement.

Thank you so much W0lle. It works perfectly.

One more question. I put an empty civilian chopper on the map. Well first i used the one with the pilot but i took it away cause i couldnt figure out how to make the enemy attack it so i put an empty chopper and made a Bluefor pilot fly it. Will the enemy of the bluefor now see the chopper as a target? So far the insurgents havent attacked it with its AA soldiers.

Share this post


Link to post
Share on other sites

Theoretically yes, atleast it was like that since I can remember.

But the AI AA Soldiers are a bit slow sometimes, I noticed that in my Lojack mission. In the end I replaced the Soldiers with an IGLA Pod which immediately shot the chopper.

If all fails put back the Civilian helicopter, give it a name and then edit the mission.sqm in a textexditor. Search for the name and change the "CIV" lines with "WEST". Save the mission and load it in the editor again. The only thing you need to remember doing this is:

1) BACKUP

2) You can't edit the chopper anymore in the editor or it changes to US unit.

Share this post


Link to post
Share on other sites

I tried W0lle's approach but when I try to add

({_x in us_boat_crrc} count units _sniperTeam) == (count units _sniperTeam)
to the trigger, it tells me that _sniperTeam is a local variable in global area. I registered _sniperTeam within the team leader's init. How can I make it global or make it work otherwise?

Share this post


Link to post
Share on other sites

Wolle's solution is interesting but much too complex. A load waypoint for the truck, a board waypoint for the infantry group, and a synchronization (F5) between both waypoints. That's all.

Share this post


Link to post
Share on other sites
Thank you. Didn't expect that naming had an effect on the visibility. :)

Usually naming won't matter too much, but this is a special case of a variable with a _ in front is a "local" variable and can only be accessed within a limited scope (usually the script it's part of). It can't be used in global only areas, like a trigger condition field.

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  

×