OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: snafu on 07 Jun 2018, 22:28:21

Title: Attaching Bushes to Vehicles
Post by: snafu on 07 Jun 2018, 22:28:21
I see one of the features of Arma 3's Tanks DLC is the ability to put bushes on armour as camouflage.

Is this possible with OFP?

I'm making a tank mission adapted from a wargame scenario book and think it would be a nice little addition.

The first obstacle is finding the class names for the bushes. I've found some I'd like to use, does anyone know their class names?

https://steamcommunity.com/sharedfiles/filedetails/?id=1405398138

https://steamcommunity.com/sharedfiles/filedetails/?id=1405398174

https://steamcommunity.com/sharedfiles/filedetails/?id=1405398250

https://steamcommunity.com/sharedfiles/filedetails/?id=1405398325

https://steamcommunity.com/sharedfiles/filedetails/?id=1405398374
Title: Re: Attaching Bushes to Vehicles
Post by: Gruntage on 08 Jun 2018, 08:59:38
It is possible. It's essentially a setpos loop which uses 3 axis.

When it comes to finding out class names, one method is to do something like this:

Code: [Select]
_nObject = [0,0,0] nearestObject 123456;
hint format ["%1", typeof _nObject]

Not sure if typeof returns the class name.

123456 refers to the object ID of the object you want the class name of. I've never actually done this so the syntax is far from guaranteed and if I were going to do this, I'd use the editorupgrade and access the bushes that way. Then you'd only need to worry about the setpos loop itself.

There's a script knocking about that attaches an M2 machinegun to a vehicle which might be useful to you, as it's basically the same as what you're trying to achieve.
Title: Re: Attaching Bushes to Vehicles
Post by: snafu on 08 Jun 2018, 10:59:34
Thank you. I'll experiment with the idea and report back on how it works.
Title: Re: Attaching Bushes to Vehicles
Post by: h- on 08 Jun 2018, 17:40:19
Vanilla bushes don't have class names because they're map objects.
So the only way to "attach" them to tanks is to use editorupgrade bushes.
Title: Re: Attaching Bushes to Vehicles
Post by: snafu on 08 Jun 2018, 23:05:28
I was trying to keep the mission addon free and in the spirit of the original BIS missions. However, it's not a huge deal to use the editor update as it's something most folks will have.

I found an attach script in the Editor's Depot that looked useful. I attached two bushes but they rotated in the direction of the tank, so it didn't look right.

Wadi's old MG script worked a treat. The downside is that there's no obvious way of manipulating the bush's distance from the centre. You can only change its height. Apart from some basic snippets and intros, scripting is not my strong point.

Anyway, screenshot:

https://steamuserimages-a.akamaihd.net/ugc/910171378795571542/9AC3F2C997A6F5E8D5A56EC3A795E911148EC4B2/

It looks and works OK, there are probably more suitable bushes and so on in user made vegetation packs.
Title: Re: Attaching Bushes to Vehicles
Post by: Gruntage on 09 Jun 2018, 07:50:54
Try using the attach script by Red Stripe Studios: https://www.ofpec.com/editors-depot/index.php?action=details&id=245&game=OFP (https://www.ofpec.com/editors-depot/index.php?action=details&id=245&game=OFP)

That script has sections that allow you to change an object's position in relation to the vehicle. It could even been designed for the purpose of adding bushes and so on.
Title: Re: Attaching Bushes to Vehicles
Post by: snafu on 09 Jun 2018, 11:35:33
That's the one I tried initially. It worked fine except that the script updates the facing of the bushes to be in line with the direction the vehicle is facing, so you see them constantly with the changes in vehicle direction. One would have to alter the formula to solve that issue.

Wadi's one will do for now. I may try and experiment with Red Stripe's code.

Thank you for your assistance, guys.
Title: Attaching Bushes to Vehicles
Post by: MichaelLurNe on 05 Aug 2018, 04:28:05
Hi
Attaching texture to an object imported via stl does not seem to be working the way it is done in the Texture sample. Am I doing something wrong?
Thanks in advance
Ron