Forum Jump :

Author Message


Posts: 1
Rank:


Level: Member

Country: hr
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2017-10-31 03:11        
     
Hello everyone,
Ive been playing arma for a very long time but this is my first post so please,
Please take this with a grain of salt, I have no experience in scripting arma
or programming in anything.

I couldn't find a tutorial online on how to get this done simply
so after some playing with scripts and commands I've came up with this tutorial
in hope it will be of use to someone.

Simple tutorial on spawning units with trigger.
Useful for conserving performance while making big scenarios.
Units don't spawn until triggered.

In this tutorial I will cover:

-Spawning multiple groups with custom loadouts from Virtual Arsenal when triggered.
-Spawning pre-defined units from the game when triggered.
-Spawning custom reinforcements on yourself.
-Waypoints.
-Copying groups.

_____________________________________________________

1. Extracting and 'trimming' your loadout code

-Create a custom loadout in Virtual Arsenal
-Click Extract in the bottom of the screen.
-Now you loadout config is copied to your clipboard.
-Open notepad and paste this
-In Notepad's toolbar click Edit > Replace
-Type in Find what:["] // for the commands to work we need to replace double quotations
Replace with:['] // from the copied loadout with single quotations
-Click Replace All, then Cancel.

_____________________________________________________
2. Assigning units to groups with notepad.

Above the line

" comment 'Exported from Arsenal by ... ' "

paste this template so it looks like this:


_group1 = createGroup west; // '_group1' being your first group and 'west' being their faction

"O_Soldier_F" createUnit [getMarkerPos "spawn1", _group1, //"O_Soldier_F" soldier classname who we will
//strip down and reequip
//'spawn1' will be the name of the marker
// where the group will spawn

"
comment 'Exported from Arsenal by ...';

comment 'Remove existing items';
removeAllWeapons this;
...
this setFace 'WhiteHead_19';
this setSpeaker 'rhs_male03cz';

"
// now add the rest to the bottom of the code
, 0.9, "SERGEANT"];
// here we are closing the createUnit line which is written in form
// unitType createUnit [position, group, init, skill, rank];
_____________________________________________________

3. Spawning first unit

Open the editor and place a marker.
In the variable name type "spawn1". //this is your first spawn location for group1

For testing the trigger just set it to activate by radio alpha

In the "On Activation" fied paste the code from the notepad

Go ahead run the scenario, press that radio alpha button and see how it works.
A unit with your custom loadout should spawn on the markers location

_____________________________________________________
4. Adding more units to the group.

If you want you can add more units to the group with different loadouts.

Beware that if you're using a new loadout extracted from the Virtual Arsenal
you will need to paste it in a seperate notepad file and "trim"
the double quotations again like explained in 1st step.

Remember where the code in notepad ended

"

, 0.9, "SERGEANT"]; // below that type in again:



"O_Soldier_F" createUnit [getMarkerPos "spawn1", _group1,

"
comment 'Exported from Arsenal by ...';

comment 'Remove existing items';
removeAllWeapons this;
...

// and so on you continue adding units and pasting the whole code
in the 'On Activation' field of the trigger

_____________________________________________________

5. Spawning pre-defined units from the game (no custome loadout - easy)

copy this and paste it in the trigger On Activation field,
make sure your spawn marker is named 'spawn33' - or rename it in the code.


_group33 = createGroup east;

"O_Soldier_F" createUnit [getMarkerPos "spawn33", _group33, "", 0.6, "PRIVATE"];

// this code will spawn a CSAT soldier on marker spawn33 when trigger is activated.

_____________________________________________________


6. Spawning custom reinforcements on yourself (player)

Create a trigger with size x=0 y=0
Set the trigger to be activated by radio
Use this template with your classnames and paste it into triggers 'On Activation' field.
Tick the 'Repeatable' box in the trigger. //To spawn multiple units just call on the radio again.


"O_Soldier_F" createUnit [ position player, group player,

"

comment 'Exported from Arsenal by ...';

comment 'Remove existing items';
removeAllWeapons this;
...
this setFace 'WhiteHead_19';
this setSpeaker 'rhs_male03cz';

"

, 0.9, "SERGEANT"];

_____________________________________________________

7. Waypoints

To set a waypoint for freshly spawned troops use this template

_group1 = createGroup east;

_wp1 = _group1 addWaypoint [getMarkerPos "obj1", 50]; // [marker variable name is the waypoint, completion radius]
_wp1 setWaypointType "SAD"; // 'SAD' = Seek and Destroy, you can use "MOVE" etc.
_wp1 setWaypointBehaviour "AWARE";

"O_Soldier_F" createUnit [getMarkerPos "spawn1", group1,

"
comment.......

_____________________________________________________

8. Copying groups

If you want to make multiple groups activated by a trigger here's a simple way to do it.

Copy and paste the whole group's config into another notepad file.

In notepad's toolbar click Edit>Replace

replace group1 with group2, spawn1 with spawn2, wp1 with wp2 etc...

Just make sure to make new markers named spawn2 etc...

_____________________________________________________

That's all for now

Hope it helped someone!