Jump to content
Sign in to follow this  
cookj71

BEGINNERS Scripting -ArmA- specific

Recommended Posts

First off.  I have found most of the entire forum and WIKI nothing but tools to further advance my frustration.  If you have too, then hopefully this finally changes things for you.

This is for NEW PEOPLE, which most of those here are so far removed they just can't grasp how far removed us new people are from their knowledge and expertise.

I'm going to teach by example and I don't know much  but I sure am having a blast creating simple missions on the fly.

I'm here to teach basic scripting within the in game editor.  Where all us newbies are at.  In fact I know nothing else, but this.

Refer to fasad 's WIKI entry about ArmA editor basics if my example throws you off.  Then ask questions here please. smile_o.gif

=fasad's WIKI: http://community.bistudio.com/wiki/ArmA:_Mission_Editor

==Creating a West Heavy Sniper==

Create your first Unit; this defaults to your playable character, who is also "bluefor"

Double click and open him up.

On the Inializatoin line enter the following script.  This will completely change out the gear of whatever type soldier you choose to play.  Do a preview before and after the script to see what it does.

==========

removeallweapons this; this addweapon "binocular"; this addweapon "nvgoggles"; this addweapon "m9sd"; this addweapon "m136";  this addmagazine "15rnd_9x19_m9"; this addmagazine "15rnd_9x19_m9"; this addmagazine "15rnd_9x19_m9"; this addmagazine "m136"; this addmagazine "m136"; this addweapon "M107"; this addmagazine "10rnd_127x99_m107"; this addmagazine "10rnd_127x99_m107"; this addmagazine "10rnd_127x99_m107"; this addmagazine "10rnd_127x99_m107"; this addmagazine "10rnd_127x99_m107"; this addmagazine "10rnd_127x99_m107"; this addmagazine "10rnd_127x99_m107";  this addmagazine "10rnd_127x99_m107";

===========

Now use the WIKI and goto the various script command lists.  I am hoping things start making sense and you can start building out whatever you want.

Advanced scripting involves manipulating varous text based files, which are directly outside of the in game Editor.  The scripting syntax in these files, is different than the game Editor, so this code does not direclty port.  If you are getting to this stage the different syntax should already be making sense to you. smile_o.gif

The WIKI does a good job of telling you what a specific command does but a terrible job of how to put said commands into action.

I'm a begginner I don't have anything else I can speak on due to lack of knowledge myself.

Share this post


Link to post
Share on other sites

awesome, I knew this for a while but my main problem now is I guess the structure of an script. for example, lets say you created a helo, an empy one and named it "helo1" and a pilot whose name is "pilot1". you want to tell pilot1 in the script to get in helo1, the only way I can do this is " pilot1 moveindriver helo1". but the funny thing  is, you dont see pilot1 walking to helo1, instead he spawns in the plane. I like real life like gaming, this spawning alienates me. the if condition command is also very usefull, but I do not know much about it. I recently tried this but for some reason the the unit named d1 keeps jumping to the last command

----------------------------------------------------

if (fuel (vehicle d1) == 0) then goto "Des" else goto "Dem"

#Des

dogetout d1

d1 domove getpos duh

Goto "Des"

#Dem

d1 domove getpos duh

exit

Share this post


Link to post
Share on other sites
awesome, I knew this for a while but my main problem now is I guess the structure of an script. for example, lets say you created a helo, an empy one and named it "helo1" and a pilot whose name is "pilot1". you want to tell pilot1 in the script to get in helo1, the only way I can do this is " pilot1 moveindriver helo1". but the funny thing  is, you dont see pilot1 walking to helo1, instead he spawns in the plane. I like real life like gaming, this spawning alienates me. the if condition command is also very usefull, but I do not know much about it. I recently tried this but for some reason the the unit named d1 keeps jumping to the last command

----------------------------------------------------

if (fuel (vehicle d1) == 0) then goto "Des" else goto "Dem"

#Des

dogetout d1

d1 domove getpos duh

Goto "Des"

#Dem

d1 domove getpos duh

exit

I think this might fix your problem:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (fuel (vehicle d1) == 0) then {goto "Des"} else {goto "Dem"}

Share this post


Link to post
Share on other sites

Thanks inqwiper, it works to an extent. the unit does get out but will get in the vehicle again, get out get in, get out get in in cycle, fails to carry the next command which is to get to "duh" position!

Share this post


Link to post
Share on other sites

Use "orderGetIn false" instead of "doGetOut", so that it becomes a command, rather than a temporary action.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _groupUnits = [WestUnit1, WestUnit2, WestUnit3];

//{ doGetOut _x } forEach _groupUnits;

_groupUnits orderGetIn false; // performs a permanent order - better than doGetOut

Share this post


Link to post
Share on other sites

If you dont want it to loop for 1 or 2 eternaties you should remove <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">goto "Des"

from <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#Des

dogetout d1

d1 domove getpos duh

Goto "Des"

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  

×