Jump to content
Sign in to follow this  
Rexxenexx

Hit-squad script

Recommended Posts

I made this for fun while testing a mob type script I was working on. What it does is spawns armed units at a trigger and also creates a trigger at that location so when the trigger is clear the armed units disappear.

I want to see if someone can test it out in MP. Also if anyone has some advice on making it better I'd appreciate it! ;)

hitsquad_spawner.sqf


/*                                              HIT-SQUAD v0.5
                                                By REXXENEXX
                                            http://rexxenexx.com

[ABOUT]
     This script will spawn armed units dressed in business suits with the highest skill! Use-
     this script to shock unsuspecting players when they go out of bounds.
     REQUIRES hidebody.sqf

[TO USE]
     Create a trigger covering the area you want to protect with the hitsquad.
     Make sure its set to repeat the trigger and triggered by who you want the hitsquad to-
     attack. In its On Activation type:

                 nul = [east,3,thisList select 0] execVM "hitsquad_spawner.sqf";

     where "east" is the side you want the hitmen to be on.
        ex: "east","west","resistance","civilian"
     "3" is how many units in the squad you want. Don't go too high, three can get the job done!
     "thisList select 0" doesn't need to be changed, it's just used to select the person that -
     triggered the trigger.                                                                

[CHANGELOG]
    v0.5:
     -first release
     -no known bugs
                                                                                                  */


_debug = 0; //show debug messages? 1 = yes 0 = no
_say = 0; //say when the hitsquad spawns? 1 = yes 0 = no
_rad = 50; //this is the radius of the new created trigger which despawns the hitsquad. Default = 50

if (isServer) then {

  _side = _this select 0;
  _howManyUnits = _this select 1;
  _loc = position (_this select 2);

  _createWhat = "Functionary1";  //change this if you want something other than Business man units. Default = "Functionary1"

  _SideHQ = createCenter _side;
  spawnGroup = createGroup _side;

  if (isnil ("spawn_count")) then {

     spawn_count = 1;
     publicVariable "spawn_count";
     if(_debug==1)then{hint "Declared spawn_count"};

  };

  _unitName = format["hitmanName"+"%1",spawn_count]; 

  _spawnString = format["'%1' createUnit [%2,spawnGroup,' %3=this;this setSkill 1;this addEventHandler [''killed'', ''(_this select 0) execVM ""hidebody.sqf""''];removeAllWeapons this;this addMagazine ''30Rnd_556x45_G36'';this addMagazine ''30Rnd_556x45_G36'';this addWeapon ''M8_compact''; ',0.1,'PRIVATE'];",_createWhat,_loc,_unitName];
  _despawnString = format["deleteVehicle %1;",_unitName,_howManyUnits];

  if ( _say == 1 ) then {

     _spawnString = format["player sideChat 'a hit-squad has spawned!';'%1' createUnit [%2,spawnGroup,' %3=this;this setSkill 1;this addEventHandler [''killed'', ''(_this select 0) execVM ""hidebody.sqf""''];removeAllWeapons this;this addMagazine ''30Rnd_556x45_G36'';this addMagazine ''30Rnd_556x45_G36'';this addWeapon ''M8_compact''; ',0.1,'PRIVATE'];",_createWhat,_loc,_unitName];
     _despawnString = format["player sideChat 'the hit-squad is gone!';deleteVehicle %1;",_unitName,_howManyUnits];

  };

  _count=1;

  while {_count < _howManyUnits} do {

     spawn_count = spawn_count + 1;
     publicVariable "spawn_count";
     _unitName = format["hitmanName"+"%1",spawn_count]; 

     _spawnString = _spawnString + (format["'%1' createUnit [%2,spawnGroup,' %3=this;this setSkill 1;this addEventHandler [''killed'', ''(_this select 0) execVM ""hidebody.sqf""''];removeAllWeapons this;this addMagazine ''30Rnd_556x45_G36'';this addMagazine ''30Rnd_556x45_G36'';this addWeapon ''M8_compact''; ',0.1,'PRIVATE'];",_createWhat,_loc,_unitName]);
     _despawnString = _despawnString + (format["deleteVehicle %1;",_unitName]);

     _count=_count+1;

  };

  if(_debug==1)then{player sideChat format["SpawnCount = %1",spawn_count]};

  call compile _spawnString;

  call compile format["_trg_spwn%1=createTrigger['EmptyDetector',_loc];_trg_spwn%1 setTriggerArea[%2,%2,0,false];_trg_spwn%1 setTriggerActivation['ANY','NOT PRESENT',false];_trg_spwn%1 setTriggerStatements['this',_despawnString,''];",spawn_count,_rad]

};

if (true) exitWith {};

hidebody.sqf

sleep 2.0;

hidebody _this;

sleep 5.0;

deleteVehicle _this;

if (true) exitWith {};

Edited by Rexxenexx

Share this post


Link to post
Share on other sites

Thank you for posting your work, although I dont use it in a MP mission.. I use it to trigger backup units in a base when under attack.. works really well.

Tried to include the hidebody script in the main script, but I forgot you cant use delay commands when using call or in case of eventhandler...resulted in killed units disappear immediatly which is not wanted ofc.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×