11-19-2020, 03:11 AM
(This post was last modified: 11-19-2020, 05:51 PM by Phantom.
Edit Reason: sets bomb right on the floor for better kill radius
)
Suicide Car Bomb script
Throw the functions below into a game logic in the editor.
Suicide bomb script:
Add this to the unit group/composition init and make sure they are driving a vehicle:
Car charging at units script:
Add this to the unit group/composition init or call it from a trigger to order the specified suicide bomb truck to start driving towards players (replace <group_name> with the actual group's name:
Example mission included in post.
Note that if you want to make the suicide car bombs charge at units that you can change WEST to EAST or RESISTANCE if you want suicide car bombs to charge at those factions instead. You can replace allUnits with playableUnits + switchableUnits or your own custom array if you want suicide car bombs to only target players or specified units as well.
Throw the functions below into a game logic in the editor.
Suicide bomb script:
Add this to the unit group/composition init and make sure they are driving a vehicle:
Code:
_nul = leader this spawn Bomb_car_explode_fnc;
Code:
Bomb_car_explode_fnc = {
waitUntil {
(!alive driver _this) || !canMove _this ||
(({((_this distance2D _x) <= 10) && alive _x && side _x == WEST} count allUnits) > 0)
};
_bomb = "BO_GBU12_LGB" createVehicle [(getPosATL _this select 0), (getPosATL _this select 1), 0];
_bomb setVelocity [0,0,-200];
};
Car charging at units script:
Add this to the unit group/composition init or call it from a trigger to order the specified suicide bomb truck to start driving towards players (replace <group_name> with the actual group's name:
Code:
_nul = <group_name> spawn Bomb_car_charge_fnc;
Code:
Bomb_car_charge_fnc = {
_target = "";
_huntable = [];
{
if (alive _x && side _x == WEST) then {_huntable pushBack _x;};
} foreach allunits;
_target = selectRandom _huntable;
_wp = _this addWaypoint [getPos _target, 0];
_wp setWaypointType "MOVE";
_wp setWaypointCombatMode "YELLOW";
_wp setWaypointBehaviour "CARELESS";
_wp setWaypointSpeed "FULL";
_wp setWaypointStatements ["true", "_null = (group this) spawn Bomb_car_charge_fnc;"];
};
Example mission included in post.
Note that if you want to make the suicide car bombs charge at units that you can change WEST to EAST or RESISTANCE if you want suicide car bombs to charge at those factions instead. You can replace allUnits with playableUnits + switchableUnits or your own custom array if you want suicide car bombs to only target players or specified units as well.