Overview
In this scenario, the player must assassinate an OPFOR General and confirm his death by checking his body. The player must not kill more than 3 civilians in the process.
If the player kills a civilian, a warning message is displayed showing how many civilians the player has killed and how many kills they are allowed left before the mission ends. If the player kills 3 civilians, the game ends. If the player confirms the General’s death the game goes on, but will still end if the player kills 3 civilians.
In the Editor
- Create a BLUFOR spawn
- Create a single OPFOR unit with a name of “Target_General”
- Place a minimum of 3 civilians.
Other units can be added if desired.
Mission Files
Create or extract the files to your mission folder.
Read more on where to find mission files in the biki.
init.sqf
// Has the general's body been searched?
generalSearched = false;
// Current number of civilians
// the player has killed
deadCivilianCount = 0;
// Maximum number of civilians the player is
// allowed to kill before the mission ends
maxDeadCivilians = 3;
// The General the player is trying to kill
_general = Target_General;
// FUNCTION: Record a civilian's death and
// alert the player of his actions
FNC_record_civilian_death =
{
// Increase civilian death count and
// calculate number of allowed kills left
deadCivilianCount = deadCivilianCount + 1;
_civilianKillsLeft = maxDeadCivilians - deadCivilianCount;
// Check if player has reached the kill limit
if(_civilianKillsLeft == 0) then {
[] spawn FNC_reached_max_civilian_deaths;
}
// Display warning message if player
// hasn't reach kill limit
else {
_msg = "%1 civilian";
// Add an "s" to civilian if kills are greater than 1
if(deadCivilianCount == 1) then {
_msg = _msg + " has";
}
else {
_msg = _msg + "s have";
};
_msg = _msg + " been killed. The mission is over if you kill %2 more!";
// Output message to player
hint format [_msg, deadCivilianCount, _civilianKillsLeft];
}
};
// FUNCTION: Called when player has killed
// too many civilians. Display a message,
// and end the mission.
FNC_reached_max_civilian_deaths =
{
hint "You killed too many innocent civilians!";
sleep 5;
endMission "END2";
};
// FUNCTION: Called when player has killed
// the general. Tell player to confirm the death.
FNC_general_killed =
{
hint "The general is down. You must confirm his death!";
};
// Add the "Confirm death" action to the general's dead body
_general addAction ["Confirm death", "confirmDeath.sqf", [], 1, false, true, "!alive _general && generalSearched == false"];
// Add an event to the general's death
// that calls FNC_general_killed
_general addEventHandler ["killed", { [] spawn FNC_general_killed }];
// Add an event to every civilian's death
// that calls FNC_record_civilian_death
{
if(side _x == Civilian && _x isKindOf "Man") then {
_x addEventHandler ["killed", { [] spawn FNC_record_civilian_death }];
};
} foreach allUnits;
confirmDeath.sqf
// Remove "Confirm death" action from general
_gen = _this select 0;
_caller = _this select 1;
_id = _this select 2;
_gen removeAction _id;
// We've searched the general
generalSearched = true;
// Tell player the mission was successful
hint "You have confirmed the general is dead. Mission accomplished!";
// Optionally, End the mission
//sleep 5;
//endMission "END1"