Jump to content
Sign in to follow this  
bennettonn

how to make a chase

Recommended Posts

HI folks

how to make a BLUFOR unit in a helicopter chasing a car OPFOR unit

Share this post


Link to post
Share on other sites

Have a continuously updating waypoint for the chopper on the car's position.

Share this post


Link to post
Share on other sites

guy excuse me for not having explained before but I am very new to edit in arma 3 I did not know anything could you explain me better

Share this post


Link to post
Share on other sites

I think the effort and headache involved in wrangling two human players to properly simulate that, is less headache and effort than trying to get the AI to simulate that.

YMMV.

Share this post


Link to post
Share on other sites
I think the effort and headache involved in wrangling two human players to properly simulate that, is less headache and effort than trying to get the AI to simulate that.

YMMV.

Agreed. The system I'm thinking of is quite a bit too over the top to be able to explain in layman's terms.

Actually a possible work around, if your not wanting to shoot the car as your chasing it, is to have the chopper join the group of the car and see if it falls into formation or not (kind of a stretch but what the hell right?).

Edited by JShock

Share this post


Link to post
Share on other sites
have the chopper join the group of the car and see if it falls into formation or not (kind of a stretch but what the hell right?).

Interesting idea. You could use a gamelogic or any other hidden object as group-leader and simply attach that to the car.

Other solution would be to use a loop with https://community.bistudio.com/wiki/setDestination

Put the following into a scriptfile (doFollow.sqf) and execute this command to initiate the chase:

nul = [yourCar, yourHelo, [3,-10,0]] execVM "doFollow.sqf";

private ["_unit","_follower","_offset"]; 
_unit = _this select 0;
_follower = _this select 1;
_offset = _this select 2;

while {canMove _unit && canMove _follower} do {
_follower doMove (_unit modelToWorld _offset);
sleep 1;
};

In theory, that should tell your chopper to try and keep following 10m behind and 3 meter to the right of the car.

Edited by Tajin
setDestination doesn't work

Share this post


Link to post
Share on other sites
Interesting idea. You could use a gamelogic or any other hidden object as group-leader and simply attach that to the car.

Other solution would be to use a loop with https://community.bistudio.com/wiki/setDestination

Put the following into a scriptfile (doFollow.sqf) and execute this command to initiate the chase:

nul = [yourCar, yourHelo, [3,-10,0]] execVM "doFollow.sqf";

private ["_unit","_follower","_offset"]; 
_unit = _this select 0;
_follower = _this select 1;
_offset = _this select 2;

while {canMove _unit && canMove _follower} do {
_follower setDestination[_unit modelToWorld _offset, "FormationPlanned", true];
sleep 1;
};

In theory, that should tell your chopper to try and keep following 10m behind and 3 meter to the right of the car.

Dude you could make a simple demo mission and I have no idea how to use it :confused::confused:

Share this post


Link to post
Share on other sites

- use a texteditor

- paste my code

- save as doFollow.sqf (where your mission.sqm is)

- put the execVM code in a trigger or in an init-field (replace "yourCar" and "yourHelo" with the respective names of your units)

Not that hard.

Otherwise I suggest you do some reading on the wiki or search for a basic scripting guide.

Share this post


Link to post
Share on other sites
- use a texteditor

- paste my code

- save as doFollow.sqf (where your mission.sqm is)

- put the execVM code in a trigger or in an init-field (replace "yourCar" and "yourHelo" with the respective names of your units)

Not that hard.

Otherwise I suggest you do some reading on the wiki or search for a basic scripting guide.

did not work:( I create a file with the name doFollow.sqf and put your code then I create a trigger with the command nul = [Car, Helicopter, [3, -10.0]] execVM "doFollow.sqf"; and use the trigger however nothing happens

Edited by Bennettonn

Share this post


Link to post
Share on other sites

Make sure to have a "," not a "." between the 10 and the 0:

nul = [Car, Helicopter, [3, -10, 0]] execVM "doFollow.sqf";

And I would change the variable names of the car and chopper something like chaseCar and chaseHelo would be better, because Car and Helicopter are both used in other aspects of scripting, just a precaution.

Share this post


Link to post
Share on other sites
Make sure to have a "," not a "." between the 10 and the 0:

nul = [Car, Helicopter, [3, -10, 0]] execVM "doFollow.sqf";

And I would change the variable names of the car and chopper something like chaseCar and chaseHelo would be better, because Car and Helicopter are both used in other aspects of scripting, just a precaution.

I have to face going crazy with it nothing works someone help me please

---------- Post added at 22:41 ---------- Previous post was at 22:37 ----------

Make sure to have a "," not a "." between the 10 and the 0:

nul = [Car, Helicopter, [3, -10, 0]] execVM "doFollow.sqf";

And I would change the variable names of the car and chopper something like chaseCar and chaseHelo would be better, because Car and Helicopter are both used in other aspects of scripting, just a precaution.

I have to face going crazy with it nothing works someone help me please here is the exact codes I used in doFollow.sqf:

private ["_unit" "_follower" "_offset"];

_unit = _this select 0;

_follower = _this select 1;

_offset = _this select 2;

while {canMove _unit canMove _follower && do {}

_follower setDestination [_unit modelToWorld _offset, "FormationPlanned", true];

sleep 1;

};

and I used the trigger:

nul = [chaseCar, chaseHelo [3, -10, 0]] execVM "doFollow.sqf";

---------- Post added at 22:48 ---------- Previous post was at 22:41 ----------

Make sure to have a "," not a "." between the 10 and the 0:

nul = [Car, Helicopter, [3, -10, 0]] execVM "doFollow.sqf";

And I would change the variable names of the car and chopper something like chaseCar and chaseHelo would be better, because Car and Helicopter are both used in other aspects of scripting, just a precaution.

not started editing missions and am already going crazy someone help me

here is the exact codes I used in doFollow.sqf:

private ["_unit" "_follower" "_offset"];

_unit = _this select 0;

_follower = _this select 1;

_offset = _this select 2;

while {canMove _unit canMove _follower && do {}

_follower setDestination [_unit modelToWorld _offset, "FormationPlanned", true];

sleep 1;

};

and I used the trigger:

nul = [chaseCar, chaseHelo [3, -10, 0]] execVM "doFollow.sqf";

Share this post


Link to post
Share on other sites

First off, no need for the triple post, that's just borderline spam, secondly do you not understand the concept of copy and paste? Because you still have a few things out of place from Tajin's original code post:

//What you put
private ["_unit" "_follower" "_offset"];
_unit = _this select 0;
_follower = _this select 1;
_offset = _this select 2;

while {canMove _unit canMove _follower && do {}//brackets and && symbol out of place
_follower setDestination [_unit modelToWorld _offset, "FormationPlanned", true];//He changed it to doMove, he found setDestination didn't work
sleep 1;
};

//What it should be
private ["_unit","_follower","_offset"]; 
_unit = _this select 0;
_follower = _this select 1;
_offset = _this select 2;

while {canMove _unit && canMove _follower} do {
   _follower doMove (_unit modelToWorld _offset);
   sleep 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
Sign in to follow this  

×