Jump to content

Photo
- - - - -

Example scripts that use the attachTo command


  • Please log in to reply
144 replies to this topic
Thread Starter
norrin
norrin

    Master Gunnery Sergeant

  • Members
  • 1129 posts

  • Joined: 30-August 2006

Posted 04 June 2009 - 11:15 #1

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/do...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

Posted Image

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/do...ruck01.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

Posted Image

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/do...ules01.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.

Posted Image

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/do...liDoor.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

Posted Image

Edited by norrin, 08 June 2009 - 12:23.
New and updated scripts available

Posted Image
**[XDF]*****************************[AAW]**

CarlGustaffa
CarlGustaffa

    Captain

  • Members
  • 6397 posts

  • Joined: 13-March 2007

Posted 04 June 2009 - 11:23 #2

Do we have possibility to change the direction of the attached vehicle? Could allow some interresting towing effects.
Regards
Carl Gustaffa - left this game due becoming Steam Exclusive :(

Thread Starter
norrin
norrin

    Master Gunnery Sergeant

  • Members
  • 1129 posts

  • Joined: 30-August 2006

Posted 04 June 2009 - 11:27 #3

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.
Posted Image
**[XDF]*****************************[AAW]**

DaveP
DaveP

    First Sergeant

  • Members
  • 835 posts

  • Joined: 01-June 2009

Posted 04 June 2009 - 11:31 #4

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

sickboy
sickboy

    Colonel

  • Members
  • 9947 posts

  • Joined: 11-May 2005

Posted 04 June 2009 - 11:40 #5

Awesome, Norrin! Thanks for sharing.

schaefsky
schaefsky

    Sergeant

  • Members
  • 121 posts

  • Joined: 05-February 2007

Posted 04 June 2009 - 11:52 #6

Yeeeeeeeehaaaaaaah! Great, thank you very much!

Manzilla
Manzilla

    First Lieutenant

  • Members
  • 5142 posts

  • Joined: 30-May 2007

Posted 04 June 2009 - 11:56 #7

Excellent!

dale0404
dale0404

    Warrant Officer

  • Members
  • 2472 posts

  • Joined: 02-June 2008

Posted 04 June 2009 - 12:00 #8

Mission possibilities are endless!
Posted Image

Commando84
Commando84

    Chief Warrant Officer

  • Members
  • 3727 posts

  • Joined: 09-May 2003

Posted 04 June 2009 - 13:00 #9

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

IceShade
IceShade

    Lance Corporal

  • Members
  • 48 posts

  • Joined: 11-April 2004

Posted 04 June 2009 - 14:14 #10

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, 04 June 2009 - 14:18.


bravo 6
bravo 6

    ArmAIII/OFP Fan

  • Members
  • 4499 posts

  • Joined: 01-August 2004

Posted 04 June 2009 - 14:38 #11

Great. As always!

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

Edited by bravo 6, 04 June 2009 - 14:39.
refrased


thegunnysgt
thegunnysgt

    Staff Sergeant

  • Members
  • 299 posts

  • Joined: 08-May 2007

Posted 04 June 2009 - 18:52 #12

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?
Posted Image

Thread Starter
norrin
norrin

    Master Gunnery Sergeant

  • Members
  • 1129 posts

  • Joined: 30-August 2006

Posted 05 June 2009 - 05:03 #13

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.
Posted Image
**[XDF]*****************************[AAW]**

schaefsky
schaefsky

    Sergeant

  • Members
  • 121 posts

  • Joined: 05-February 2007

Posted 05 June 2009 - 11:15 #14

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:

Thread Starter
norrin
norrin

    Master Gunnery Sergeant

  • Members
  • 1129 posts

  • Joined: 30-August 2006

Posted 08 June 2009 - 09:00 #15

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/do...ules01.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.

Posted Image

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, 08 June 2009 - 11:17.

Posted Image
**[XDF]*****************************[AAW]**

Thread Starter
norrin
norrin

    Master Gunnery Sergeant

  • Members
  • 1129 posts

  • Joined: 30-August 2006

Posted 08 June 2009 - 12:01 #16

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/do...liDoor.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

Posted Image

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.
Posted Image
**[XDF]*****************************[AAW]**

Imutep
Imutep

    Master Gunnery Sergeant

  • Members
  • 1365 posts

  • Joined: 07-February 2006

Posted 08 June 2009 - 17:48 #17

Great scripts norrin. Thx a lot ^^
Posted Image
Assault Mission Studio - German Mission Editing && Scripting Website

nullsystems
nullsystems

    Staff Sergeant

  • Members
  • 330 posts

  • Joined: 05-June 2007

Posted 08 June 2009 - 19:30 #18

Few examples, some silly ones.



vengeance1
vengeance1

    Master Gunnery Sergeant

  • Members
  • 1337 posts

  • Joined: 09-April 2007
  • LocationUSA

Posted 09 June 2009 - 01:39 #19

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

:)

dr_eyeball
dr_eyeball

    Master Sergeant

  • Members
  • 604 posts

  • Joined: 17-December 2005

Posted 09 June 2009 - 02:43 #20

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.

Posted Image
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, 26 January 2010 - 23:31.