Jump to content

Toggle shoutbox Shoutbox Open the Shoutbox in a popup

@  Kingcraft111 : (27 November 2014 - 08:39 AM) happy Turkey Day
@  =GEN=Rebeljohn : (27 November 2014 - 08:48 AM) HAPPY HAPPY TURKEY DAY !!! one of my best day of the yr !!!!
@  =GEN=Yoursister : (27 November 2014 - 09:07 AM) Happy thanksgiving to all.
@  =GEN=McSpuds : (27 November 2014 - 10:17 AM) Happy Turkey Day!
@  =GEN=Runez : (27 November 2014 - 01:11 PM) Happy Thanksgiving to all in the US!
@  =GEN=Jinx : (27 November 2014 - 05:42 PM) Morning Gens, Happy Thanksgiving to you mericans! Have a safe and happy holiday
@  =GEN=Boris666 : (27 November 2014 - 07:53 PM) Happy Turkey day
@  =GEN=Jinx : (27 November 2014 - 09:25 PM) BF4 Fun night this saturday post of in the thread if you can make it
@  =GEN=Cappy : (28 November 2014 - 04:07 AM) Eveing all, happy bird eating day.. Jinx hope u where not affected by that storm, looked a doozy
@  =GEN=Jinx : (28 November 2014 - 05:58 AM) On for some BF4 if any one around, No Cappy just heavy rain for us!!
@  =GEN=Lead_Ma... : (28 November 2014 - 08:21 AM) McSpuds, where's my fun night ribbon, get on it, lol lol lol, you've created a monster
@  =GEN=Yoursister : (28 November 2014 - 09:08 AM) morning alll
@  =GEN=McSpuds : (28 November 2014 - 09:21 AM) it's on your bar... http://www.cartoonge...ted-salad-bars/
@  =GEN=Yoursister : (28 November 2014 - 01:50 PM) gotta love next day chocolate silk pie.
@  =GEN=McSpuds : (28 November 2014 - 03:52 PM) I'm still in a turkey coma
@  =GEN=Steelha... : (28 November 2014 - 04:02 PM) Meat sweats
@  =GEN=Waffenb... : (28 November 2014 - 05:26 PM) hello all
@  =GEN=Hodgy : (28 November 2014 - 07:49 PM) Looking forward to some bf4 tonight... :)
@  =GEN=Vamp : (28 November 2014 - 07:52 PM) Yo all
@  =GEN=Whisky73 : (28 November 2014 - 08:10 PM) Sup guys

Photo

[TUTORIAL] Arma 3 Mission Creation and Scripting Resources


  • Please log in to reply
18 replies to this topic

#1
=GEN=GoldenGlovez

=GEN=GoldenGlovez
  • Nerd Herder
  • 22 posts
  • Steam ID:GoldenGlovez
  • LocationSomewhere in the world
Put together a small list of resources for people who want to start making missions in Arma 3.

----------------------------------------------------------------------
Getting Started:

Jester814's Tutorials: http://forums.bistud...Simple-Missions

TheSWISSMaverick's Tutorials: http://www.youtube.c...1A3FH0HlVijkNuP

List of Arma3's Scripting Commands (Universal across all Arma games): http://community.bis...Commands_Arma_3

List of Arma3's New Scripting Commands (A3 Only): http://community.bis...g_Commands_List

Addons/Tools/Various Scripts: http://www.armaholic...p?c=arma3_files

Arma3 Bug Reporting (Useful for answering questions such as, Is this parachute broken or is just me?): http://feedback.arma...ll_bug_page.php

BI Studio Mission Editing and Scripting Forum: http://forums.bistud...G-amp-SCRIPTING

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

I'm going to post a few scripts I've created, used, and/or modified in my madness to make a properly working MP mission for the clan. If you guys/gals have any additions to make to the above resources, that would be great!
----------------------------------------------------------------------
The isServer Command...

I'm putting this up top as this is one of the most important commands to know when creating missions for multiplayer.

The problem with creating objects using scripts is that it'll work perfectly in the editor, but once you bring it over to multiplayer it goes haywire! The issue is that a fair number of commands will run globaly on each machine connected to the server. This can cause duplication errors, especially with the createVehicle command.

Here's what I used to create a Diesel Powerplant in game, using a Game Logic placement with the following Init line:
powerplant1 = "Land_dp_bigTank_f" createVehicle position this;

Now this works great in singleplayer or the editor. However, when we go over to multiplayer, this command will run on EACH connected players machine. I'm sure you can see how this will be a problem, and it creates a powerplant at the position for every player connected (including the server). So how do we fix this? The isServer command.

Using this command we will check if it's the server executing the command, and if so the command will execute. If it is NOT the server, the script will do nothing (stopping clients from executing it).

Example:
if (isServer) then {powerplant1 = "Land_dp_bigTank_f" createVehicle position this};

Problem solved! This command is a must for executing scripts in multiplayer that do not need to be pushed by every client.

if (isServer) then {
your code goes here!
};

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

Big Boom:
This is used for creating massive explosions when a trigger is fired. The code needs to be edited slightly to make it work for your map. The two parts to change are _area and _houses (this is to destroy objects outside of the explosion).
Posted Image

Save the following code as bigboom.sqf in your Arma3 Mission Folder
//Change the marker names to markers you have placed on the mission map, this is the locations your bombs will go off
_area = ["marker1","marker2","marker3","etc.."];

_ammo = [
"Bo_GBU12_LGB_MI10",
"Sh_120_HE",
"HelicopterExploBig",
"Bo_GBU12_LGB",
"Bo_Mk82",
"HelicopterExploBig",
"Bo_Mk82",
"Bo_Mk82",
"Bo_GBU12_LGB_MI10",
"Sh_120_HE",
"HelicopterExploBig",
"Bo_GBU12_LGB"
];

_count = 0;
for "_i" from 0 to (count _ammo) do {
for "_j" from 0 to 1 do {
switch (_j) do
{ case 0: {if (random 1 == 1) then {_xVel = -1*_xVel }};
case 1: {if (random 1 == 1) then {_yVel = -1*_yVel }};
}; 
}; _chosen = (_ammo select _i);
{ _xVel = random 10;
_yVel = random 10;
_zVel = random 20;
_xCoord = random 15;
_yCoord = random 15;
_zCoord = random 2;
_bomb = _chosen createVehicle getMarkerPos _x;
_bomb setPos [(getPos _bomb select 0)+_xCoord,(getPos _bomb select 1)+_yCoord, _zCoord*_i];
_bomb setVelocity [_xVel,_yVel,_zVel-50]; 
} forEach _area; sleep 1;
addCamShake [1+random 5,1+random 3, 5+random 15];
};

//destroying target - Uncomment these lines to destroy objects designated with the names given in _houses
//_houses = ["buildingname1","buildingname2","etc..."];
//{_x setDamage 1} forEach _houses;

Execute the script by placing the following script in the On Act of your trigger:
boom = [] execVM "bigboom.sqf";

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

Lights out for Agia Marina

Want to turn off all the lights in and around Agia Marina? I spent the better part of a day putting this together (although I'm sure theres an easier way, some of other options don't work in game yet). Save the following code as blackout.sqf in your mission folder

Before:
Posted Image
After:
Posted Image

UPDATED: July 3rd, 2013 - I've extremely simplified this code into three parts. The following code will turn off all the lights from Agia Marina to Stratis Airbase. You can reduce the range by changing the number "1200" to the desired radius. (You can use radius 600 and place the marker in the middle of Agia Marina, to only turn off lights in the city)
Put the following code in either a script.sqf of a game logic in the mission editor
lightsout1 = nearestObjects [getMarkerPos "lightsout", ["Land_powerpolewooden_l_F","Land_lampdecor_f","Land_LampHalogen_F","Land_LampStreet_Small_F","Land_LampHarbour_F","Land_LampStreet_F","Land_LampShabby_F"], 1200];

Create a marker named "lightsout" somewhere near Agia Marina.

Place the following code in a trigger or script.sqf (and call the script with a trigger)
{_x setHit ["light_1_hitpoint",1]} forEach lightsout1;
{_x setHit ["light_2_hitpoint",1]} forEach lightsout1;
{_x setHit ["light_3_hitpoint",1]} forEach lightsout1;
{_x setHit ["light_4_hitpoint",1]} forEach lightsout1;

Then activate the code using a trigger with On Act set to:
blackout = [] execVM "blackout.sqf";

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

Stopwatch Script

Found this code for Arma 2, modified it to work for Arma 3 and added a bit (messages now include minutes when seconds lapse over 60). This will show a visible timer on the bottom center of the screen.

Two parts required.. First is create a file called client.sqf with the following code:
broadcast = "";

GlobalMsg =
{
	titleText [format ["%1",broadcast],"plain down",0.1];
	broadcast = "";
};

for [{_loop=0}, {_loop<1}, {_loop=_loop}] do
{	
	sleep 0.1;
	if (broadcast != "") then {[] call GlobalMsg};
};

Second, create a file called stopwatch.sqf with the following code:
seconds=0;
minutes=0;
mintext = "minute";
sectext = "second";
runStopwatch = true;

while {runStopwatch} do
{
	if (minutes > 0) then {broadcast = format["%1 %2 %3 %4",minutes,mintext,seconds,sectext]} else {broadcast = format["%1 %2",seconds,sectext]};
	publicVariable "broadcast";
	sleep 0.1;
	if (seconds > 59.9) then {minutes = minutes + 1; seconds = 0;} else {seconds = seconds + 0.1};
	if (minutes > 1) then {mintext = "minutes"};
	if (seconds > 1) then {sectext = "seconds"} else {sectext ="second"};
};

You need to add the following to your player's INIT line: client = [] execVM "client.sqf";
Second the following to a trigger you want to activate the timer: timer = [] execVM "stopwatch.sqf";
Finally add the following script to the trigger OnACT you want to stop the count:
runStopwatch=false;
if (minutes > 0) then {broadcast=format["%1 took %2 %3 and %4 %5", this, minutes, mintext, seconds, sectext]} else {broadcast=format["%1 took %2 second(s)", this, seconds]};
publicVariable "broadcast";

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

Mobile Ammobox

Want to add a ammo crate to the back of a truck? So did I! You can even drive the truck around and it'll sit happily in the back (could use this for VAC as well I'm sure, and to have reinforcements deliver ammo etc).

Posted Image

To do this is simple.

1. Create a civilian offroad vehicle and give it a name.

2. Create the ammo box you want to place inside the truck.

Place the following code in the INIT line of the ammobox (Change "supplycar" to whatever you name your vehicle)
this attachTo [supplycar,[0,-1.8,-0.7]]; this setDir 90; this setpos getpos this;

This should give you a good example of using the attachTo and setDir scripting commands.

----------------------------------------------------------------------
Checking what vehicle a unit is assigned (and performing a function if true)

On the mission I've been working on, I wrote a code that forces players to eject from the helicopter at a specific time (using the moveOut command). I found that if a player ejects before the command is issued and opens their parachute, once the command activates, it'll destroy the parachute. So I need to check if the vehicle the player is in is the helicopter, and if not then do nothing. Easy enough.

whatvehicle = assignedVehicle p1;
if (whatvehicle == h1) then {moveOut p1};

Breakdown of the variables...

whatvehicle is the variable we'll assign the result of which vehicle the unit named "p1" is currently assigned to.
h1 is the name of the helicopter
p1 is the name of the unit
I'm sure you can tell what it does from there...

You could also use the "else" command to run a code if the vehicle the player is in, is NOT the helicopter. For example:

whatvehicle = assignedVehicle p1;
if (whatvehicle == h1) then {moveOut p1} else {hintSilent "Player is NOT in the helicopter!"};
----------------------------------------------------------------------

Turning damage on/off for multiple units

Want to disable damage for multiple units? Use this:

_team1 = [p1,p2,p3,p4,p5,p6,p7,p8];
{_x allowDamage false} forEach _team1;

p1,p2,p3,etc are the names assigned to each unit, you can add/remove as needed.

Turning damage back on is done simply with:

_team1 = [p1,p2,p3,p4,p5,p6,p7,p8];
{_x allowDamage true} forEach _team1;

Turning damage on/off for a single unit is done with: "unitname allowDamage true;" OR "unitname allowDamage false;"

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

Scripted Helicopter Jumps

Been working on this one a bit. Wanted a team of 8 to eject out of a helicopter and parachute to the ground. First problem was for some reason you will take damage half the time when ejecting from the heli at height. Second was the issue of deleting the parachute if the player ejected before the script moved him out of the heli. So I put this together, which disables damage on all players, moves them out of the vehicle IF that vehicle is the helicopter, then re-enables damage on the player. Check it out:

_team1 = [p1,p2,p3,p4,p5,p6,p7,p8];
{_x allowDamage false} forEach _team1;

sleep 2;
isthisheli = assignedVehicle p8;
if (isthisheli == h1) then {moveOut p8};

sleep 2;
isthisheli = assignedVehicle p7;
if (isthisheli == h1) then {moveOut p7};
p8 allowDamage true;

sleep 2;
isthisheli = assignedVehicle p6;
if (isthisheli == h1) then {moveOut p6};
p7 allowDamage true;

sleep 2;
isthisheli = assignedVehicle p5;
if (isthisheli == h1) then {moveOut p5};
p6 allowDamage true;

sleep 2;
isthisheli = assignedVehicle p4;
if (isthisheli == h1) then {moveOut p4};
p5 allowDamage true;

sleep 2;
isthisheli = assignedVehicle p3;
if (isthisheli == h1) then {moveOut p3};
p4 allowDamage true;

sleep 2;
isthisheli = assignedVehicle p2;
if (isthisheli == h1) then {moveOut p2};
p3 allowDamage true;

sleep 2;
isthisheli = assignedVehicle p1;
if (isthisheli == h1) then {moveOut p1};
p2 allowDamage true;
sleep 2;
p1 allowDamage true;

You can save this as helijump.sqf in your mission folder, and execute it on trigger with: helijump = [] execVM "helijump.sqf";
Make sure to name your helicopter "h1" and your squad units p1 through p8 or change the script to fit as needed.

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

Edited by =GEN=GoldenGlovez.pro, 02 July 2013 - 05:14 PM.


#2
=GEN=Blackbox

=GEN=Blackbox
  • Animation Studio
  • 428 posts
Great Work Glovez! Pinned and changed topic slightly to reflect the post :)
Posted Image

#3
=GEN=Cappy

=GEN=Cappy

    Founding Member

  • Toontown War Council
  • 3,636 posts
  • Steam ID:Cappy
  • LocationSydney Aust
Very handy indeed

cappy.png

 

cappy.png


#4
=GEN=Hodgy

=GEN=Hodgy
  • Nerd Herder
  • 1,821 posts
  • Steam ID:Hodgy1971
  • LocationChina

Some tools you may find helpful



PBO Manager



Arma Edit


Edited by =GEN=Hodgy, 30 June 2013 - 08:13 PM.

Posted Image


#5
=GEN=Witek

=GEN=Witek
  • Toontown Sheriff dept.
  • 257 posts
  • Steam ID:witekdnb
  • LocationOkinawa
Epic!
Posted Image Posted Image

#6
=GEN=Timberwolf

=GEN=Timberwolf
  • Nerd Herder
  • 863 posts
  • Steam ID:Timberwolf516
  • LocationNew Zealand
Love the portable ammo resup.
Posted Image

#7
=GEN=GoldenGlovez

=GEN=GoldenGlovez
  • Nerd Herder
  • 22 posts
  • Steam ID:GoldenGlovez
  • LocationSomewhere in the world
I've updated the script for turning lights off in Agia Marina. Much cleaner with a lot less lines of code (and less likely to break with a significant Arma3 update). You can see the changes in the OP.

#8
=GEN=GoldenGlovez

=GEN=GoldenGlovez
  • Nerd Herder
  • 22 posts
  • Steam ID:GoldenGlovez
  • LocationSomewhere in the world
Synchronizing Objectives for JIP Players

!!! This is a work in progress !!!
Updated July 5th, 2013

This is currently working, but I'm still tweaking this and learning how to best implement. The following tutorial will explain how to create objectives in game and synchronize which objectives have been completed and what the current objective is to players who join in late to the game. There are multiple parts to this, so follow along closely.

Step #1: Defining the definitions for bis_fnc_showNotification;

This is to define the template and styles for the notifications which appear when an objective has been completed. (This is a work in progress, more to come soon)

Place the following code in "description.ext" in your mission folder.

class CfgNotifications
{
	class Default
	{
		title = ""; // Tile displayed as text on black background. Filled by arguments.
		iconPicture = ""; // Small icon displayed in left part. Colored by "color", filled by arguments.
		iconText = ""; // Short text displayed over the icon. Colored by "color", filled by arguments.
		description = ""; // Brief description displayed as structured text. Colored by "color", filled by arguments.
		color[] = {1,1,1,1}; // Icon and text color
		duration = 5; // How many seconds will the notification be displayed
		priority = 0; // Priority; higher number = more important; tasks in queue are selected by priority
		difficulty[] = {}; // Required difficulty settings. All listed difficulties has to be enabled
	};
 
	// Examples
	class TaskAssigned
	{
		title = "TASK ASSIGNED";
		iconPicture = "\A3\ui_f\data\map\mapcontrol\taskIcon_ca.paa";
		description = "%1";
		priority = 2;
	};
	
		class TaskSucceeded
	{
		title = "%1";
		iconPicture = "\A3\ui_f\data\map\mapcontrol\taskIcondone_ca.paa";
		color[] = {0.600000,0.839215,0.466666,1};
		description = "%2";
		priority = 4;
	};
	
};

Step #2: Creating the Objectives via Script

Next up is creating the objectives by script (I will explain in detail what to change and how)... Create the following code in "briefing.sqf" (this can be in any SQF but for posterity we'll use briefing)

task1 = player createSimpleTask ["Approach the first Trigger"];
task1 setSimpleTaskDescription ["Today you have to approach the trigger.", "Test Mission 1", "The trigger is here!"];
task1 setSimpleTaskDestination (getMarkerPos "testtask1");
task1 setTaskState "Assigned";
player setCurrentTask task1;
if (obj1 == "true") then {task1 setTaskState "Succeeded"};

if (obj1 == "true") then {
task2 = player createSimpleTask ["taskName2"];
task2 setSimpleTaskDescription ["Another task has been issued...","Another Example Task","The Trigger is now here!"];
task2 setSimpleTaskDestination (getMarkerPos "testtask2");
task2 setTaskState "Assigned";
player setCurrentTask task2;
};

if (obj2 == "true") then {task2 setTaskState "Succeeded"};

if (obj2 == "true") then {
task3 = player createSimpleTask ["taskName3"];
task3 setSimpleTaskDescription ["Once again...","And Another Example Task","And now the trigger is here!"];
task3 setSimpleTaskDestination (getMarkerPos "testtask3");
task3 setTaskState "Assigned";
player setCurrentTask task3;
};

if (obj3 == "true") then {task3 setTaskState "Succeeded"};

Step #3: Check when a new player has connected and execute briefing.sqf once that player has been verified

This code will be placed in your "init.sqf". In a nutshell, when a player connects the init.sqf will check and wait until the player has fully joined the server, once this happens it'll execute the briefing.sqf on their machine.

if ( (!isServer) && (player != player) ) then
{
waitUntil {player == player};
waitUntil {time > 10};
};

if !(isnull player) then {
null = [] execvm "briefing.sqf";
};

Step #4: Create the objective destination markers

Put down 3 markers named "testtask1", "testtask2", and "testtask3" on the map. These markers should be located near your triggers (or objective) which completes and activates the next part


Step #5: Placing your objective activation trigger

You will now need to create multiple triggers which will complete the current objective and assign the next objective. Here are the examples for the three objectives outline in "briefing.sqf".

Trigger 1:
if (isNil "obj1") then {
task1 setTaskState "Succeeded";
["TaskSucceeded",["Test Title","Test Description"]] call bis_fnc_showNotification;
task2 = player createSimpleTask ["taskName2"];
task2 setSimpleTaskDescription ["Another task has been issued...","Another Example Task",""];
task2 setSimpleTaskDestination (getMarkerPos "testtask2");
task2 setTaskState "Assigned";
player setCurrentTask task2;
obj1 = "true";
publicVariable "obj1";
};

Trigger 2:
if (isNil "obj2") then {
if (obj1 == "true") then {
task2 setTaskState "Succeeded";
["TaskSucceeded",["Test Title2","Test Description2"]] call bis_fnc_showNotification;
task3 = player createSimpleTask ["taskName3"];
task3 setSimpleTaskDescription ["Once again...","And Another Example Task",""];
task3 setSimpleTaskDestination (getMarkerPos "testtask3");
task3 setTaskState "Assigned";
player setCurrentTask task3;
obj2 = "true";
publicVariable "obj2";
};
};

Trigger 3:
if (isNil "obj3") then {
if (obj2 == "true") then {
task3 setTaskState "Succeeded";
["TaskSucceeded",["Test Title3","Test Description3"]] call bis_fnc_showNotification;
obj3 = "true";
publicVariable "obj3";
};
};

Edited by =GEN=GoldenGlovez.pro, 05 July 2013 - 03:03 AM.


#9
=GEN=GoldenGlovez

=GEN=GoldenGlovez
  • Nerd Herder
  • 22 posts
  • Steam ID:GoldenGlovez
  • LocationSomewhere in the world
Activating triggers based on z Axis of the current player

This script I've been working on will cause different actions to happen based on the current players Z Axis (or Height) position. This is so I can execute multiple functions based on their height. Helpful if you want to activate a trigger underneath a player when they are freefalling/parachuting to the ground.

Place the following code in "testdrop.sqf"

disloop1 = "true";

while {(disloop1 == "true")} do {
sleep 0.1;
_zLevel = (getPosATL player) select 2;
_zStatus = (assignedVehicleRole player) select 0;

	switch(true) do {

		case (_zLevel < 300 && isNil "_zStatus" && isNil "zLevel1"): {
		hint "Open your parachute, Soldier!";
		zLevel1 = "false";
		};
		
		case (_zLevel < 300 && _zStatus == "Driver" && isNil "zLevel1"): {
		hint "Parachute is open!";
		zLevel1 = "false";
		};

		case (_zLevel < 100 && isNil "zLevel2"): {
		hint "100 Meters till LZ";
		zLevel2 = "false";
		};
		
		case (_zLevel < 1 && isNil "zLevel3"): {
		hint "Successful Landing!";
		zLevel3 = "false";
		disloop1 = "false";
		};
		
		
	};

};

Execute the script from a trigger using: testdrop = [] execVM "testdrop.sqf";

What this script will do is continually check a players height. At 300 meters it'll check if the player is still free falling, if so it'll give a hint saying "Open your parachute, Soldier!". However, if the parachute is already opened, it'll give a hint saying "Parachute is open!". Then it'll check once the player has reached 100m in height, then give a hint saying "100 Meters till LZ". Finally, it'll check once the player has reached the ground (or under 1 meter) and give a hint saying "Successful Landing!". The script/loop will then exit.

#10
=GEN=Witek

=GEN=Witek
  • Toontown Sheriff dept.
  • 257 posts
  • Steam ID:witekdnb
  • LocationOkinawa
Sick.. Will try this tomorrow..

Do you think game updates will affect this?

Edited by =GEN=Witek, 03 July 2013 - 11:32 AM.

Posted Image Posted Image

#11
=GEN=Hodgy

=GEN=Hodgy
  • Nerd Herder
  • 1,821 posts
  • Steam ID:Hodgy1971
  • LocationChina
Yes sometime game updates will effect. But its only a matter of finding the code that has been changed and fixing it. Also now we are in Beta game breaking updates should slow down a little. BI have already said they will reduce the amount of class changes.

Posted Image


#12
=GEN=GoldenGlovez

=GEN=GoldenGlovez
  • Nerd Herder
  • 22 posts
  • Steam ID:GoldenGlovez
  • LocationSomewhere in the world

Sick.. Will try this tomorrow..

Do you think game updates will affect this?


As Hodgy already pointed out, some stuff can break if BI decides to update object names again in the future. For the scripts that don't rely on object names, the chances of them breaking are less likely as I doubt they'll make significant changes to the various scripting syntax's.

#13
=GEN=GoldenGlovez

=GEN=GoldenGlovez
  • Nerd Herder
  • 22 posts
  • Steam ID:GoldenGlovez
  • LocationSomewhere in the world
Hey guys, been awhile since I updated. I've still been working on learning the Arma 3 scripting system in my limited spare time. Here is a piece I've been working on...

It'll spawn enemy groups dynamically once a specific condition has been met, it'll also assign them to 'Search and Destroy' a location after a period of time. It also includes a few other functions for demo purposes. I've been trying to utilize the BNS_fnc commands more often as they're better optimized for code. As always, if you have any questions feel free to ask away!

//Check if this is the server side executing script - Necessary to prevent multiple spawns for each client
if (isServer) then {

//Assign variables
_units = [];
_group = floor(random 4);
_assaultgroup1count = 0;
_minunitscount = 0;

//Randomize possible group spawns
    switch (_group) do { 
        case 0: {_units = ["O_Soldier_F", "O_Soldier_GL_F", "O_Soldier_M_F", "O_Soldier_AR_F", "O_Soldier_F", "O_Soldier_GL_F"];}; 
        case 1: {_units = ["O_Soldier_F", "O_Soldier_GL_F", "O_Soldier_M_F", "O_Soldier_F", "O_Soldier_GL_F", "O_Soldier_M_F"];}; 
        case 2: {_units = ["O_Soldier_F", "O_Soldier_GL_F", "O_Soldier_F", "O_Soldier_GL_F", "O_Soldier_M_F", "O_Soldier_AR_F"];}; 
        case 3: {_units = ["O_Soldier_F", "O_Soldier_F", "O_Soldier_GL_F", "O_Soldier_M_F", "O_Soldier_AR_F", "O_Soldier_F"];}; 
    }; 
	
/*Event Trigger - Removed and placed in the OnACT of a trigger in editor
	waitUntil {
	sleep 0.1;
	triggerActivated assault1;
	};	
*/

//Count how many units are in _group
_minunitscount = (count _units);

//Create first assault group
_assaultgroup1 = [getMarkerPos "enemyspawn1", east, _units, [],[],[0.5,0.8],[],_minunitscount,250] call BIS_fnc_spawnGroup;

//Assign first assault group to array	
_assaultarray1 = units _assaultgroup1;

//Force first assault group into prone position and unable to move
	{
	_x setUnitPos "DOWN";
	_x disableAI "MOVE";
	} forEach _assaultarray1;

//Wait and then enable movement and stance changes after 30 seconds
	sleep 30;
	{
	_x enableAI "MOVE";
	_x setUnitPos "AUTO";
	} forEach _assaultarray1;

//Assign assault task for first assault group
[_assaultgroup1, getMarkerPos "attack1"] call BIS_fnc_taskAttack;

//Wait until first assault group has less than 4 units alive
waitUntil {
sleep 0.1;
_assaultgroup1count = {alive _x} count _assaultarray1;
_assaultgroup1count < 4;
};

// Create second assault group
_assaultgroup2 = [getMarkerPos "enemyspawn2", east, _units, [],[],[0.5,0.8],_minunitscount,180] call BIS_fnc_spawnGroup;

//Assign second assault group to array	
_assaultarray2 = units _assaultgroup2;

//Wait 5 seconds then assign assault task for second assault group
sleep 5;
[_assaultgroup2, getMarkerPos "attack1"] call BIS_fnc_taskAttack;

};

Edited by =GEN=GoldenGlovez.pro, 25 July 2013 - 11:33 AM.


#14
=GEN=Lead_Magnet

=GEN=Lead_Magnet
  • Toontown War Council
  • 1,582 posts
  • Steam ID:wtoddsherman
  • LocationDelaware USA
You are becoming like a mad scientist bwah hah hah hah
Posted Image

I'll Draw their fire - You take them out!

Posted Image

#15
=GEN=GoldenGlovez

=GEN=GoldenGlovez
  • Nerd Herder
  • 22 posts
  • Steam ID:GoldenGlovez
  • LocationSomewhere in the world

You are becoming like a mad scientist bwah hah hah hah


Mu.. Mu.. Muhahaha. xD

Now I need to actually put all this together one day for a mission.

Edited by =GEN=GoldenGlovez.pro, 25 July 2013 - 11:36 AM.


#16
=GEN=Lead_Magnet

=GEN=Lead_Magnet
  • Toontown War Council
  • 1,582 posts
  • Steam ID:wtoddsherman
  • LocationDelaware USA
I was thinking like a pork chop hill mission. Each time you kill an enemy two more appear charging up the hill as the sun sets and all the lights go out. Then you have to light flares just to see if your foxhole buddy is really friendly.
Posted Image

I'll Draw their fire - You take them out!

Posted Image

#17
=GEN=GoldenGlovez

=GEN=GoldenGlovez
  • Nerd Herder
  • 22 posts
  • Steam ID:GoldenGlovez
  • LocationSomewhere in the world
Here is another little script I put together that helps immensely with setting up missions.

It'll give you a live feed of the following: PositionATL, Azimuth, Currently Velocity, What object is under your crosshair, In-game time, and total count of all alive units. It'll also set your player to receive no damage and never fatigue, good for testing fights.

Updated: July 28th, 2013
Added ability to see current wind strength and direction, also added ability to see what target the AI you have under your crosshair is currently targeting.

Save this code as debug.sqf and place a game logic in game with the following INIT:
null = [] execVM "debug.sqf";

player enableFatigue false;
player allowDamage false;

while {true} do {
mypos = getPosATL player;
mydir = getDir player;
myvelo = velocity player;
unitcount = count allUnits;
histarget = assignedTarget cursorTarget;

hintSilent format ["PositionATL:\n%1\n\nAzimuth:\n%2\n\nCursorTarget:\n%3\n\nVelocity:\n%4\n\nTime:\n%5\n\nAliveUnitCount:\n%6\n\nAssignedTarget:\n%7\n\nWindStr/WindDir:\n%8/%9\n",mypos,mydir,cursortarget,myvelo,daytime,unitcount,histarget,windStr,windDir];
sleep 0.2;
};


Edited by =GEN=GoldenGlovez.pro, 27 July 2013 - 05:51 PM.


#18
Generalshotz

Generalshotz
  • Pubbers
  • 1 posts
  • LocationCanada
Thanks. :smile:/>

Does this still work?

Edited by Generalshotz, 20 March 2014 - 01:13 PM.


#19
=GEN=Cappy

=GEN=Cappy

    Founding Member

  • Toontown War Council
  • 3,636 posts
  • Steam ID:Cappy
  • LocationSydney Aust

Thanks. :smile:/>/>

Does this still work?


I think so, BUT BEWARE. if you use the above script on a server running Battleeye it is possible to be banned for hacking.{player receiving no damage would result in a ban ] that was set up, as glovez said, for testing missions out.

cappy.png

 

cappy.png





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users