Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- AUTHOR: aeroson
- NAME: suicide_car.sqf
- DESCRIPTION
- will add one satchel into car
- you can stop car from blowing by remving the satchel from its cargo
- if hostile unit is withing range, car will roll a dice with chance to blow up
- car will blow up if its dammage is lowered by 0.2
- USAGE:
- in vehicle's init
- [_this, 70, 10] execVM "suicide_car.sqf";
- _this refers to the vehicle
- 70 is chance to blow up when in range, dice is rolled every second
- chance is from 0 to 100
- 10 is range in meters to look for hostiles
- */
- _vehicle = _this select 0;
- _chance = _this select 1;
- _range = _this select 2;
- _bombClass = "SatchelCharge_Remote_Mag";
- _vehicle addMagazineCargo[_bombClass, 1];
- _blowUp = {
- //"HelicopterExploSmall" "HelicopterExploBig" "SmallSecondary"
- _booms = round (random 15);
- while { _booms>0 } do {
- "SmallSecondary" createVehicle (getPos _this);
- sleep ((random 0.2)+0.05);
- _booms = _booms - 1;
- };
- sleep ((random 0.1)+0.01);
- "HelicopterExploBig" createVehicle (getPos _this);
- };
- _hasMagazine = {
- {
- if((_x select 0)==(_this select 1)) exitWith { true; };
- } forEach getMagazineCargo (_this select 0);
- false;
- };
- _originalDamage = damage _vehicle;
- while{canMove _vehicle && [_vehicle, _bombClass] call _hasMagazine} do {
- if((damage _vehicle)-_originalDamage > 0.2) exitWith {
- _vehicle spawn _blowUp;
- false;
- };
- _gotTarget = false;
- {
- {
- if (alive _x && side _x != side _vehicle) then {
- if (({alive _x} count (crew (vehicle _x)))>0) then {
- _gotTarget = true;
- };
- };
- } forEach ((getPos _vehicle) nearObjects [_x, _range]);
- } forEach ["man","air","land","ship"];
- if(_gotTarget) then {
- if(floor(random(100-_chance))==0) exitWith {
- _vehicle spawn _blowUp;
- false;
- };
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment