Jump to content

Recommended Posts

I have been noticing addons/missions that have some backpacks attached to the bed of the pick-up trucks. How is this accomplished? I have tried searching for "arma 3 attach backpack truck" and other ways and still can't find the answer. Also, when this is done is it able to remove the backpack from the truck so that someone can wear it? Thanks!

Share this post


Link to post
Share on other sites
attachTo is what you need to attach it. You'll also need to change its direction using setDir before attaching it. Good luck finding the offset value you'll need for the backpack to be at the right location on the truck as that requires trial and error as its a complete crapshoot as to if you'll hit it dead on or not. Using addAction can attach and detach the backpack from the truck (probably will also need some way to track what backpacks are attached to the truck and how many are attached, then that'll need to be synced up to all clients in mp, which makes it a bit more complex). I don't have the time to assemble any code right now, you should try to do it on your own.

Share this post


Link to post
Share on other sites

Thanks austin_medic for the reply. I'll give it a shot, but I am pretty clueless when it comes to in depth scripting.

---------- Post added at 01:37 ---------- Previous post was at 23:55 ----------

So I have learned that attachTo does not work with backpacks. I changed the item to a toolkit and I am able to attachTo to the offroad.

I have found something called "groundweaponholder" and found a script that changes a placed object to another.

Placed a road cone and in the INIT entered:

this setpos[(getpos this select 0),(getpos this select 1),-100]; Waffe1 = "groundweaponholder" createVehicle getpos this; Waffe1 addWeaponCargo ["arifle_MX_F",1]; Waffe1 setPos [getPos this select 0,getPos this select 1,0];Waffe1 setdir 75;

The cone was changed to the rifle on the ground.

I changed the script to this:

this setpos[(getpos this select 0),(getpos this select 1),-100]; Waffe1 = "groundweaponholder" createVehicle getpos this; Waffe1 addBackpackCargo ["B_Carryall_ocamo",1]; Waffe1 setPos [getPos this select 0,getPos this select 1,0];Waffe1 setdir 75;

The cone changed to a backpack.

NOW, how do I use the attachTo command with all this? Thanks!

Share this post


Link to post
Share on other sites

waffe1 = "groundweaponholder" createVehicle getpos myCar;  // use the createVehicle array syntax in future though
waffe1 addBackpackCargoGlobal ["B_Carryall_ocamo",1];

// Now attach waffe1 to vehicle;

waffe1 attachTo [myCar,[0,2,2]];

Now your backpack is attached to the vehicle

Share this post


Link to post
Share on other sites

Thank you so much for this! Now how do I make the bag with the bottom down and front facing left (I know how to adjust the attachTo numbers to position it on the truck where I want)? I found setDir, and can turn it, but it does not change the other axis. I also found setVectorDirAndUp but that makes no sense to me. Thanks!

Share this post


Link to post
Share on other sites

Guys are you serious...

It's the method of showObject or whatever

Check the virtual garage and export to your needs, or just find the command and do it that way.

Vehicle - Offroad - Backpacks, Lights, Bullbars, etc.

Share this post


Link to post
Share on other sites

I have found that, but I wan't a player to be able remove the pack and use it, not just an eye candy thing.

Share this post


Link to post
Share on other sites
Guys are you serious...

It's the method of showObject or whatever

Check the virtual garage and export to your needs, or just find the command and do it that way.

Vehicle - Offroad - Backpacks, Lights, Bullbars, etc.

Nah you can't do anything with those. He's not talking about unhiding an animation.

Share this post


Link to post
Share on other sites

Figured it out!

http://i.imgur.com/C9JS1Ts.png?1

And used:

waffe1 = "groundweaponholder" createVehicle getpos myCar; waffe1 addBackpackCargoGlobal ["B_Carryall_ocamo",1]; waffe1 attachTo [myCar,[-1.7,-1.2,-0.48]]; waffe1 setVectorDirAndUp [[-1,0,-5],[0,0,1]];

Thanks for all the help and info!!!

Edited by tazmania720

Share this post


Link to post
Share on other sites

hey mate could you write up a little guide on how to do this? Im not sure where to put the script you posted in the last post. I know this is almost 2 years old now but hope you can help. 

Share this post


Link to post
Share on other sites

@stormoffires If I remember correctly I was playing around with this in the debug console, as seen in the imgur link, but you can easily add this to the INIT block of the Offroad.  Just name Offroad myCar or change "myCar" in the script to "this" removing the " of course.  Now what I didn't figure out, and maybe someone can add to this, is how to fill the bags with gear.  Enjoy!  I'm glad I was able to develop something someone else sees as useful.  

Share this post


Link to post
Share on other sites
12 hours ago, tazmania720 said:

Now what I didn't figure out, and maybe someone can add to this, is how to fill the bags with gear.

Well you have a reference to the groundWeaponHolder waffe1 so you can just do a everyBackpack on it to get a reference to the backpack object.

waffe1 = "groundweaponholder" createVehicle getPos myCar;
waffe1 addBackpackCargoGlobal ["B_Carryall_ocamo",1];
waffe1 attachTo [myCar,[-1.7,-1.2,-0.48]];
waffe1 setVectorDirAndUp [[-1,0,-5],[0,0,1]];
{
	_x params[ "_backpack" ];
	_backpack addItemCargoGlobal "FirstAidKit";
}forEach everyBackpack waffle1

 

  • 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

×