Archive for category Demo Missions

Turning off streetlamps in an area

So you want to turn off all Streetlamps in an area?  You can do that pretty easily.  First place a Gamelogic in the middle of your town.  Then put the following code in it’s Init field.

{_x switchLight "OFF"} forEach ((getPos this) nearObjects ["StreetLamp",200]);

That will turn off all StreetLamps within 200m of the Gamelogic.

Here’s code I used in a mission on Chernarus to turn out all the lights in a city when I blew up two Power Generators:

_types = ["Land_PowLines_WoodL", "Land_PowLines_ConcL", "Land_lampa_ind_zebr", "Land_lampa_sidl_3", "Land_lampa_vysoka", "Land_lampa_ind", "Land_lampa_ind_b", "Land_lampa_sidl"];

while {true} do
        // power1 and power2 were two objects I placed.
	waituntil{!alive power1 and !alive power2};

	// delete the light over the generators.
	deletevehicle obsLight;

	for [{_i=0},{_i < (count _types)},{_i=_i+1}] do
                // powercoverage is a marker I placed.
		_lamps = getmarkerpos "powercoverage" nearObjects [_types select _i, 1200];
		sleep 1;
		{_x switchLight "OFF";} forEach _lamps;

Here are two demo missions which show this effect at work. The first method includes pre-placed items which can be deactivated via addAction in order to cut the power. Destroying them also works. The second example shows how destroying items on the map (the power transformers) can be used for the same effect. Hint, you'll need 3 satchels each!


Ground to Ground Helo Insertion

Here’s a demo mission showing how to get a helicopter to start landed, engines off, take off when the group is in the helo, fly to a previously declared location, drop them off and return to it’s landing pad and turn it’s engines off.

Download this example for: Zargabad or Chernarus

No Comments

AAN News Scroll Overlay Function

Watch in HD

Here’s how to add your own AAN News Scroll Overlay.  First place the Functions Module on the map, then call the overlay with this code, in the init.sqf for example.:

title = parsetext "<t size='2.3'>Rabbits Overrun Zargabad</t><br />Thousands of rabbits are terrorizing local women in the Takisani town of Zargabad."; 
scroll = parsetext "Military Units across Takistan report dance outbursts are on the rise - A-10s have been spotted flying upside down more often than not - Missing M16 Rifles found!"; 
nul = [title,scroll] spawn BIS_fnc_AAN;

Thanks to Koni on the BIS forums, here’s how to end the AAN Overlay early if you don’t want it displayed during the entire intro:

3000 cuttext ["","plain"];

Here is demo single player mission which shows the AAN Overlay in use as part of a intro.

, , , ,


Tasks Demo (Kill the Girl, not the Goat)

Setup: You, a punkKid, are told to kill a poorGirl and steal her sweetRide. But under no circumstances should you kill her adorableGoat.

Triggers: Initial Task Setup, Did you kill the goat?, Did you kill the girl? and Did you steal the car?

So we place all the players down, the girl, the goat, the car (default Locked) and whatever else. Place markers on the three spots as well, then create the triggers:

Trigger One – “Initial Task Setup”:

Condition =


onAct =

tskKillGirl = player createSimpleTask ["Kill Girl"]; 
tskKillGirl setSimpleTaskDescription ["Kill the girl picnicing with her pet goat.", "Kill the Girl", "Girl Picnicing"];
tskKillGirl setSimpleTaskDestination (getMarkerPos "girlMarker");

tskDontKillGoat = player createSimpleTask ["Don't Kill Goat"]; 
tskDontKillGoat setSimpleTaskDescription ["The goat has nothing to do with it.  Don't harm it.", "Don't kill the goat!", "Protected Goat"];
tskDontKillGoat setSimpleTaskDestination (getMarkerPos "goatMarker");

tskKillGirl setTaskState "Assigned";
player setCurrentTask tskKillGirl;
taskhint ["Kill the girl,\nbut not the goat!", [1, 1, 1, 1], "taskCurrent"];

So when you load in, since the trigger is set to true it’ll automatically fire. You’ll get your tasks (press J to verify) and a on screen task hint telling you to kill the girl and not the goat.

Trigger Two – “Did you kill the goat?”:

Condition =

!alive adorableGoat

onAct =

tskDontKillGoat setTaskState "Failed"; 
taskhint ["You killed the goat!!", [1, 0, 0, 1], "taskFailed"];
"goatMarker" setMarkerColor "ColorRed";
tskDontKillGoat setSimpleTaskDescription ["Seriously, I said don't kill the goat, so what do you, you kill it!  I hate you.", "GOAT KILLER!", "Dead Goat Here..."];

Pretty simple, if you kill the goat you fail that task. We also turn it’s map marker red so you never forget… We’ll also change the text on the Don’t Kill The Goat task to make it clear what a jerk you were.

Trigger Three – “Did you kill the girl?”:

Condition =

!alive poorGirl

onAct =

tskKillGirl setTaskState "Succeeded"; 
taskhint ["You killed the girl!!\nGood job!", [0, 1, 0, 1], "taskDone"];
tskStealCar = player createSimpleTask ["Steal Car"];
tskStealCar setSimpleTaskDescription ["Steal the girl's sweet ride.", "Steal Sweet Ride", "Car Parked Here"];   
tskStealCar setSimpleTaskDestination (getMarkerPos "carMarker");  
taskhint ["Now steal her sweet ride!", [1, 1, 1, 1], "taskNew"];
player setCurrentTask tskStealCar;  

sweetRide lock false;

If you kill the girl we’ll mark that task as succeeded and give you a green colored hint that you were successful. Then we’ll create a new task to steal the car and assign it to you along with a new hint that you should steal the car. We’ll also finally unlock the car which has remained locked till now to make sure you finished the girl task first.

Trigger Four – “Did you steal the car?”:

Condition =

player in sweetRide

onAct =

tskStealCar setTaskState "Succeeded"; 
taskhint ["You stole the car!", [0, 1, 0, 1], "taskDone"]; 
{deleteMarker _x} forEach ["goatMarker","girlMarker","carMarker"];

Lastly, once you’re in the car we’ll complete the steal car task, give you a nice green success hint and delete all the markers since you’re done!

You can download a demo mission of this heartwarming experience to play around with in the editor.

Intensity of the color of the text and it’s transparency value (Alpha).

[Red Value, Green Value, Blue Value, Alpha Value] From 0 to 1.


Here are the BIS colors:

taskhint ["New Task!\nHere's your new task!", [1, 1, 1, 1], "taskNew"];
taskhint ["Task Assigned!\nDo this now!", [1, 1, 1, 1], "taskCurrent"];
taskhint ["Task Succeeded!\nGood job!", [0.600000,0.839215,0.466666,1], "taskDone"];
taskhint ["Task Failed!\nBad job!", [0.972549,0.121568,0,1], "taskFailed"];
taskhint ["Task Canceled!\nNever mind!", [0.75,0.75,0.75,1], "taskFailed"];

Red: [1, 0, 0 , 1]
Blue: [0, 0, 1, 1]
Green: [0, 1, 0, 1]
Cyan: [0, 1, 1, 1]
Hot Pink: [1, .5, 1, 1]
Purple: [.5, 0, .5, 1]
Black: [0, 0, 0, 1]
White: [1, 1, 1, 1]
Orange: [1, .7, .4, 1]
Yellow: [1, 1, .5, 1]
Olive: [.2, .4, .2, 1]

1 Comment

plannedExtraction.sqf – a helo transport solution

So here’s one of many ways of doing this. You can download this demo mission from the intertubes.

Place your Functions Module as well as hStart and hEnd markers where you want the helo to spawn and where you want the player’s group to be dropped off. Place a Radio trigger with:

nul = [player] execVM "plannedExtraction.sqf";

Then the plannedExtraction.sqf is:

//  From trigger:
//  nul = [player] execVM "plannedExtraction.sqf";
//  Pre-place "hStart" and "hEnd" markers on the map.

// Wait till the Functions module is ready.
waituntil {!isnil "bis_fnc_init"};

// Declare everything.
_unit = _this select 0; // who called it.
_chopperType = "CH_47F_EP1";  // Type of transport.
_start = getMarkerPos "hStart";  // location of start/spawn/delete location.
_end = getMarkerPos "hEnd";  // location of drop off.
_landPos = [_unit, 20, getdir _unit] call BIS_fnc_relPos;  // location of pickup, 20m in front of caller

if (isServer) then {
	// message letting them know it's coming.
	hintSilent "Extraction chopper inbound!";  
	// Create a little shiney ball we can use to get the direction from start to caller with
	_blinky = "Sign_sphere10cm_EP1" createVehicle _start;
	_flightPath = [_blinky, _unit] call BIS_fnc_relativeDirTo;		
	// Spawn the helo, facing the user, in the air at the start location.
	_ch = [[_start select 0, _start select 1, 50], _flightPath, _chopperType, side _unit] call BIS_fnc_spawnVehicle;
	// Name the helo globally so that waypoint orders will work.
	transporthelo = _ch select 0;
	_chGroup = _ch select 2; // group of helo so waypoints work.
	_chGroup setBehaviour "CARELESS"; // Make sure they don't get distracted.
	// transporthelo setCaptive true; // uncomment this to make your ride safe.
	// These lines might be needed in MP. :)  Didn't test it yet.
//	_ch select 0 setVehicleInit "transporthelo = this; this setVehicleVarName ""transporthelo""";
//	processInitCommands;
	// Delete the cute little light that let us spawn facing the right direction
	// and create landing spots for pickup and dropoff.
	deleteVehicle _blinky;
	_lzPickup = "HeliHEmpty" createvehicle _landPos;
	_lzDropOff = "HeliHEmpty" createvehicle _end;
	// Give the helo a waypoint to where the player is and make it land, engines on.
	wp0 = _chGroup addwaypoint [_landPos, 20];
	wp0 setwaypointtype "MOVE";
	wp0 setWaypointStatements ["","transportHelo land ""GET IN"""];
	// Wait till the player's group is in the helo.
	waitUntil{{_x in transporthelo} count units group _unit == count units group _unit};
	// Once they are, off we go by setting a TRANSPORT UNLOAD waypoint.  
	// It'll auto boot the leader once there, but he'll have to tell the others to get out.
	wp1 = _chGroup addwaypoint [_end, 20];
	wp1 setwaypointtype "TR UNLOAD";
	wp1 setWaypointStatements ["","transportHelo land ""GET OUT"""];
	// Wait till the player's group is out of the helo.
	waitUntil{{_x in transporthelo} count units group _unit == 0};
	// Once they are out, set a waypoint back to the start and clean up by deleting the helo and landing pads.
	wp2 = _chGroup addwaypoint [_start, 20];
	wp2 setwaypointtype "MOVE";
	wp2 setWaypointStatements ["true","{deleteVehicle _x} forEach crew transporthelo; deletevehicle transporthelo;"];
	deleteVehicle _lzPickup;
	deleteVehicle _lzDropOff;