Bohemia Interactive Forums  

Go Back   Bohemia Interactive Forums > BI MILITARY GAMES FORUMS > ARMA 2 EDITING > ArmA 2 & OA - MISSION EDITING & SCRIPTING

ArmA 2 & OA - MISSION EDITING & SCRIPTING For discussing the technical aspects of creating custom ArmA 2 & the standalone expansion Operation Arrowhead missions as well as scripting.

Reply
 
Thread Tools Display Modes
Old 06-04-2009, 11:15 AM   #1
norrin
First Sergeant
 
norrin's Avatar
 
Join Date: Aug 2006
Location: Melbourne, Australia
Posts: 936
Example scripts that use the attachTo command

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/at...nTop2.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:
Code:
 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



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/at...uck01.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:
Code:
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



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/at...les01.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:
Code:
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
Code:
_mountVcl attachTo [_vcl,[0,0,-2]];
in the mount_vcl.sqf which you can find in the mountOnC130 folder.



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/at...iDoor.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:
Code:
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

__________________

** [XDF] *** [PR] *** [ACE2] *** [AAW] **

Last edited by norrin; 06-08-2009 at 12:23 PM. Reason: New and updated scripts available
norrin is offline   Reply With Quote
Old 06-04-2009, 11:23 AM   #2
CarlGustaffa
Chief Warrant Officer
 
Join Date: Mar 2007
Location: Norway
Posts: 3,280
Do we have possibility to change the direction of the attached vehicle? Could allow some interresting towing effects.
__________________
Regards
Carl Gustaffa
CarlGustaffa is offline   Reply With Quote
Old 06-04-2009, 11:27 AM   #3
norrin
First Sergeant
 
norrin's Avatar
 
Join Date: Aug 2006
Location: Melbourne, Australia
Posts: 936
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.
__________________

** [XDF] *** [PR] *** [ACE2] *** [AAW] **
norrin is offline   Reply With Quote
Old 06-04-2009, 11:31 AM   #4
DaveP
Staff Sergeant
 
DaveP's Avatar
 
Join Date: Jun 2009
Location: SE UK
Posts: 211
Quote:
Originally Posted by CarlGustaffa View Post
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
DaveP is offline   Reply With Quote
Old 06-04-2009, 11:40 AM   #5
Sickboy
Second Lieutenant
 
Join Date: May 2005
Location: Netherlands
Posts: 4,846
Awesome, Norrin! Thanks for sharing.
__________________
Good night.
Sickboy is offline   Reply With Quote
Old 06-04-2009, 11:52 AM   #6
schaefsky
Sergeant
 
Join Date: Feb 2007
Posts: 124
Yeeeeeeeehaaaaaaah! Great, thank you very much!
schaefsky is offline   Reply With Quote
Old 06-04-2009, 11:56 AM   #7
Manzilla
Second Lieutenant
 
Manzilla's Avatar
 
Join Date: May 2007
Location: In the lab cooking up some serious s#%t!
Posts: 4,317
Excellent!
Manzilla is offline   Reply With Quote
Old 06-04-2009, 12:00 PM   #8
dale0404
Gunnery Sergeant
 
Join Date: Jun 2008
Posts: 475
Mission possibilities are endless!
dale0404 is offline   Reply With Quote
Old 06-04-2009, 01:00 PM   #9
Commando84
Chief Warrant Officer
 
Join Date: May 2003
Location: Sweden
Posts: 3,734
btw have any one tried with a ammo crate in a pick up? or a ural truck?
__________________
Commando84 is offline   Reply With Quote
Old 06-04-2009, 02:14 PM   #10
IceShade
Lance Corporal
 
IceShade's Avatar
 
Join Date: Apr 2004
Posts: 48
Quote:
Originally Posted by CarlGustaffa View Post
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).

Last edited by IceShade; 06-04-2009 at 02:18 PM.
IceShade is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:33 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.