Author
Topic: Groupchain.sqs (Read 835 times)

This script fixes a behavior issue when one AI group got attacked by the enemy while the other groups in the area keep patrolling in SAFE behavior.When somebody got killed or somebody changes his behaviour all the other groups will change theirs too.

- Activate it with a trigger covering the whole map (WEST - EAST...present) and run it in the onactivation field [thislist] exec "groupchain.sqs". That's easy to do, but...- When somebody spots enemy the leader should shout something like alaaaarm!!! -When somebody got killed, they shout (man down!!! or something like that

...and every group within a certain radius (like 200m) should be alarmed too to simulate they are hearing it.(also doable, that part works already), but...- The script should check if there' aren't any other groups in the area to create a chain of shouts and that's were I'm stuck...

- The script should check if there' aren't any other groups in the area to create a chain of shouts and that's were I'm stuck...

Alright, I ripped this from my hand signals mission, and even did some improvements to it. Later, I'll see about integrating this into your script, but I haven't looked at it yet. Anyway, the code may be a bit hard to understand at first, but logicially it isn't very difficult. Basically, it works in a loop like this:

One person starts the shout by (as if they just "heard" the shout)

LOOP Add the unit that just heard the shout, and everybody in his group, to an array of units _heard Execute code on all the units in the group that just heard the shout Find all units within range of the person who just heard the shout or anyone in his group Add them to an array of units _inRange Loop through the _inRange array until somebody is found who hasn't heard the shout already