Jump to content
SirBassi

doFire / fireAtTarget / vehicle Spawn - No Attacks

Recommended Posts

Hi Guys,

 

Background

I want a simple script that spawns certain random vehicles from a pool at random intervals and attacks a random player. Here using the example of helicopters, the whole thing will follow later for jets, ground vehicles, etc. Distances and timings are greatly reduced for testing. Choice of Randomplayer is double made because of testings.

 

Observation

The script starts as expected, but when the helis reach the AO over Player they don't really attack with main or ship guns. Rarely a short salvo but no real attack.

 

Trials

doFire normally lets AI auto-aim, so I've tried without doTarget as well. But same result. If I read the table at the bottom of the BI Wiki,

(Link: https://community.bistudio.com/wiki/fireAtTarget)

fireAtTarget could be a solution.#

 

What I wanted to avoid was spwawing AI, forming groups, occupying a vehicle and then acting via waypoints. Since I would like to send random vehicles from a larger pool and that would make things very extensive.

 

Script

Spoiler

sleep 20;

 

while {true}do

{

 

    _waitTime = random [10,15,20];

 

    _headlessClients = entities "HeadlessClient_F";

    _targetPlayer = selectRandom (allPlayers - _headlessClients);

    _directionPlayer = direction _targetPlayer;

    _directionNewHeli = _directionPlayer + 180;

    sleep _waitTime;

 

    _helis = ["vn_o_air_mi2_02_01","vn_o_air_mi2_02_02","vn_o_air_mi2_01_01","vn_o_air_mi2_01_02","vn_o_air_mi2_01_03","vn_o_air_mi2_03_01","vn_o_air_mi2_03_02","vn_o_air_mi2_03_03","vn_o_air_mi2_03_04","vn_o_air_mi2_03_05","vn_o_air_mi2_03_06","vn_o_air_mi2_04_01","vn_o_air_mi2_04_02","vn_o_air_mi2_04_03","vn_o_air_mi2_04_04","vn_o_air_mi2_04_05","vn_o_air_mi2_04_06","vn_o_air_mi2_05_01","vn_o_air_mi2_05_02","vn_o_air_mi2_05_03","vn_o_air_mi2_05_04","vn_o_air_mi2_05_05","vn_o_air_mi2_05_06"];

 

    _randomCount = selectRandom [1,2,3];

 

    for [{_i = 0} , {_i <= _randomCount}, {_i = _i + 1 }] do

        {

            _rdmPosition = (getPos _targetPlayer) getPos[(random [1000,2000,3500]), (_directionNewHeli)];

 

            _high = (_rdmPosition select 2) + 120;

            _rdmPosition set [2, _high];

            _newHeli = [_rdmPosition, _directionNewHeli, (selectRandom _helis), EAST] call bis_fnc_spawnvehicle;

 

            _headlessClient = entities "HeadlessClient_F";

            _RandomPlayer = selectRandom (allPlayers - _headlessClient);

           

            _newHeli doMove (getPos _RandomPlayer);

            _newHeli doTarget _RandomPlayer;

            _newHeli doFire _RandomPlayer;

 

            sleep 5;

        };

};

 

//execvm "Spawn_Heli.sqf

 

My Question

Do you have any tips and recommendations that could help me with my desired scenario goal of dealing with the AI? Am I on the right track or should I solve it completely differently?

 

Thanks for your support.

Share this post


Link to post
Share on other sites

hints:

1 - Usually a spawned vehicle (with its crew) needs time for being aware of enemies. I suggest adding a line of code with reveal command:

_newHeli reveal [ _RandomPlayer,4];

2 - this way, I don't doTarget, doFire. If your asset is able to fire on an enemy, it will, imho. You can test without any fire command, or with your code, or with the bis_fnc_fire. My experience is there is few chance to make some asset fires if the target is not compatible, anyway. (a SAD waypoint can do the job also).

 

I created a (spawn group) attack module which works not too bad for repeated/unrepeated attack(s) on (known/unknown pos) player(s)/enemies.

  • Like 2

Share this post


Link to post
Share on other sites

Thanks for your Input.

 

The "reveal" state for AI is something new for me, I will test it.

The bis_fnc_fire I try to avoid because my vehicle Pools for random picks will have very fifferent kind of wapons and for this function you must know muzzel etc.

 

Your Modules I have in mind. I plan to use the Civilian Module and maybe Respawn Vehicle. The attack Module I haven't in mind but will check your Docu.

 

Thanks.

  • Like 1

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

×