This script makes a group take cover behind the nearest bush/tree/rock/object. The script uses a 'nearestCover' function I wrote based on the work of Komuna and Spinor. You can choose one of the following conditions that the group will take cover under:
1) Take cover immediately when the script is called. Basically for "manual" use by mission designers.
2) Take cover if the group is attacked but doesn't know where the enemy is, or if they see the enemy but he is too far away to engage (I'm saying beyond 500 meters is too far, but it could be changed)
3) Always take cover if the group is attacked or spots the enemy
Sounds great right? Well... there's a little problem. On my computer, the damn thing crashes! But my comp has crashed before on some OFP things that don't crash other's computers, so I'm hoping you guys can try it out and see if it works for you. But let me be more specific:
On my computer, I can run the script just fine if there are no enemies around. I'll run the script using the first method, and the squad will all run and take cover perfectly, just like they are supposed to. However, when I try running the script (using any of the methods) with an enemy shooting at the group, suddenly I crash 100% of the time. It seems to always crash right as someone dies or gets hit by a bullet, so I suspect that has something to do with it.
Here is what I'd like from you guys:
Open up the demo mission. In it, there is a friendly AI squad, a radio trigger, and one enemy next to another trigger. The radio trigger will execute the script using the 1st method above. The other trigger will execute the script using the 3rd method right at the start of the mission.
Delete the enemy and the trigger next to it. Now run the mission, and use your radio to execute the script. The squad should run to the bushes and lay down. Yay, ok the script works in theory. Now, exit and reload the mission. This time, run it with the enemy there. Now the enemy should start firing on the squad, which should then try to take cover. This is the part that crashes on my computer. Usually it will crash right when like the 2nd or 3rd guy is killed (right when the script starts telling people to take cover).
If your computer doesn't crash, then horray! It means this script can be used by someone. If your computers all crash, then I guess its back to the drawing board....