Jump to content
Sign in to follow this  
BullyBoii

Scripts for newbies guide

Recommended Posts

Hey guys,

I thought it would be a good idea to create list of scripts that you can access in Arma 2 & OA mission editor for people who are new to scripting.

Basically, I would like you, the community, to post in any scripts you know along with what they do. It doesn't matter how complex or how simple they are, just send them in so I can create a massive list of scripts for everyone to use

I'll start the ball rolling,

This script sets the spawn hieght of an object -

this setPos [ getPos this select 0, getPos this select 1, ...] - the "..." can be replaced for any number

Thanks, hope this helps

Bully

Share this post


Link to post
Share on other sites

I use this to get the classname of an object. After 2s it will tell you the classname of an object and copy it to the clipboard:

0 = this spawn { waitUntil {time > 2}; _cName = typeOf _this; hint _cName; copyToClipboard _cName;};

Share this post


Link to post
Share on other sites
Hey guys,

I thought it would be a good idea to create list of scripts that you can access in Arma 2 & OA mission editor for people who are new to scripting.

Basically, I would like you, the community, to post in any scripts you know along with what they do. It doesn't matter how complex or how simple they are, just send them in so I can create a massive list of scripts for everyone to use

I'll start the ball rolling,

This script sets the spawn hieght of an object -

this setPos [ getPos this select 0, getPos this select 1, ...] - the "..." can be replaced for any number

Thanks, hope this helps

Bully

Hey I had the same idea a few months ago. Here are some basic one's that people help me. It would be nice if others post there lists

ARMA2 CODES AND triggers

1. to place units in buildings (.1 is ground floor)

this setpos [(getpos this select 0), (getpos this select 1), .1]

this setpos [ (getpos this select 0), (getpos this select 1), (getpos this select 2)+.2]

this setpos [(getpos this) select 0, (getpos this) select 1, 0]

2.To Place ships on water level

this setpos [position this select 0, position this select 1, 0]

3. This will create the aircraft carrier anywhere you wish.

place this in the inti box of any object- res=[this]execVM"CreateLHD.sqf";

you must have the createLHD SCRIPT/SQF in your mission folder.

4. Unlimited ammo for a unit. This will not work for a respawn unit!

this addEventHandler ["Fired",{(_this select 0) setVehicleAmmo 1}]

5. AI will not shoot at you

this setCaptive true;

6. To have engines of at start of game

this engineOn false

7. to setup air units height in metres.

this flyinheight

8. Add a backpack and ammo to a unit

this addbackpack [“US_Backpack_AT_EP1â€]

this addBackpack "TK_RPG_Backpack_EP1"

(unitBackpack this) addMagazineCargo ["nameofmagazine",#];

Add ammo to a backpack

clearMagazineCargo unitBackpack this; (unitBackpack this) addMagazineCargo ["Pipebomb",3]

9. To add/remove items from a unit layout

removeAllWeapons this;

this addWeapon "Binocular"; this addWeapon "LaserDesignator";

this addMagazine "LaserBatteries";

10. To add/remove items from a crate/vechical

removeAllWeaponsCargo this

clearMagazineCargo this

this addWeaponCargo ["CLASSNAME", #];

this addMagazineCargo ["CLASSNAME", #]

I will add more I have some different lists.

Share this post


Link to post
Share on other sites

Heres some handy ones from me;

AttachTo

Unit AttachTo [anotherunit];

This simply Attaches one unit or object to another.

Unit attachTo [anotherunit,[0,0,1]]; 

This Allows you to join 2 units. the 0,0,1 Are XYZ coordinates RELATIVE to the center of the object you are attaching TO. This is handy when you need to attach object in a certain way

Adding Weapons to a Vehicle (and Ammo)

Simply enter in Vehicle Init;

(unit name) AddWeaponCargo [M16A2, 50]
-or-
This AddWeaponCargo [M16A2, 50]

The first examle is good when you want to add Weapons to a vehicle via a script or trigger. In my example we Added 50 M16A2's. the second one can be put directly into the vehicle's init.

THIS DOES NOT INCLUDE AMMO FOR THE GUNS, to do that...

This(or unit name) AddMagazineCargo [30Rnd_556x54_Stanag, 50]

This will add 50 magazines.

Heres a Complete List of possible weapons and images of them:

http://browser.dev-heaven.net/cfg_weapons/classlist?version=37

It Also Includes Ammo and magazine classes

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  

×