Jump to content
Mr.clean132

Applying customization to vehicle in trigger

Recommended Posts

Hi, I was hoping someone could help me setup a system to add customizations to vehicles (camo nets, bags, tracks, or change the camouflage) in a trigger. I have a mission using the spawn AI module, but I can't find a way to add customizations to vehicles through the spawn ai module, so I figured a trigger would be the next best way. In my mission, the vehicles spawn inside this trigger, and I figure you could have the trigger apply certain presets to them. 

 

I tried scripting this myself, but I'm very new to this and got stuck. What i tried was setting the trigger activation to: Any player, not present, repeatable (this is so that if a player drives their vehicle through the trigger it doesn't apply the customizations to their vehicle, only ai vehicles.) 

My condition field is:

this && ({_x isKindOf "O_MBT_02_cannon_F"} count thisList >0);

the trigger interval is 2 seconds, and the activation field is:

{[ _x,[],["showCamonetHull",1,"showCamonetTurret",1,"showLog",1]] call BIS_fnc_initVehicle;} forEach thisList;

I assume something with the condition isn't working, as I'm not really sure how to properly set up that. 

 

This was my test version, ideally, it would work for multiple vehicle types, like APCs and tanks. I was also hoping to maybe make it randomize the preset, like have a few presets per vehicle and have it pick one to apply, although, getting it to work at all would be nice.

 

Thanks in advance

Share this post


Link to post
Share on other sites

Another option is to create the truck just the way that you want it and place it on the edge of the map.

 

Then when you need the truck a trigger fires and the truck is moved to the required location. In this example the location is over a small rock    "truck1 setpos getpos rock1"

 

.

 

 

 

 

Share this post


Link to post
Share on other sites
Just now, Joe98 said:

Another option is to create the truck just the way that you want it and place it on the edge of the map.

 

Then when you need the truck a trigger fires and the truck is moved to the required location.    "

 

 

 

Unfortunately, this won't work for my situation, as it involves a lot of assets, and it's crucial the ai are constantly respawning, exactly how the Spawn ai module does it. 

Share this post


Link to post
Share on other sites

In a trigger with a "Not Present" activation, thisList will always be empty.

 

Better to check for presence of "Anybody" then filter out players.

 

Even better would be to skip the trigger entirely and use the Spawn AI module's expression field:

 

params ["_group","_module","_groupData"];

_vehicles = [_group, true] call BIS_fnc_groupVehicles;

{
	if (typeOf _x isEqualTo "O_MBT_02_cannon_F") then 
	{
		[_x,[],["showCamonetHull",1,"showCamonetTurret",1,"showLog",1]] call BIS_fnc_initVehicle;
	};
} forEach _vehicles;

As always, there is likely a more elegant way to code this, but it seems to work as it is.

  • Like 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

×