Jump to content
Sign in to follow this  
-ami- mofo

Make AI move forward while under fire

Recommended Posts

Hi scripters I have a group of AI spawn on a marker then move to another marker. There's enemy AI between the spawn and move to 'attack' markers.

When the coast is clear it's all good but until then they just fanny about so much, going forward, lying down, running back, lying down, rinse and repeat 6 times and only finally go forward when it's clear.

How do I get them engage the enemy but still move forward at the same time?

Here's the script I'm using...

GroupOne_X = [getMarkerPos "spawn1", WEST, ["B_Soldier_TL_F", "B_Soldier_F", "B_Soldier_F", "B_Soldier_AR_F", "B_Soldier_AT_F", "B_Medic_F"]] call BIS_fnc_spawnGroup; 
{_x allowFleeing 0} forEach units GroupOne_X;

GroupTwo_X = [getMarkerPos "spawn2", WEST, ["B_Soldier_TL_F", "B_Soldier_F", "B_Soldier_F", "B_Soldier_AR_F", "B_Soldier_AT_F", "B_Medic_F"]] call BIS_fnc_spawnGroup; 
{_x allowFleeing 0} forEach units GroupTwo_X;


GroupThree_X = [getMarkerPos "spawn3", WEST, ["B_Soldier_TL_F", "B_Soldier_F", "B_Soldier_F", "B_Soldier_AR_F", "B_Soldier_AT_F", "B_Medic_F"]] call BIS_fnc_spawnGroup; 
{_x allowFleeing 0} forEach units GroupThree_X;


[GroupOne_X, getMarkerPos "attack1", 600 ] call bis_fnc_taskAttack;
[GroupOne_X, 1] setWaypointSpeed "FULL";
[GroupOne_X, 1] setWaypointCombatMode "RED";
[GroupOne_X, 1] setWaypointBehaviour "AWARE";

[GroupTwo_X, getMarkerPos "attack2", 600 ] call bis_fnc_taskAttack;
[GroupTwo_X, 1] setWaypointSpeed "FULL";
[GroupTwo_X, 1] setWaypointCombatMode "RED";
[GroupTwo_X, 1] setWaypointBehaviour "AWARE";

[GroupThree_X, getMarkerPos "attack3", 600 ] call bis_fnc_taskAttack;
[GroupThree_X, 1] setWaypointSpeed "FULL";
[GroupThree_X, 1] setWaypointCombatMode "RED";
[GroupThree_X, 1] setWaypointBehaviour "AWARE";

sleep 0.2;

Share this post


Link to post
Share on other sites

I don't think there is currently a way for this. No matter what, AI will stay in cover when he is under fire. At least I couldn't find a reliable way in tens of hours of experimenting.

Share this post


Link to post
Share on other sites

Maybe if you get a couple to put suppressive on the enemy AI so they keep their heads down? Or maybe if they outnumber the enemy AI by a fair bit? Isn't their a courage setting or something?

I dunno lol, you'd figure in a game like this it has to be possible to make them CHARGE!

Share this post


Link to post
Share on other sites

You can force selected AI to execute a running forward animation.

Are AIs fired upon during charge? Add an EH "Hit" for each of them, if they get hit and "getDamage > 0.9, setDamage 1; switchMove "";".

Haven't tested or written any code. Just throwing ideas.

Share this post


Link to post
Share on other sites

Inlesco: working with running animations is a nightmare again.

You will have no pathfinding and even the smallest branch of a bush is enough to make the unit play an endless animation while staying in the same position. So basically you'll need to recreate the whole moving system from scratch.

(Anyways I went with this in my ForceMove command in the GetTactical Interface, because I couldn't find a better solution.)

Share this post


Link to post
Share on other sites

Maybe set their behaviour to careless and script in some forceWeaponFire while they're moving. Then exit script when they reach their destination/die

Share this post


Link to post
Share on other sites

yea, change from aware to careless and they will move in under fire and get chopped up as you may want.

Share this post


Link to post
Share on other sites

Is it possible to spawn bullet impacts on the ground (just an effect + its angle)? Or to spawn bullets flying mid-air to make the threat appear more realistic?

Share this post


Link to post
Share on other sites

Yes you can do that.

Use the class from CfgAmmo, with the createVehicle array command.

Put this in your debug field to test random bullets hitting all around you:

player allowDamage false;
0 = 0 spawn {
while {true} do {
	_hoverPos = [
		((getPosATL player) select 0) + (random 14 - 7),
		((getPosATL player) select 1) + (random 14 - 7),
		5
	];
	_bullet = createVehicle ["B_65x39_Caseless_green",_hoverPos,[],0,"CAN_COLLIDE"];
	_bullet setVelocity [0,0,-100];
	sleep (random 0.5);
};
};

Share this post


Link to post
Share on other sites

You can uses

_unit disableAI "fsm";

to make them behave less realistically. It's hard to figure out exactly what it does, but it does make them take cover less.

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  

×