Jump to content
Sign in to follow this  
trevormcneill

spawn vehicle with a unit name

Recommended Posts

so i am working on a car bomb script and i have the script spawn a vehicle and then the user can blow it up ussing the given addaction but i can figure out how to give the spawned vehicle a name

private ["_unit", "_id"];
_id= _this select 2;
_Unit= _this select 1; 

BombMaker_N = getpos glbuilding nearestObject  272072;
BombMaker_C = getpos glbuilding nearestObject  33531;

		hint "vehicle spawned"; 
		BombMaker_N removeAction _id; 
		_BombTruck_N = "Ural_TK_CIV_EP1" createVehicle getMarkerPos "TruckSpawn_N";
		_BombTruck_N setDir 120;
		_Unit addAction ["<t color=""#FF0000"">" + "Detonate Truck Bomb", "Truck_Bomb\Detonate_Truck_Bomb_N.sqf"];
		sleep 1800; 

THEN THE DETONATE SCRIPT

"ACE_PipebombExplosion" createVehicle getPos _BombTruck_N ;
hint "boom";/// verify script runs

Share this post


Link to post
Share on other sites

You don't need a "name" for your truck. You already have a reference you can pass in your addAction arguments.

private ["_unit", "_id"];
_id= _this select 2;
_Unit= _this select 1; 

BombMaker_N = getpos glbuilding nearestObject  272072;
BombMaker_C = getpos glbuilding nearestObject  33531;

hint "vehicle spawned"; 
BombMaker_N removeAction _id; 
_BombTruck_N = "Ural_TK_CIV_EP1" createVehicle getMarkerPos "TruckSpawn_N";
_BombTruck_N setDir 120;
_Unit addAction ["<t color=""#FF0000"">" + "Detonate Truck Bomb", "Truck_Bomb\Detonate_Truck_Bomb_N.sqf",[color="#0000FF"]_BombTruck_N[/color]];
sleep 1800;

and then in your detonate script:

_truck = _this select 3;
"ACE_PipebombExplosion" createVehicle getPos _truck;
hint "boom";/// verify script runs

Edited by panther42

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  

×