Jump to content
Sign in to follow this  
Sqeemin

Question: How to tellif a type of vehicle is close to a object

Recommended Posts

Hello.

I'm trying to get an object to identify a type of vehicle (e.g "B_truck_01_box_F") so when it gets close it will execute a script.

How would you get the object to identify the id of the vehicle("B_truck_01_box_F")?

thanks.

Share this post


Link to post
Share on other sites
_count = count (player nearObjects ["B_truck_01_box_F", 50]);  
if (_count > 0) then {hint "truck near"};

Share this post


Link to post
Share on other sites

thanks the detecting the truck part of it works , but the part that doesn't work is when you start the mission. the script only works at the start of the mission then after that it won't work I've tried making a trigger that repeats and then put _test = execVM "test.sqf" in the init line but it doesn't work.

Share this post


Link to post
Share on other sites

_null = [] execVM "test.sqf"

---------- Post added at 07:55 ---------- Previous post was at 07:48 ----------

I put this into the init.sqf and it went off everytime a truck drove by.

[] spawn {
while {true} do {
	private "_truckNear";
	_truckNear = nearestObjects [player, ["B_truck_01_box_F"], 30];    
	if (count _truckNear >= 1) then {hint "truck near"};
	sleep 1;
};
};

Edited by cobra4v320

Share this post


Link to post
Share on other sites

it works now thanks :bounce3:

Edited by Sqeemin

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  

×