Jump to content

Recommended Posts

Simple script which allows the player to move a crate around and probably load it in vehicle. Paste this in crate, box, etc. init  
 

this addAction["Pickup Box",{
_object  = (_this select 0);
_user = (_this select 1);
_object attachTo[_user,[0,1,1],"Pelivs"];
},nil,1.5,false,false,"","true",2,false,"",""];
this addAction["Drop Box",{
{
  detach _x;
  _x enableSimulationGlobal true;
} forEach attachedObjects player;
},nil,1.5,false,false,"","true",2,false,"",""];

You can pick up, move around and drop the crate. Enjoy this dead simple script. 🙂 
You can make it "loadable" in a specific vehicle (it work only for RZOR vehicle of SOCOM faction  (@RHS USAF) called "rzr" ). Unloading the box is simply using the addAction pickup while you are in the vehicle and then drop it when you get out. 

this addAction["Load in RZR",{ 
_object  = (_this select 0); 
_user = (_this select 1); 
_object attachTo[rzr,[0,-1.1,-0.3]]; 
},nil,1.5,false,false,"","true",2,false,"",""];

 

  • Like 2

Share this post


Link to post
Share on other sites

For other vehicles you have to find the best relative position using the attachTo command in editor. Simply name your crate "box", the vehicle like "rzr" and then have 15 min fun finding the best position by changing the numbers in the array (they can be negative). 
 

box attachTo [rzr, [0, -1.1, -0.3]];

I wonder of there is some "internal point" for cargo vehicle to store boxes and such? 
I would like to make the script more "general" using class names instead of variables, any idea how that would be ?... 

Share this post


Link to post
Share on other sites
On 12/22/2022 at 12:44 AM, kibaBG said:

For other vehicles you have to find the best relative position using the attachTo command in editor. Simply name your crate "box", the vehicle like "rzr" and then have 15 min fun finding the best position by changing the numbers in the array (they can be negative). 
 


box attachTo [rzr, [0, -1.1, -0.3]];

I wonder of there is some "internal point" for cargo vehicle to store boxes and such? 
I would like to make the script more "general" using class names instead of variables, any idea how that would be ?... 

If the vehicle supports Vehicle in Vehicle Transport then it has cargoBayDimensions[] configured which gives you offsets. Other than that it's gonna be difficult to generalise this for every vehicle type.

 

One simple generalisation you can make is to use nearestObject (syntax 1) to find the nearest compatible vehicle by classname and then attach to it instead of the hardcoded rzr.

  • 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

×