Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
Yeti1

Making AI attack a specific object

Recommended Posts

Hi all, I am trying to make the AI jet attack an object (An empty object 'Fregeta', it's a naval destroyer) using a trigger.

I can make the AI Jet attack a tank, I tested it out, but trying to get it to attack this empty object is hard for me, I tried grouping the object with an OPFOR unit but that didn't work.

I did google and found a dead download link for a script that would allow you to make invisible targets.

Thanks in advance.

Share this post


Link to post
Share on other sites

I just tested this and it worked:

1. Place an OPFOR unit and give it a name of your choice

2. Save the mission

3. Open up the "mission.sqm" file

4. Search for the unit you just placed by it's name and you should see something like this:

side="EAST";

class Vehicles

{

items=1;

class Item0

{

position[]={1039.615,44.582474,5980.0044};

special="FLY";

id=2;

side="EAST";

vehicle="PBX";

leader=1;

skill=0.60000002;

text="name you gave";

5. Where it says vehicle="somename" replace what's between the quotes with "Land_Fregata"

6. Save the mission.sqm and reopen the mission in the editor and it should work

Edited by IronSight94

Share this post


Link to post
Share on other sites

It works and turns the ship to OPFOR, to get it to float I had to add this to the init.sqf..

bombertar1 setPos [getPos bombertar1 select 0, getPos bombertar1 select 1,1];

Next problem is the jet won't attack it, he just keeps flying over the ship, I have the same script I tested on a tank that did work..

//spawn bomber1 with crew
_array = [[(getMarkerPos "bomber") select 0,(getMarkerPos "bomber") select 1,250], 270, "AV8B2",WEST] call bis_fnc_spawnvehicle;

_bomber1 = _array select 0;	//the helicopter
_bomber1crew = _array select 1;	//the units that make up the crew
_bomber1group = _array select 2;	//the group

_wp1 = _bomber1group addWaypoint [(getpos bombertar1), 0];
_wp1 = _setWaypointSpeed "NORMAL";
_wp1 = _setWaypointType "SAD";

Edited by Yeti1

Share this post


Link to post
Share on other sites

The thing is the Frigate and Destroyer does not have a damage model. If you try flying ontop of it you just float through, as it is merely a 3D-picture of a frigate at best. You can simulate an attack by placing an OPFOR unit inside and once that gets hit you slowly make the ship sink with something like this:

while {(getpos "frigate" select 2) != 0} do {
_height = (getpos "frigate" select 2);
_pos = [(getpos "frigate" select 0), getpos "frigate" select 1, _height];
_height = _height - 0.01;
sleep 0.05;
};

Untested.

Share this post


Link to post
Share on other sites

Thanks for that sinking information, I will put that to good use.

I would need a vehicle inside it so the jet attacks with missiles (I think), so how would I get a vehicle inside my frigate ?

---------- Post added at 17:51 ---------- Previous post was at 17:04 ----------

Nice one, got it working.

It even works on the civilian frigate so there is no need to change sides.

Firstly I inserted the frigate and renamed it frig1, I had to adjust the height so it would float so I put this in the Frigates init..

this setPos [getPos this select 0, getPos this select 1,1];

Now it floats and is in the position I want it to be.

Next I inserted an OPFOR tank with this in the init..

this attachTo [frig1,[0,0,14]]; this setdir 280;

I had to mess about with the numbers for position adjustment, [frig1,[0,0,14]] - 14 is the height, if the tank is too visible you can change the numbers until you are happy.

So thats my tank attached to my frigate.

It works with planes and heli's.

Plane example that I had in a script working from a trigger.

//spawn bomber1 with crew
_array = [[(getMarkerPos "bomber") select 0,(getMarkerPos "bomber") select 1,250], 270, "AV8B2",WEST] call bis_fnc_spawnvehicle;

_bomber1 = _array select 0;	//the helicopter
_bomber1crew = _array select 1;	//the units that make up the crew
_bomber1group = _array select 2;	//the group

_wp1 = _bomber1group addWaypoint [(getpos frig1), 0];
_wp1 = _setWaypointSpeed "NORMAL";
_wp1 = _setWaypointType "SAD";

Share this post


Link to post
Share on other sites

Now that sounds like fun, thanks bud :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

×