Design Your Range - RaynorD/cav_ranges GitHub Wiki

Getting Started

Whether you are creating a range from scratch or applying the framework to an existing range, the first step is to design or write down some key specifications for your range. These can of course be easily changed later, but we need to refer to some of these terms in the next article as you setup the mission objects.

To get started, open init.sqf in the root of your mission folder. If it doesn't exist, simply create it there. Again ensure the extension is really .sqf, basic text editors will try to save it as init.sqf.txt, which Arma will ignore.

To give you a jumpstart, here's a template for the minimal function call:

[
    argument1, //Type
    argument2, //Title
    argument3, //Tag
    argument4, //Lane Count
    argument5, //Targets per Lane
    argument6  //Sequence
] call cav_ranges_fnc_createRange;

Rules

As you move forward, there are some rules to keep in mind for everything to work right.

  • All lanes must have the same number of targets. I recommend they are the same distance from the shooter but that is not required.
  • In the function call, if a value is optional and you don't need it, you must put nil in its place. The exception to this is if there are no later arguments you want to define. In that case you can simply leave it/them off.

Range Parameters

1 - Type

String, required

This value must be one of several strings, each of which represent a code module. There are currently two modules available:

  • "targets" - The usual practice range with targets that popup, and go down when they are hit. This type has a sequence, allowing you to raise targets sequentially, have the player engage each one, then tally the scores and show a qualification. Sequences and qualifications are both discussed more in depth later in this page.
  • "spawn" - This type was designed around an anti-tank range, but could be used for other purposes. The targets are some kind of killable object, like a tank. Upon killing one of the targets, the score is increased. There is no sequence with this type; the range is reset manually via action.

Because of this modularity, code for other modules with completely different behavior can be easily added down the road (which are planned).

2 - Title

String, required

This is simply the full name of the range as you want it to appear. "Rifle Range", for example.

3 - Tag

String, required

This is essentially the "variable" name of the range. It will be used in object names later, so keep it short. Maybe "rr" for rifle range, for example.

4 - Lane Count

Number, required

The number of lanes your range has.

5 - Targets per Lane

Number, required

The number of targets each lane of your range has.

6 - Sequence

Array, possibly optional

If you used the "spawn" range type, simply put nil for this value and skip to the next section. It is however required for "targets" type, since this is the whole point of the framework.

This is going to be a list of events which happen when your range is started. For each event, you specify two things: what happens and for how long. For example raise targets 4 and 6 for 5 seconds. You could also show a message on the range UI, such as "Reload your weapon" for 10 seconds.

This value will be an array. You would create the two events above like this, assuming that's all you wanted:

[
  [[4,6], 5],  
  ["Reload your weapon", 10]  
]  

A short grenade range example:

  [
    ["Ready your grenades",5],
    ["Range is hot!",2],
    [[1],15],
    [[2,3],15],
    [[4],15],
    [[5,6],15],
    [[7,8],15],
    ["Range complete.",1],
    ["Final scores:",0]
  ],

The sequence will execute each event with a short pause in between (configurable), then move to the next. When the last event is done, the targets will all be reset and it will award each lane with a qualification, as described next.

7 - Target Grouping

Not yet implemented, set to nil.

8 - Qualification Tiers

Array, optional

This is a list of numbers representing the different levels of qualification, depending on how well someone scored on the range. The awards currently mirror the US army's qualifications, in decreasing scores: expert, sharpshooter, marksman, no go. However this is configurable, and will be more easily so in a later update.

Once you know your range sequence, figure out how many total targets the player should have hit to earn each award. Expert being the highest, down to no go meaning they didn't pass.

Example using US army qualifications for their max score of 40:

[38,30,23]

Any score 38 or above gets expert, 30 to 37 gets sharpshooter, 23 to 29 gets marksman, and below 23 gets no go.

9 - Player Actions

Boolean, optional
When set to true, start and stop actions for this range will be added to instructor's collapsible scroll wheel menu.
actions

10 - Custom Texture

Boolean, optional
If true, popup targets on this range will be set to a custom black texture for better visibility against light terrain. The default texture is low resolution to avoid bloating the mission folder, but should look fine for distant targets. If your targets are very close, a larger high resolution texture is available in the optionalfolder. targets

Now you're ready to move on and Setup Mission Objects.