Skip to content

Instantly share code, notes, and snippets.

@Fusselwurm
Created April 17, 2014 18:35
Show Gist options
  • Save Fusselwurm/11003578 to your computer and use it in GitHub Desktop.
Save Fusselwurm/11003578 to your computer and use it in GitHub Desktop.
sqf script
SHK_DeadCivilianCount = 0;
SHK_DeadCivilianLimit = 3;
civsDead = false;
waituntil {!(isnil "bis_fnc_init")};
civ_groups=[];
civ_group_count = 0;
{if (count units _x>0 and side _x==east) then
{civ_groups = civ_groups + [_x]}}
forEach allGroups;
civ_group_count = count civ_groups ;
hintsilent format ["%1" + " opfor groups counted",civ_group_count];
[] spawn {
waituntil {civsDead};
sleep 5;
{[_x] joinsilent grp_blufor;} forEach units grp_aaf;
sleep 5;
blufor_boss setDamage 1;
hintsilent format ["They fire back now... Beware!",_this];
//HQ sideRadio "civsdeadsound";
_i = 0;
while {_i < civ_group_count} do {
_i = _i+1;
//civ_group_count_helper = floor (civ_group_count);
random_civ_group = civ_groups select _i;
private ["_wp"];
_wp = random_civ_group addCurrentWaypoint [base_attackpoint, 50];
_wp setwaypointtype "MOVE";
_wp setwaypointspeed "FULL";
random_civ_group setCurrentWaypoint [_wp,1];
_markername = format["%1",_i];
_markername2 = format["%1_z",_i];
_markername = createMarker [_markername, getPos base_attackpoint]; markerstr setMarkerShape "ICON"; markerstr setMarkerType "SELECT"; markerstr setMarkerColor "ColorRed"; markerstr setMarkertextLocal "Waypoint of Opfor";
_leaderpos = getPos leader random_civ_group;
_markername2 = createMarker [_markername2, _leaderpos]; markerstr2 setMarkerShape "ICON"; markerstr2 setMarkerType "SELECT"; markerstr2 setMarkerColor "ColorRed"; markerstr2 setMarkertextLocal "Start of Opfor";
sleep 2;
}
};
SHK_fnc_deadCivilians = {
hintsilent format ["You killed %1 friendly takiban. Beware, they may shoot back.",_this];
if (_this >= SHK_DeadCivilianLimit) then {
civsDead = true;
publicvariable "civsDead";
};
};
SHK_eh_killed = {
_unit = _this select 0;
_killer = _this select 1;
if ((side _killer == east)) exitWith {};
SHK_DeadCivilianCount = SHK_DeadCivilianCount + 1;
publicvariable "SHK_DeadCivilianCount";
_killer addRating 1000;
if isdedicated then {
if (_this >= SHK_DeadCivilianLimit) then {
civsDead = true;
publicvariable "civsDead";
};
} else {SHK_DeadCivilianCount call SHK_fnc_deadCivilians;};
};
waitUntil{!isNil "BIS_fnc_init"};
if isserver then {
{
if (side _x == EAST && _x iskindof "Man") then {
_x addEventHandler ["killed", SHK_eh_killed];
};
} foreach allunits;
//ind5 addEventHandler ["killed", SHK_eh_killed];
//ind6 addEventHandler ["killed", SHK_eh_killed];
//ind7 addEventHandler ["killed", SHK_eh_killed];
//ind8 addEventHandler ["killed", SHK_eh_killed];
//ind9 addEventHandler ["killed", SHK_eh_killed];
//ind10 addEventHandler ["killed", SHK_eh_killed];
//ind11 addEventHandler ["killed", SHK_eh_killed];
//ind12 addEventHandler ["killed", SHK_eh_killed];
} else {
"SHK_DeadCivilianCount" addpublicvariableeventhandler { (_this select 1) call SHK_fnc_deadCivilians };
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment