Jump to content
Sign in to follow this  
Arctic

Ungroup fleeing soldiers

Recommended Posts

Hello there! I was wondering if it was possible to detach fleeing units from a group (perhaps using an "en masse" command(s)). I have 7 trail patrol groups (at the moment) and do not have each individual soldier named.

What I want to do is have the player ambush one of the groups on the trail (which ever one crosses his team's path when they set up the ambush) and then check until the group is dead. I am using the Group Link II script by Key Cat so they will call in back-ups, but I want some of the trail patrol units to get ansy under an ambush and run away. If those units run away, the player might never run into them again and thus screw up the completion of the objective.

At this very moment, some ideas pop into my head as to what I can do, but I am yet not a very skillful or knowledgable scripter. I think I could use a trigger to create a list of East or Resistance (as the trail patrols are comprised of both sides) and then somehow use that to check for the dead and fleeing. But... I do not know how to do that banghead.gif

Any help would be appreciated!

Share this post


Link to post
Share on other sites

What about that one "spook" script that came along with Dinger's original artillery package. Would that work by any chance?

Share this post


Link to post
Share on other sites

Strange, AI fleeing might be totally broken!

I'm running 1.96

I'd appreciate it if someone could confirm this.

There's an bis unit only everon mission below, that is supposed to teleport any fleeing unit to [0,0,100]. If you start killing them, they run for cover, but they don't actually ever run for their lives!

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">version=11;

class Mission

{

randomSeed=7874563;

class Intel

{

resistanceEast=1.000000;

};

class Groups

{

items=6;

class Item0

{

side="WEST";

class Vehicles

{

items=1;

class Item0

{

position[]={5096.782227,16.334999,4000.965332};

azimut=180.000000;

id=0;

side="WEST";

vehicle="OfficerW";

player="PLAYER COMMANDER";

leader=1;

skill=1.000000;

};

};

};

class Item1

{

side="EAST";

class Vehicles

{

items=12;

class Item0

{

position[]={5005.904297,16.334999,4094.555664};

id=1;

side="EAST";

vehicle="SoldierEB";

leader=1;

rank="COLONEL";

skill=0.200000;

init="battleGroup1 = group this";

};

class Item1

{

position[]={4998.195313,16.334999,4092.453613};

id=2;

side="EAST";

vehicle="SoldierEB";

rank="COLONEL";

skill=0.200000;

};

class Item2

{

position[]={5013.611328,16.334999,4091.053223};

id=8;

side="EAST";

vehicle="SoldierEB";

rank="COLONEL";

skill=0.200000;

};

class Item3

{

position[]={5020.852539,16.334999,4086.147949};

id=9;

side="EAST";

vehicle="SoldierEB";

rank="COLONEL";

skill=0.200000;

};

class Item4

{

position[]={4994.458984,16.334999,4090.118652};

id=3;

side="EAST";

vehicle="SoldierEB";

rank="COLONEL";

skill=0.200000;

};

class Item5

{

position[]={4990.488281,16.334999,4086.381348};

id=4;

side="EAST";

vehicle="SoldierEB";

rank="COLONEL";

skill=0.200000;

};

class Item6

{

position[]={5025.783691,16.334999,4082.384277};

id=10;

side="EAST";

vehicle="SoldierEB";

rank="COLONEL";

skill=0.200000;

};

class Item7

{

position[]={5032.063477,16.334999,4077.037598};

id=11;

side="EAST";

vehicle="SoldierEB";

rank="COLONEL";

skill=0.200000;

};

class Item8

{

position[]={4985.583008,16.334999,4082.177246};

id=5;

side="EAST";

vehicle="SoldierEB";

rank="COLONEL";

skill=0.200000;

};

class Item9

{

position[]={4980.677734,16.334999,4077.972656};

id=6;

side="EAST";

vehicle="SoldierEB";

rank="COLONEL";

skill=0.200000;

};

class Item10

{

position[]={5036.735352,16.334999,4072.600586};

id=12;

side="EAST";

vehicle="SoldierEB";

rank="COLONEL";

skill=0.200000;

};

class Item11

{

position[]={4975.539063,16.334999,4073.768555};

id=7;

side="EAST";

vehicle="SoldierEB";

rank="COLONEL";

skill=0.200000;

};

};

class Waypoints

{

items=2;

class Item0

{

position[]={5135.952637,16.334999,4092.112305};

combatMode="YELLOW";

formation="WEDGE";

speed="NORMAL";

combat="AWARE";

class Effects

{

};

showWP="NEVER";

};

class Item1

{

position[]={5008.845215,16.334999,4096.538086};

type="CYCLE";

class Effects

{

};

showWP="NEVER";

};

};

};

class Item2

{

side="EAST";

class Vehicles

{

items=1;

class Item0

{

position[]={4150.641113,94.413460,4217.250977};

azimut=270.000000;

id=13;

side="EAST";

vehicle="SoldierEB";

leader=1;

rank="COLONEL";

skill=0.200000;

init="fleeToGroup1 = group this";

};

};

class Waypoints

{

items=1;

class Item0

{

position[]={4142.677734,96.433388,4217.335938};

combatMode="YELLOW";

formation="COLUMN";

speed="FULL";

combat="AWARE";

class Effects

{

};

showWP="NEVER";

};

};

};

class Item3

{

side="EAST";

class Vehicles

{

items=1;

class Item0

{

position[]={4150.460449,95.449776,4203.604004};

azimut=270.000000;

id=14;

side="EAST";

vehicle="SoldierEB";

leader=1;

rank="COLONEL";

skill=0.200000;

init="fleeToGroup2 = group this";

};

};

class Waypoints

{

items=1;

class Item0

{

position[]={4142.787109,97.346100,4203.688965};

combatMode="YELLOW";

formation="COLUMN";

speed="FULL";

combat="AWARE";

class Effects

{

};

showWP="NEVER";

};

};

};

class Item4

{

side="EAST";

class Vehicles

{

items=1;

class Item0

{

position[]={4149.631836,95.491386,4187.682129};

azimut=270.000000;

id=15;

side="EAST";

vehicle="SoldierEB";

leader=1;

rank="COLONEL";

skill=0.200000;

init="fleeToGroup3 = group this";

};

};

class Waypoints

{

items=1;

class Item0

{

position[]={4142.395996,97.300659,4187.705566};

combatMode="YELLOW";

formation="COLUMN";

speed="FULL";

combat="AWARE";

class Effects

{

};

showWP="NEVER";

};

};

};

class Item5

{

side="EAST";

class Vehicles

{

items=1;

class Item0

{

position[]={4149.920898,96.277786,4170.244629};

azimut=270.000000;

id=16;

side="EAST";

vehicle="SoldierEB";

leader=1;

rank="COLONEL";

skill=0.200000;

init="fleeToGroup4 = group this";

};

};

class Waypoints

{

items=1;

class Item0

{

position[]={4142.931152,96.928856,4170.275879};

combatMode="YELLOW";

formation="COLUMN";

speed="FULL";

combat="AWARE";

class Effects

{

};

showWP="NEVER";

};

};

};

};

class Sensors

{

items=3;

class Item0

{

position[]={5001.822266,16.334999,4062.594238};

a=250.000000;

b=250.000000;

activationBy="EAST";

age="UNKNOWN";

text="initBattleUnitList";

name="initBattleUnitList";

expActiv="""removeAllWeapons _x; _x addWeapon """"ak74""""; _x allowFleeing 1"" forEach (list initBattleUnitList);";

class Effects

{

};

};

class Item1

{

position[]={4201.918945,87.505760,4174.938965};

a=250.000000;

b=250.000000;

activationBy="EAST";

age="UNKNOWN";

text="initFleeToUnitList";

name="initFleeToUnitList";

expActiv="""removeAllWeapons _x; _x addWeapon """"ak74""""; _x allowFleeing 0"" forEach (list initFleeToUnitList);";

class Effects

{

};

};

class Item2

{

position[]={5074.639648,16.334999,4085.990967};

a=500.000000;

b=500.000000;

activationBy="EAST";

repeating=1;

age="UNKNOWN";

text="handleFleeingList";

name="handleFleeingList";

expActiv="""if (fleeing _X) then {_x setPos [0,0,100]}"" forEach (list handleFleeingList)";

class Effects

{

};

};

};

};

class Intro

{

randomSeed=11453955;

class Intel

{

};

};

class OutroWin

{

randomSeed=13874179;

class Intel

{

};

};

class OutroLoose

{

randomSeed=14005251;

class Intel

{

};

};

Share this post


Link to post
Share on other sites

You could make a simple script that looks like this:

ungroup.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">@fleeing _this

(units _this) join grpnull

exit

Then put this in the init field of each group that might flee:

this exec "ungroup.sqs"

The script will wait until the group is fleeing (entire groups flee, not individuals within a group), then it will make everyone in that group join grpnull (which basically makes a new group and joins them to it). From then on, any old references to the group (say it was called "grp1") will point to the now empty group.

I *think* it will work, but check it of course. smile_o.gif

I assume you have a trigger that checks to see if everyone in a certain group(s) is dead? Or am I not understanding what you are after?

Share this post


Link to post
Share on other sites

After further testing, I have to say that fleeing isn't totally broken, just kinda broken.

My testing revealed something about fleeing. Now, when a unit flees, his combatmode is set to stealth (maybe combat), and he goes back to the group's waypoint 0, which is the group leaders spawn location.

So, on my test missions, they wheren't going anywhere because the group leader's spawn location was in the town

If I remember, in the older versions of the game, they used to run off in a random direction away from he enemy though.

This means that fleeing works fine if the unit is an attacker, but if it's a defender, the unit will stay at the objective.

OFP also seems to dislike doing certain operations to fleeing units unless it's in a script. This is why the teleporting in the sample mission above didn't work.

It will also work fine for surrender scripts, etc.

But if you want a fleeing defender to say, loose pursuers in the jungle, you'll have to assign them to another group.

I'm working on something to fix this right now.

Share this post


Link to post
Share on other sites

Here's a quick sample of what must be done to get fleeing units to act the way they probably should. A small script and a mission (everon)

script, handleFleeing.sqs

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#mainLoop

_unitsInBattleArea = _this select 0

_putInGroup1 = _this select 1

_putInGroup2 = _this select 2

_putInGroup3 = _this select 3

_putInGroup4 = _this select 4

"if (fleeing _x) then {_x setUnitPos ""up""; _x AllowFleeing 0; _x setSpeedMode ""FULL""; [_x] join _putInGroup1; [_x] join _putInGroup2; [_x] join _putInGroup3; [_x] join _putInGroup4; _x doMove (getPos leader _x)}" forEach _unitsInBattleArea

~2

goto "mainLoop"

mission.sqm

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">version=11;

class Mission

{

randomSeed=7874563;

class Intel

{

resistanceEast=1.000000;

};

class Groups

{

items=8;

class Item0

{

side="WEST";

class Vehicles

{

items=1;

class Item0

{

position[]={5096.782227,16.334999,4000.965332};

azimut=180.000000;

id=0;

side="WEST";

vehicle="OfficerW";

player="PLAYER COMMANDER";

leader=1;

skill=1.000000;

};

};

};

class Item1

{

side="EAST";

class Vehicles

{

items=12;

class Item0

{

position[]={5024.818359,16.334999,4076.065918};

azimut=86.677902;

id=1;

side="EAST";

vehicle="SoldierEB";

leader=1;

rank="CORPORAL";

skill=0.200000;

init="battleGroup1 = group this; ""_x allowFleeing 1"" forEach units battleGroup1";

};

class Item1

{

position[]={5022.272949,16.334999,4083.639404};

azimut=86.677872;

id=2;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item2

{

position[]={5021.768066,16.334999,4068.168701};

azimut=86.677872;

id=8;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item3

{

position[]={5017.290527,16.334999,4060.656006};

azimut=86.677872;

id=9;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item4

{

position[]={5019.726074,16.334999,4087.235107};

azimut=86.677872;

id=3;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item5

{

position[]={5015.764648,16.334999,4090.981689};

azimut=86.677872;

id=4;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item6

{

position[]={5013.819336,16.334999,4055.514404};

azimut=86.677872;

id=10;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item7

{

position[]={5008.845215,16.334999,4048.935791};

azimut=86.677872;

id=11;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item8

{

position[]={5011.282715,16.334999,4095.636475};

azimut=86.677872;

id=5;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item9

{

position[]={5006.801270,16.410137,4100.289063};

azimut=86.677872;

id=6;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item10

{

position[]={5004.687012,16.334999,4044.014404};

azimut=86.677872;

id=12;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item11

{

position[]={5002.306641,17.679962,4105.175781};

azimut=86.677902;

id=7;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

};

class Waypoints

{

items=1;

class Item0

{

position[]={5203.231934,17.792757,4075.712402};

combatMode="YELLOW";

formation="WEDGE";

speed="FULL";

combat="AWARE";

class Effects

{

};

showWP="NEVER";

};

};

};

class Item2

{

side="EAST";

class Vehicles

{

items=1;

class Item0

{

position[]={4150.641113,94.413460,4217.250977};

azimut=270.000000;

id=13;

side="EAST";

vehicle="SoldierEB";

leader=1;

rank="CORPORAL";

skill=0.200000;

init="fleeToGroup1 = group this";

};

};

class Waypoints

{

items=1;

class Item0

{

position[]={4142.677734,96.433388,4217.335938};

combatMode="YELLOW";

formation="STAG COLUMN";

speed="FULL";

combat="AWARE";

class Effects

{

};

showWP="NEVER";

};

};

};

class Item3

{

side="EAST";

class Vehicles

{

items=1;

class Item0

{

position[]={4150.460449,95.449776,4203.604004};

azimut=270.000000;

id=14;

side="EAST";

vehicle="SoldierEB";

leader=1;

rank="CORPORAL";

skill=0.200000;

init="fleeToGroup2 = group this";

};

};

class Waypoints

{

items=1;

class Item0

{

position[]={4142.787109,97.346100,4203.688965};

combatMode="YELLOW";

formation="STAG COLUMN";

speed="FULL";

combat="AWARE";

class Effects

{

};

showWP="NEVER";

};

};

};

class Item4

{

side="EAST";

class Vehicles

{

items=1;

class Item0

{

position[]={4149.631836,95.491386,4187.682129};

azimut=270.000000;

id=15;

side="EAST";

vehicle="SoldierEB";

leader=1;

rank="CORPORAL";

skill=0.200000;

init="fleeToGroup3 = group this";

};

};

class Waypoints

{

items=1;

class Item0

{

position[]={4142.395996,97.300659,4187.705566};

combatMode="YELLOW";

formation="STAG COLUMN";

speed="FULL";

combat="AWARE";

class Effects

{

};

showWP="NEVER";

};

};

};

class Item5

{

side="EAST";

class Vehicles

{

items=1;

class Item0

{

position[]={4149.920898,96.277786,4170.244629};

azimut=270.000000;

id=16;

side="EAST";

vehicle="SoldierEB";

leader=1;

rank="CORPORAL";

skill=0.200000;

init="fleeToGroup4 = group this";

};

};

class Waypoints

{

items=1;

class Item0

{

position[]={4142.931152,96.928856,4170.275879};

combatMode="YELLOW";

formation="STAG COLUMN";

speed="FULL";

combat="AWARE";

class Effects

{

};

showWP="NEVER";

};

};

};

class Item6

{

side="EAST";

class Vehicles

{

items=12;

class Item0

{

position[]={5006.859375,16.334999,4076.065918};

azimut=86.677902;

id=17;

side="EAST";

vehicle="SoldierEB";

leader=1;

rank="CORPORAL";

skill=0.200000;

init="battleGroup2 = group this; ""_x allowFleeing 1"" forEach units battleGroup2";

};

class Item1

{

position[]={5004.313965,16.334999,4083.639404};

azimut=86.677872;

id=18;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item2

{

position[]={5003.809082,16.334999,4068.168701};

azimut=86.677872;

id=24;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item3

{

position[]={4999.331543,16.334999,4060.656006};

azimut=86.677872;

id=25;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item4

{

position[]={5001.767090,16.334999,4087.235107};

azimut=86.677872;

id=19;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item5

{

position[]={4997.805664,16.334999,4090.981689};

azimut=86.677872;

id=20;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item6

{

position[]={4995.860352,16.334999,4055.514404};

azimut=86.677872;

id=26;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item7

{

position[]={4990.886230,16.334999,4048.935791};

azimut=86.677872;

id=27;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item8

{

position[]={4993.323730,16.334999,4095.636475};

azimut=86.677872;

id=21;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item9

{

position[]={4988.842285,16.423908,4100.289063};

azimut=86.677872;

id=22;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item10

{

position[]={4986.728027,16.334999,4044.014404};

azimut=86.677872;

id=28;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item11

{

position[]={4984.347656,18.095863,4105.175781};

azimut=86.677902;

id=23;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

};

class Waypoints

{

items=1;

class Item0

{

position[]={5185.272949,14.333159,4075.712402};

combatMode="YELLOW";

formation="WEDGE";

speed="FULL";

combat="AWARE";

class Effects

{

};

showWP="NEVER";

};

};

};

class Item7

{

side="EAST";

class Vehicles

{

items=12;

class Item0

{

position[]={4991.663086,16.334999,4074.683350};

azimut=86.677902;

id=29;

side="EAST";

vehicle="SoldierEB";

leader=1;

rank="CORPORAL";

skill=0.200000;

init="battleGroup3 = group this; ""_x allowFleeing 1"" forEach units battleGroup3";

};

class Item1

{

position[]={4989.117676,16.334999,4082.256836};

azimut=86.677872;

id=30;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item2

{

position[]={4988.612793,16.334999,4066.786133};

azimut=86.677872;

id=36;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item3

{

position[]={4984.135254,16.334999,4059.273438};

azimut=86.677872;

id=37;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item4

{

position[]={4986.570801,16.334999,4085.852539};

azimut=86.677872;

id=31;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item5

{

position[]={4982.609375,16.334999,4089.599121};

azimut=86.677872;

id=32;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item6

{

position[]={4980.664063,16.334999,4054.131836};

azimut=86.677872;

id=38;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item7

{

position[]={4975.689941,16.334999,4047.553223};

azimut=86.677872;

id=39;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item8

{

position[]={4978.127441,16.334999,4094.253906};

azimut=86.677872;

id=33;

side="EAST";

vehicle="SoldierEB";

rank="CORPORAL";

skill=0.200000;

};

class Item9

{

position[]={4973.645996,16.334999,4098.906250};

azimut=86.677872;

id=34;

side="EAST";

vehicle="SoldierEB";

&nb

Share this post


Link to post
Share on other sites

Thank you both, ColonelSandersLite and General Barron for your help! I wasn't aware that the fleeing ability was somewhat "broken". Thank you ColonelSanders for the script, I will give it a go in my mission.

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  

×