Jump to content
Sign in to follow this  
twisted

Detecting player in vehilce or on foot

Recommended Posts

Hi. I'm trying to detect units within certain radius whther they are on foot, in a tank, in a car or in a heli. Right now units are only detected if on foot.

the code i am using is:

_detected = _towncenterpos nearEntities [["Man","LandVehicle","Air"], _activatedist];

where _activedist is just the distance detection happens at (usually 500)

what am i misunderstanding?

Share this post


Link to post
Share on other sites

I don't quite understand what you are asking, but here is the logic to check a unit's vehicle type

if (vehicle _unit == _unit) then 
{
       //unit on foot
}
else
{
       if (vehicle _unit isKindOf "Tank")then 
       {
                 //_unit in tank
       };
       //...
};

Share this post


Link to post
Share on other sites

_detected = (getPosATL Player) nearEntities [["Man","LandVehicle","Air"], 500];
diag_log (str (_detected));

return:

"[O Alpha 1-1:1,O Alpha 1-2:1,O Alpha 2-1:1,B Alpha 1-1:1 (Falsche9),Agent 0x3ac8c080,Agent 0x3c08a080,Agent 0x3ac78080,O Alpha 1-3:1,Agent 0x3a466080,Agent 0x35278080,Agent 0x3a3e8080,Agent 0x3a4a2080]"

I have here: 1x player, 1x soldier, 1x apc, 1x helicopter, 1x car. So the code does detect vehicles and other things - what is Agents? edit: snakes?

Edited by Falsche9

Share this post


Link to post
Share on other sites

_detected = _towncenterpos nearEntities [["Man"], _activatedist];
waitUntil {{vehicle _x isKindOf "Air";} forEach _detected};
hint "They're all in an Aircraft.";

---------- Post added at 17:46 ---------- Previous post was at 17:42 ----------

waitUntil {vehicle player isKindOf "air"};
hint "You're in an aircraft";

---------- Post added at 17:54 ---------- Previous post was at 17:46 ----------

And yeah the agents are animals. You'll need to filter those out with a civilian check.

Share this post


Link to post
Share on other sites

vehicle player == player is the quickest way unless you're looking for a particular vehicle

Share this post


Link to post
Share on other sites

I think he wanted to know the type of the vehicle the units were in. The title is a bit misleading, unless I'm reading the OP wrong.

Edited by Iceman77

Share this post


Link to post
Share on other sites
waitUntil {isTouchingGround theHelo && {isTouchingGround player}};
hint "The helicopter and the player has touched the ground.";
//do some things

waitUntil {isTouchingGround theHelo || {isTouchingGround player}};
hint "The helicopter or the player has touched the ground.";
//do some things

waitUntil {isTouchingGround theHelo && {! (player in theHelo)}};
hint "The helicopter has touched the ground and the player isn't in the helo.";
//do some things

waitUntil {isTouchingGround theHelo && {! (player in theHelo) && {isTouchingGround player}}};
hint "The helicopter has touched the ground, the player isn't in the helo and the player isn't in a parachute.";
//do some things

waitUntil {(getPosATL theHelo) select 2 < 2 && {! (player in theHelo) && {(getPosATL player) select 2 < 2}}};
hint "The helicopter is near the ground, the player isn't in the helo and the player probably isn't in a parachute.";
//do some things

Of course you can use 'IF' control structure if you want.

this is from one of my threats answer from iceman .

maybe this helps..............

Share this post


Link to post
Share on other sites

And yeah the agents are animals. You'll need to filter those out with a civilian check.

No need for extra check:

"man" includes animals

'CAmanBase" is humans only

Share this post


Link to post
Share on other sites

Yup. Here is the Arma2 tree in an easily digestable form: Arma3 uses the same "logic" (yeah, there is not much logic in there, but there is not a word for Arma-way-of-thinking :) ) : http://community.bistudio.com/wiki/ArmA_2:_CfgVehicles

The interesting nodes IMHO are "man" and "building"/"houses": so get familiar with these and THEN open up Arma3's config browser. (My favourite are sea-weeds being buildings)

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  

×