Jump to content
sarogahtyp

[Solved] Battle Tank gunner not shooting

Recommended Posts

In both scenarios player is not a member of AIs group.

 

Scenario 1 (working):

- placing a Bluefor Tank with crew in Eden, deleting its driver, placing player nearby tank

- placing Opfor Infantry + 1 Tank somwhere

- Starting SP

- player enters tank as driver, moves to Opfor, AI does what it should - commander kills infantry, gunner kills tank.

 

Scenario 2 (not working):

- placing an EMPTY  Bluefor Tank in Eden, placing player nearby tank

- placing Opfor Infantry + 1 Tank somwhere

-spawning gunner and commander by triggered script into tank.

- Starting SP

- player enters tank as driver, moves to trigger which spawns the AI

- player moves to Opfor, - commander kills infantry but gunner doesn't kill enemy tank.

 

What I'd like is to have the gunner kill the tank in 2nd Scenario.

My script is started by trigger with this line:

_d=[vehicle player] execVM "test.sqf"

My test.sqf is this:

params [["_vec", objNull, [objNull]]];

_spawn_pool = ["B_Soldier_GL_F","B_HeavyGunner_F"];

_squad = createGroup [west, false];
_squad addVehicle _vec;

_squadpos = _vec getPos [10, random 360];

_unit = _squad createUnit [(selectRandom _spawn_pool), (_squadpos getPos [2, (random 360)]), [], 0, "NONE"];
_unit assignAsGunner _vec;
_unit moveInGunner _vec; 
	
_unit = _squad createUnit [(selectRandom _spawn_pool), (_squadpos getPos [2, (random 360)]), [], 0, "NONE"];
_unit assignAsCommander _vec;  
_unit moveInCommander _vec; 
_squad selectLeader _unit;

_vec setUnloadInCombat [false, false];

 

What am I missing?

Share this post


Link to post
Share on other sites

when the player becomes effectiveCommander, he has to order the gunner for main gun use

or you tweak the config (autoFire=1) for the main gun to have AI use it without orders like it does with MG

  • Like 2

Share this post


Link to post
Share on other sites

does this mean that I can t get rid of that effective commander thing with scripting?

Share this post


Link to post
Share on other sites

Leader is not related with with effective commander.

There is no setter for effectivecommander. Engine does the job.

If you start with a tank, player as driver and crew already inside, you're not effective commander, and the gunner will fire against the enemy tank.

I don't know another way to let an AI be effective commander instead of player.

 

Note: And yes, you're right. As effective commander & leader, no matter if you're driver or commander, you can order the gunner to target the tank, but this  dumb a...hole will not fire.

  • Like 1

Share this post


Link to post
Share on other sites

what i stumble about is that in scenario 1 i place the tank its commander and gunner in eden. player is placed nearby. after starting SP player enters the tank and seems not to be effective commander.

i think ive to do further tests and check who is effective commander. maybe i find a solution or i ll script automated fireorders for the gunner. but this can get a complex thing especially if the vehicle is not a tank but a battle heli.

Share this post


Link to post
Share on other sites

Thank you for your advices guys. problem solved.

Effective Commander is always the first unit (regardless if AI or player) which enters an empty tank! 

Therefore my solution is to get the player out of the tank, embark the commander and move the player in again. This is not the most nice player experience but it works:

params [["_vec", objNull, [objNull]]];

_squad = createGroup [west, false];
_squad addVehicle _vec;
_squadpos = _vec getPos [10, random 360];

_spawn_pool = ["B_Soldier_GL_F","B_HeavyGunner_F"];

_unit = _squad createUnit [(selectRandom _spawn_pool), (_squadpos getPos [2, (random 360)]), [], 0, "NONE"];
_unit assignAsCommander _vec;

moveOut player;
 
_unit moveInCommander _vec; 

player moveInDriver _vec; 

_squad selectLeader _unit;

_unit = _squad createUnit [(selectRandom _spawn_pool), (_squadpos getPos [2, (random 360)]), [], 0, "NONE"];
_unit assignAsGunner _vec;
_unit moveInGunner _vec; 
	
_vec setUnloadInCombat [false, false];

 

  • Like 2

Share this post


Link to post
Share on other sites

Would this work as a mod that gets triggered when a player enters a vehicle. Where he didn't want effective commander role? You could black out player view while all the movement was happening. 

Share this post


Link to post
Share on other sites

@sarogahtyp thanks for sharing!

 

tried also moving player out and back in, but couldnt get it reliably working. lets see how it goes with your code

 

on a related note you may want to check:

 

 

Source will become available in the coming days if someone wants to make a standalone version.

  • Like 2

Share this post


Link to post
Share on other sites

@kremator

black out is not necessary I think. the moveout->movein of the player is very fast and the only thing you see is the camera which is readjusting the view.

Idk what you exactly mean with your question. Using this in a "getIn" Event Handler needs some tweaking because the EH would fire if player moves in a second time.

 

@.kju

the important thing is that the vehicle has to be empty. The first unit which moves in is effective commander then. But maybe there are cases which not work.I did not test every possible case but it's working with the 2nd scenario I described in OP

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

As long as it works every time I decide to move - I'd be happy !

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

×