Jump to content
y0shi

Attach fire to helicopter after crash

Recommended Posts

Hi all,

 

I've been using Signaller's heli crash script (http://www.armaholic.com/page.php?id=25452) the last few hours to create some nice crashes. After some bouncing around on commands I managed to get a nice crashsite with no upside-down helis etc. The only missing part is the smoke.

 

My script currently looks somewhat like this;

_nul = [] execVM "heliCrash\crashInit.sqf";

_heliMarker = ["heli1", "heli2", "heli3", "heli4"];
_heliMarkerSelect = _heliMarker call BIS_fnc_selectRandom;
_heliSpawn = getMarkerPos _heliMarkerSelect;

_heliGroup = createGroup WEST;
crash_heli = createVehicle ["I_Heli_Transport_02_F", [_heliSpawn select 0, _heliSpawn select 1, 200], [], 0, "FLY"];
crash_heli_pilot = "o_soldier_unarmed_f" createUnit [_heliSpawn, _heliGroup, "this assignAsDriver crash_heli; this moveInDriver crash_heli;"];

_centerPos = getMarkerPos "center";
crash_position = [_centerPos, 500, 3500, 1, 1, 20, 0] call BIS_fnc_findSafePos;

_heliGroup addWaypoint [crash_position, 0];
_nul = [] execVM "crashMonitor.sqf";

onMapSingleClick "player setPos _pos;";

_crashMarker = createMarker ["heliCrash", crash_position];
_crashMarker setMarkerShape "ICON";
_crashMarker setMarkerType "hd_objective";

_heliMarker = createMarker ["heliMarker", (getPos crash_heli)];
_heliMarker setMarkerShape "ICON";
_heliMarker setMarkerType "mil_box";
_heliMarker setMarkerColor "ColorRed";

while {true} do {
	_heliMarker setMarkerPos (getPos crash_heli);
	sleep 2;
};

The crashMonitor.sqf:

_heliCrashInit = true;
while {_heliCrashInit} do {
	_distanceToCrash = crash_heli distance crash_position;

	if(_distanceToCrash < 1200) then {
		_heliCrashInit = false;

		hint "Crash Init";

		_nul = [crash_heli, false] spawn H8_crashNow;

		sleep 5;

		crash_heli addEventHandler ["Killed", {
			(_this select 0) spawn {
				_heliWreckPosition = getPosASL _this;
				deleteVehicle _this;

				_newWreck = "I_Heli_Transport_02_F" createVehicle _heliWreckPosition;
				_newWreck setVelocity [0, 0, 0];
				_newWreck setPosATL [_heliWreckPosition select 0, _heliWreckPosition select 1, 0];

				_wreckSmoke = "test_EmptyObjectForSmoke" createVehicle _heliWreckPosition;

				_newWreck setDamage 1;
				_newWreck setDamage 0;
				_newWreck setDamage 1;
				_newWreck enableSimulation false;
			};
		}];
	} else {
		hint format["%1 meters to crash", _distanceToCrash]
	};

	sleep 2;
};

If you run this script on a properly setup map (4 helo spawn points & a center marker), you'll notice that the smoke which should be spawned by the monitor is always a bit offset from the helo. It's mostly attached to the ground or somewhere else like 3 meters off.

 

Does anyone of you have a valid solution for this problem? I cannot seem to find the correct anchor point for the smoke and yes - I tried attachTo as well. This just results in no smoke being there at all.

 

Thanks for any suggestions :)

 

Cheers

Share this post


Link to post
Share on other sites

Try getting pos of new wreck first. Added a line with modelToWorld so you can fine tune the pos

_heliWreckPosition = getPosASL _this;
deleteVehicle _this;
_newWreck = "I_Heli_Transport_02_F" createVehicle _heliWreckPosition;
_newWreck setVelocity [0, 0, 0];
_newWreck setPosATL [_heliWreckPosition select 0, _heliWreckPosition select 1, 0];
//
_heliWreckPosition = _newWreck modelToWorld [0,0,0];
//
_wreckSmoke = "test_EmptyObjectForSmoke" createVehicle _heliWreckPosition;

Share this post


Link to post
Share on other sites

Hi there and thanks for your suggestion. Unforunately the smoke still keeps attaching like this  :( I have no clue why this is happening.

 

aSgfmId.jpg

Share this post


Link to post
Share on other sites

I sorted it out:

 

// Generate the smoke
_wreckSmoke = "test_EmptyObjectForSmoke" createVehicle [0, 0, 0];
_wreckSmokePosition = _newWreck modelToWorld [-0.249023, 1.45703, -2.2991];
_wreckSmoke setPosATL _wreckSmokePosition;
 
Now the smoke is nice and centered... Hopefully somebody else will sometime find this thread and have an easier day than me :D
 
Cheers

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

×