You're contending with Arma 2 AI here, which is usually not easy to strangle into doing "pre-scripted" things like these, but you can at least create a simulacrum of the desired events (and fudge the rest with radio comms and the like). But I really like the concept! I suggest you keep it fairly light scripting-wise, which means there will be a lot of unplanned things happening. The hardest will be, I think, to blow up the truck in "just the right way".
- Mines only apply to armored vehicles, not trucks, so you need to figure out another way. I suggest a simple trigger that spawns a an explosion under ground, coupled with a setdamage on the driver to make sure the truck isn't going to keep moving (this would be the most 'scripted' event in the mission). After that, the enemies would be given the green light to open up, and the people in the truck would be 'revealed' to them; that way it's more likely they'll target them. So:
First, the set-up: create a truck, name it e.g. truck1. Create a group of Independent-sided "foresters" etc (make sure they're hostile to OPFOR), and remove all their weapons. Name their group something, e.g. civgrp1 (civgrp1 = group this). Create any number of additional civilians and group them with the independent group - they'll be targeted all the same as long as there's an 'enemy' as the group leader. Now, create your ambushing group and name it something like e_grp1. Put it in position, and make sure they've got a clear line of fire to the road etc. Give them one waypoint, where the combat mode is set to "Hold Fire". This will make sure they don't open up too early.
Next, create a trigger, grouped to the civilian truck, Activated by: "Vehicle present" (this will make sure that even if the stupid AI manages to drive off-road, it'll still be hit), and place it on the ambush spot. Condition: this, On Activation:
nul= "Sh_120_HE" createvehicle (truck1 modeltoworld [0, 10, -2]); driver truck1 setdamage 1; {leader e_grp1 reveal _x} foreach units civgrp1; e_grp1 setcombatMode "YELLOW"
This will create a shell more or less in front/underneath the truck, which will hopefully (in my testing) disable it and let the civilians get out before blowing it up. You can try with different ammo classes and different model-to-world data to make it look just perfect. The driver of the truck is killed via script to make sure the truck doesn't go anywhere (make him a separate group). Then, as you can see, the civilians are all "revealed" to the enemy group leader and their combat mode is set to "fire at will". To make the slaughter even more complete, just give the civilians in the truck a single waypoint (from the start) which has them run into the enemy ambush location "in the confusion" and get themselves killed.
This is stage one. Stage two is getting the enemy insurgents to retreat back to the village. When do you want this to happen? This is what you put into the enemy group's first waypoint in the Condition field. Give them a second waypoint into the village where the combat mode is set to "Hold Fire", the Speed to Full and the Behaviour to Aware. This will HOPEFULLY make them retreat, but nothing is certain! Still, you can simply add a radio comment in the On Activation field of their first waypoint that says something like "the insurgents are falling back to the village! Pursue them!", even if this is not what's really happening
Anyway, as to this second condition: waiting for all the civilians to be dead is not safe, since the civs might decide to run in the opposite direction, take cover successfully or hide behind some terrain feature and so on. It might work once, but the next play-through it'll all be fudged. We want the retreat to happen after a first couple of moments of frantic shooting and burning trucks and chaos, so that the player as a minimum of time to react. The simplest way might be a timeout!
On the Insurgent's first waypoint, add the condition:
!alive truckdriver1
This is the trigger for the attack, and we know the truck driver will be dead since he's scripted to die (you should name the truckdriver of course). Now, above the condition field are three fields for "Timeout". These are the max, min and median times (in seconds) until the trigger activates -after- the condition has been fulfilled. So add something like max 60, min 30, med 45 into these, and the waypoint will be fulfilled and the enemy group move towards its next objective once the truck driver is dead & x amounts of seconds have passed (if they're all the same, then there's no random element of course).
In the On Activation field of the trigger, you can also fudge some smoke grenades and such, for instance:
nul = "SmokeGrenade" createvehicle getpos this
"this" when written inside the On Activation field of a waypoint always refers to the one the waypoint belongs to - in this case the Insurgent leader (whoever he is). Of course there's no telling where he'll be at the time of the retreat, so the shell might land at a stupid place, but there's little you can do unless you're going to add a veeery complicated algorithm for figuring out where the insurgents are in relation to the marines and then pop shells in the intervening space. It's just eye candy anyway. You can add more smokes by doing stuff like:
nul = "SmokeGrenade" createvehicle (getpos (units group this select 1));
Which will pop a smoke at the feet of "number one" of the group as well, whoever that will be. Using named soldiers here is not very good, since they might have been killed in the intervening time.
As to making them ignore the marines and focus on the civilians: not much you can do there I'm afraid unless you want to completely skew everything (e.g. make the marines setCaptive or something) - why wouldn't the insurgents focus their fire on the most dangerous thing on the battlefield if they're getting shot up? Anyway, most of the civilians will probably be cut down and killed during the first couple of seconds anyway, so it should be good. You -can- of course use things like doTarget to try to make sure the civilians are targeted first, but I think the general confusion, explosion, shooting etc. should be enough in this situation.
Having tested this, I'd also like to suggest you remove any RPG-soldiers from the ambushing insurgents, since they might just blow up the truck the moment they're given the all-clear, not giving the civilians enough time to get out. Also, the shell I used (M1A1 HE shell) is pretty powerful, but currently explodes underground which makes it a bit less deadly - you might want to experiment with different types, but keep in mind that missiles will fly off if spawned in the air!
Anyway, it's a complicated situation to pull off, but I think you can do it - but please don't expect the scripted sequence to be the same every time, or even 50% of the time
That's Arma 2 for you, I'm afraid!
Do tell me if there's something that doesn't work out for you. Added to the post is my test mission, which works - more or less
You can load it up in the editor and check it out (no marines in that mission, and in a randomly placed location).
Good luck!
Wolfrug out.