Jump to content
Eggitheegg

How to make a trigger check if all objects inside it are deleted

Recommended Posts

I'm making a garbage man type of mission, basically you need to clean camp maxwell, the only thing I need now is to make the trigger check if everything inside it has been cleaned (basically deleted) I used the addAction command in combination with the deleteVehicle command to "clean" the objects. (also every object inside the trigger has the name rock followed by a number if it somehow helps you help me) I need the trigger to check if every object was deleted and if every object was in fact deleted then complete the mission.

 

Share this post


Link to post
Share on other sites

https://community.bistudio.com/wiki/nearestObjects

 

private _classnames = ["your_object_type_1_classname", "your_object_type_2_classname", "your_object_type_3_classname", "your_object_type_4_classname" ];
private _position_trigger = position your_trigger_name;
private _radius = your_search_radius;

if ( nearestObjects [_position_trigger, _classnames, _radius, true] isEqualTo [] ) then
{
 hint "Everything is clean now.";
};

 

  • Like 1

Share this post


Link to post
Share on other sites
47 minutes ago, sarogahtyp said:

https://community.bistudio.com/wiki/nearestObjects

 


private _classnames = ["your_object_type_1_classname", "your_object_type_2_classname", "your_object_type_3_classname", "your_object_type_4_classname" ];
private _position_trigger = position your_trigger_name;
private _radius = your_search_radius;

if ( nearestObjects [_position_trigger, _classnames, _radius, true] isEqualTo []) then
{
 hint "Everything is clean now.";
};

 

Thanks for the fast response will you be able to explain the first 3 lines though? 

Share this post


Link to post
Share on other sites

 

private _classnames = ["your_object_type_1_classname", "your_object_type_2_classname", "your_object_type_3_classname", "your_object_type_4_classname" ];

creates a local array named _classnames which contents have to be strings which should be the classnames of your specific object types.

You can get those classnames if you start your mission, go to such object, point on it and open debug console and execute this:

copyToClipboard ( typeOf cursorObject );

now you have the classname of the object in your clipboard and you can just paste it in the array.

For some random houses on Altis it would look like this:

private _classnames = ["Land_u_House_Big_02_V1_F", "Land_Metal_Shed_F", "Land_i_Stone_HouseBig_V2_F", "Land_u_Addon_02_V1_F" ];

 

 

 

private _position_trigger = position your_trigger_name;

here you just have to substitute your_trigger_name with the variable name of your trigger. It defines just the center position for the circle within nearestObjects looks for the given object types.

 

 

 

private _radius = your_search_radius;

same but with search radius.

 

Read the link bout nearestObjects I posted. Its all explained there. If you have questions after that then just ask.

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

×