Jump to content
Sign in to follow this  
norrin

Example scripts that use the attachTo command

Recommended Posts

Scripted Ride On APC

Practical uses of the attachTo command Part 1

© JUNE 2009 - norrin

Description

Suite of scripts that allows up to 4 players to ride on the top of an APC. From there they can stand, crouch, turn around, shoot reload and disembark

Download

http://norrin.org/downloads/ArmA2/attachTo/onTop2.utes.rar (Updated 080609)

To implement in your own missions

1. Copy the sitOnTopVcl folder from the test mission into your mission file.

2. Create an AAV in the editor, name it (eg. AAV1), then in the APC’s init box put:

 nul = [this] execVM "sitOnTopVcl\mount_vcl_init.sqf";

3. Create playable units and name them in the editor.

To use

1. Run up to the AAV and you will get the option to ride on top.

2. Once you are on top and attached you can;

a/ turn around using the “delete†and “end†keys

b/ disembark using the insert key – this will unattach you from the vehicle and you can just walk off using the “W†key.

c/ reload using the “R†key

d/ aim and target within a limited arc, bring up the iron sites, the use the “alt†key to move your aim around – for gross changes in direction use the turn around keys listed above.

Tested

On a dedicated server but without multiple players

Hopefully something similar will be applicable to choppers and I'll start work on that next week

attahTo.jpg

Put Bike in pick-up

Practical uses of the attachTo command Part 2

revision 1 (080609)

Description

A script that allows you to put a bike on the back of a pick-up, drive it round then unmount the bike.

Download

http://norrin.org/downloads/ArmA2/attachTo/loadOnTruck01.utes.rar

To implement in your own missions

1. Copy the mountOnVcl folder from the test mission into your mission file.

2. Create a pick-up in the editor and name it, , then in the trucks init box put:

nul = [this,"bicycle"] execVM "mountOnVcl\mount_vcl_init.sqf";

3. Create a player in the editor and name it.

4. Create a bike in the editor.

To use:

1. Move close to vehicle make sure a bicycle is close at hand and the use the action: "Mount on Vehicle"

2. You can then drive around - note the bikes pedals go around as you drive the car. :)

3. Get out of the car and "Dismount bike from car".

Tested

Dedicated server by myself

mountedBike.jpg

Put car in C-130

Practical uses of the AttachTo command Part 3

Description

A script that allows you to put a car or hummer etc in the cargo section of a C-130, fly it round then unmount the vehicle.

Download

http://norrin.org/downloads/ArmA2/attachTo/Hercules01.utes.rar

To implement in your own missions

1. Copy the mountOnC130 folder from the test mission into your mission file.

2. Create a pick-up in the editor and name it, , then in the C130's init box put:

nul = [this,"car"] execVM "mountOnC130\mount_vcl_init.sqf";

3. Create a player in the editor and name it.

4. Create a car of some sort in the editor.

To use:

1. Move close to the rear of the C130 make sure a car is close at hand and then use the action: "Load vehicle on C-130"

2. You can then fly around.

3. Get out of the plane then "Unload Vehicle".

Tested

Dedicated server by myself

Other Notes

You can probably put just about anything into the C-130, just makes sure you put the correct class in the C130's init box line, you may also need to change this line

_mountVcl attachTo [_vcl,[0,0,-2]]; 

in the mount_vcl.sqf which you can find in the mountOnC130 folder.

herc.jpg

Move to helicopter door and fire

Practical uses of the AttachTo command Part 4

Description

A script that allows you to move from the seat position within a UH-1 to the door way so that you can fire outside while the chopper is moving.

Download

http://norrin.org/downloads/ArmA2/attachTo/heliDoor.utes.rar

To implement in your own missions

1. Copy the heliDoor folder from the test mission into your mission file.

2. Create a UH-1 in the editor and name it, , then in the chopper’s init box put:

nul = [this] execVM "heliDoor\heliDoor_init.sqf";

3. Create a player in the editor and name it.

To use:

1. Get in the chopper once inside you should get an action that allows you to move to the left or right door

2. To aim: bring up the iron sights and hold the alt key to move your aim point around

3. Press "R" to reload

4 Press "INSERT" to move back to your seat - NB you will need to do this to disembark the chopper

Limitations

If the chopper is accelrating or decelerating hard you may bob around a bit inside while at the doors and may not be able to shoot - unfortunately this is a limitation of the

attachTo command. When in level flight it seems to work really nicely.

Test Mission

Get in the back of the chopper and then move to the door (you can also do this while in flight). Order the pilot to move to a position on the map. Try moving to each door and

back again.

Tested

On a dedicated server by myself

3rdP_heliDoor.jpg

Edited by norrin
New and updated scripts available

Share this post


Link to post
Share on other sites

Do we have possibility to change the direction of the attached vehicle? Could allow some interresting towing effects.

Share this post


Link to post
Share on other sites

That shouldn't be too hard to include mate, but its going to be a little while before I can do more with these scripts as the scripting jobs are already starting to pile up for ArmA2 - this script was more a proof of concept to show that it can be done, adding different vehicles/carrying possibilities and tightening up the code will take a little longer, the APC script on the otherhand is hopefully a bit more advanced.

Share this post


Link to post
Share on other sites
Do we have possibility to change the direction of the attached vehicle? Could allow some interresting towing effects.

Using setdir you can, would be a challenge but not impossible, just need to use some clever maths to work out when to make it turn I suppose

Share this post


Link to post
Share on other sites

btw have any one tried with a ammo crate in a pick up? or a ural truck? :)

Share this post


Link to post
Share on other sites
Do we have possibility to change the direction of the attached vehicle? Could allow some interresting towing effects.

Plenty of other threads with attachTo examples (like the 3 page thread here).

Use setDir to change the direction of the vehicle. If you're using this in multiplayer, add another line "myObj setPos getPos myObj" to sync with every client, otherwise setDir will be local and not do anything (useful). setDir is linked to the vehicle you're going to attach it to. So if you use setDir 180, it won't actually point south, but point towards the rear of the vehicle (which is excellent).

Edited by IceShade

Share this post


Link to post
Share on other sites

Great. As always!

Could BIS implement this for the next version (European + US )?

Edited by bravo 6
refrased

Share this post


Link to post
Share on other sites

Not trying to change the subject, but could something like this work for transporting vehicles in the C-130, using just one or two attachTo points inside the cargo area? To load and unload you would bring the vehicle to the back of the plane and select to load it and it is then attached inside the cargo area, and to unload you select to unload and it brings the vehicle back to the back of the plan.

Could it be possible?

Share this post


Link to post
Share on other sites

This is very possible. All you need to do is work out the attachTo points in your vehicle of choice. The rest can be done by scripting actions to appear under certain conditions eg there is both a box of ammo and a player within 5 metres of a C-130 get action load ammobox etc. The only problem is that things sometimes jiggle around a bit while attached and the object that its attached is moving so it can look a little weird doing things this way.

Share this post


Link to post
Share on other sites

And to make things a little ugly I propose adding config entries for every vehicle as a static object so wheels don't turn. :eek:

Share this post


Link to post
Share on other sites

Put car in C-130

Practical uses of the AttachTo command Part 3

Description

A script that allows you to put a car or hummer etc in the cargo section of a C-130, fly it round then unmount the vehicle.

Download

http://norrin.org/downloads/ArmA2/attachTo/Hercules01.utes.rar

To implement in your own missions

1. Copy the mountOnC130 folder from the test mission into your mission file.

2. Create a pick-up in the editor and name it, , then in the C130's init box put:

nul = [this,"car"] execVM "mountOnC130\mount_vcl_init.sqf";

3. Create a player in the editor and name it.

4. Create a car of some sort in the editor.

To use:

1. Move close to the rear of the C130 make sure a car is close at hand and then use the action: "Load vehicle on C-130"

2. You can then fly around.

3. Get out of the plane then "Unload Vehicle".

Tested

Dedicated server by myself

Other Notes

You can probably put just about anything into the C-130, just makes sure you put the correct class in the C130's init box line, you may also need to change this line

_mountVcl attachTo [_vcl,[0,0,-2]]; 

in the mount_vcl.sqf which you can find in the mountOnC130 folder.

herc.jpg

I've also tidied up the load bike on van code - see the first post for updated script. There's a new way to implement this script so make sure you read the new implementation notes

Finally, the chopper script is not far away - just having some probs with the set direction command with attached (attachTo) units, but soon you'll be able to get out of your seat and move to the open door of a chopper and start shooting your rifle.

Edited by norrin

Share this post


Link to post
Share on other sites

Sorry to double post but I thought this was worthy of its own post - hope this is OK.

Move to helicopter door and fire

Practical uses of the AttachTo command Part 4

© JUNE 2009 - norrin (norrin@iinet.net.au)

Description

A script that allows you to move from the seat position within a UH-1 to the door way so that you can fire outside while the chopper is moving.

Download

http://norrin.org/downloads/ArmA2/attachTo/heliDoor.utes.rar

To implement in your own missions

1. Copy the heliDoor folder from the test mission into your mission file.

2. Create a UH-1 in the editor and name it, , then in the chopper’s init box put:

nul = [this] execVM "heliDoor\heliDoor_init.sqf";

3. Create a player in the editor and name it.

To use:

1. Get in the chopper once inside you should get an action that allows you to move to the left or right door

2. To aim: bring up the iron sights and hold the alt key to move your aim point around

3. Press "R" to reload

4 Press "INSERT" to move back to your seat - NB you will need to do this to disembark the chopper

Limitations

If the chopper is accelrating or decelerating hard you may bob around a bit inside while at the doors and may not be able to shoot - unfortunately this is a limitation of the attachTo command. When in level flight it seems to work really nicely.

Test Mission

Get in the back of the chopper and then move to the door (you can also do this while in flight). Order the pilot to move to a position on the map. Try moving to each door and

back again.

Tested

On a dedicated server by myself

3rdP_heliDoor.jpg

PS: Also fixed the rotate function of the "Ride on Top" of APC scripts so if you're interested you may want to re-download that script as well.

Share this post


Link to post
Share on other sites

Great scripts norrin. Thx a lot ^^

Share this post


Link to post
Share on other sites

Nice Job NORRIN good to see you diving right in on ARMA 2. Looking forward to see what you come up with.

:)

Share this post


Link to post
Share on other sites

I was playing around with a way to launch landing craft from the LHD. This is just a test version exploring possibilities. It doesn't support AI. I presume this rig is meant for some sort of boat hoisting.

th_LHD_BoatLaunch.jpg

Download test mission: LHD_BoatLaunch.utes.pbo

To use:

- there's an action on the towing tractor to teleport to the boat launch platform (since there are no stairs).

- turn on the boat engine to launch the boat into the water

- turn off the boat engine to lift the boat back into the hoisting rig while under it

- use 'get out' to get back on platform

- then use action on the warning signs to teleport to deck (the signs also prevent you from slipping off the launch platform)

Design hurdles and findings:

- it seems you can't use the LHD to attach the boat since the boat keeps dropping every 1 second as if the attach is not checking it regularly enough. Therefore I used the towing tractor for all attach and teleport actions.

- facing the boat at 180 make the default getin/getout actions work better without falling in water

- It's a shame the rear LHD dock doors are closed. It would have been better just to leave them open, since the water is already usable inside the bay. Hope they improve that.

Edited by Dr_Eyeball

Share this post


Link to post
Share on other sites

If any one has any ideas on how to get a cargo chute attached to a vehicle while it being ejected from the back of a c130 let me know, i have tried attaching humv's and all sorts using attachTo but yet it seems to attach to them but its on the ground and never in the air, any one got any ideas.

Share this post


Link to post
Share on other sites

Norrin, fantastic work as always mate. What's next? trying to take over the world!? :)

Jamie.

Share this post


Link to post
Share on other sites

These are some of the coolest things I've seen yet in A2. For those scripting impaired - maybe once you are satisfied with a bunch of these scripts, could they be converted to a logic that can simple be synched with either the player or the vehicle it's used with?

Share this post


Link to post
Share on other sites

Hmm guess everyone fell in love with the AttachTo :P hehe.

Someone mentioned using it for towing... don't do it. In this specific case youre better of using setpos since a rope is somewhat flexible and with the attachto it would look like whatever is beeing towed is fixed on the end of a stick. Setpos in combination with setvelocity and velocity does a pretty decent job for this. I can post some snipplets if required.

Well about that c130-cargo thing. I've been thinking about that too and seeing this, I guess I'll start making a script for it too. However I think it would be nice to avoid having setup it for all sorts of vehicles. Why not make it dynamic? Im thinking about using the boundingBox command along with the attachTo. It would allow to define a space inside the c130, that can be used for cargo and the script would then allow any object that is small enough to fit into that space to be loaded. Boundingbox should also allow to adjust the attachto - position automatically.

If everything goes right, we will end up with an script that allows us to load up virtually every vehicle in the c130, even those from new addons.

Making them dropable by a cargochute shouldn't be much of a problem, so lets add that too. :D Btw, Jantemplar you have to attach the object to the chute, not the chute to the object.

Let me take care of that cargo-thingie, I'll report back to this thread when I have something to show ;D

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
Sign in to follow this  

×