Bohemia Interactive Forums  

Go Back   Bohemia Interactive Forums > BI MILITARY GAMES FORUMS > ARMA 2 EDITING > ArmA 2 & OA : CONFIGS AND SCRIPTING (addons)

ArmA 2 & OA : CONFIGS AND SCRIPTING (addons) Discussion on editing CPP's, SQS', SQF's and getting your work from O2 to Arma 2 & the standalone expansion Operation Arrowhead

Reply
 
Thread Tools Display Modes
Old 03-15-2010, 03:09 PM   #1
Soul_Assassin
Warrant Officer
 
Soul_Assassin's Avatar
 
Join Date: May 2002
Posts: 2,194
Tutorial: Creating custom vehicle muzzleflashes

Tutorial: Creating custom vehicle muzzleflashes

This should give some insight on creating custom main weapon muzzleflashes for vehicles.

First of all set up 2 sqf files. Put them both into your \my_addon\scripts\ directory:

1. init.sqf

Code:
/*******************************************************************************
* Special FX secton                                                            *
*******************************************************************************/
if (isNil "MYADDON_Effects_Init") then
{
	MYADDON_Effects_Init = true;
	MYADDON_Effects_EH_Fired = compile preprocessFileLineNumbers "\ca\Data\ParticleEffects\SCRIPTS\fired.sqf";
	MYADDON_Effects_EH_Killed = compile preprocessFileLineNumbers "\ca\Data\ParticleEffects\SCRIPTS\killed.sqf";

	MYADDON_Effects_HeavyCaliber=compile preprocessFileLineNumbers "\my_addon\scripts\heavycaliber.sqf";

	//must use spawn command for these:
	BIS_Effects_Burn=compile preprocessFileLineNumbers "\ca\Data\ParticleEffects\SCRIPTS\destruction\burn.sqf";
	BIS_Effects_AircraftVapour=compile preprocessFileLineNumbers "\ca\Data\ParticleEffects\SCRIPTS\misc\aircraftvapour.sqf";
	BIS_Effects_AirDestruction=compile preprocessFileLineNumbers "\ca\Data\ParticleEffects\SCRIPTS\destruction\AirDestruction.sqf";
	BIS_Effects_AirDestructionStage2=compile preprocessFileLineNumbers "\ca\Data\ParticleEffects\SCRIPTS\destruction\AirDestructionStage2.sqf";
	BIS_Effects_Secondaries=compile preprocessFileLineNumbers "\ca\Data\ParticleEffects\SCRIPTS\destruction\Secondaries.sqf";
	//BIS_Effects_RocketTrail=compile preprocessFileLineNumbers "\ca\Data\ParticleEffects\SCRIPTS\muzzle\rockettrail.sqf";
};
2) heavycaliber.sqf
Code:
private ["_u", "_sh","_i","_no","_int","_vel","_p3d","_light","_li"];
_u = _this select 0;
_sh = nearestobject [_u, _this select 4];
_i=1;
_no=2;

//Flash

drop [["\ca\Data\ParticleEffects\Universal\Universal",16,2,32], //objecct
"",																//Animation name
"Billboard",													//Type
1,																//Timer periods
(0.12 + 0.015*_i), 												//Life time
[0,0.7,0.1], 													//Position
[0,1,0],														//move velocity 
0, 																//rotation velocity
10,																//weight
0.5,															//volume
0.075,															//rubbing
[0.5, _i*1],														//size
[[1, 1, 1, -2],[1, 1, 1, -2], [1, 1, 1, -1], [1, 1, 1, -0]], 	//color
[3 + random 2],													//Animation Phase
0,																//Random dir
0, 																//Random dir intensity
"", 															//On timer
"", 															// before destroy
_sh];

// Night Light
_li = "#lightpoint" createVehicleLocal getpos _sh;
_li setLightBrightness 0.2;
_li setLightAmbient[0.8, 0.6, 0.2];
_li setLightColor[1, 0.5, 0.2];
//_li lightAttachObject [_u, [0,1.1,0.1]];

	
//Smoke
private ["_weh","_life"];
_u= _this select 0;
_sh = nearestobject [_u, _this select 4];
if ((_u iskindof "Helicopter") && (isengineOn _u)) then 
	{
	_weh=1;
	_life= 0.8;
	}
	else
	{
	_weh = 0.104;
	_life= 1.3 + random 0.6;
	};
	
drop [["\ca\Data\ParticleEffects\Universal\Universal",16,12,8],
	"", 

	"Billboard",
	1,
	_life,
	[0, 1.1, 0.1],
	[0, 5 + random 4, 0],
	0,
	_weh,
	0.08,
	0.2,
	[1.5, 5 + random 3],
	[[0.7, 0.7, 0.7, 0.2 + random 0.1],
	[0.8, 0.8, 0.8, 0]], 
	[1/_life], 1, 0, "", "", _sh,random 360];
	
drop [["\ca\Data\ParticleEffects\Universal\Universal",16,12,8],
	"", 
	"Billboard",
	1,
	0.3,
	[0, 1.1, 0.1],
	[0, 0, 0],
	0,
	_weh,
	0.08,
	0.5,
	[0.4, 2.5], 
[[0.3, 0.3, 0.3, 0],[0.5, 0.5, 0.5, 0.25],[0.7, 0.7, 0.7, 0]],
 [2],
 1,
 0,
 "",
 "",
 _sh,
 random 360];

//remove light
_li spawn
{
	sleep 0.05;
	deletevehicle _this;
};
in that code tweak the second member of the position array for the specific length of the barrel. Also here tweak all the parameters of the flash, like size, speed, ammount etc.

In the cfgAmmo defenition of the ammunition of the weapon add a line:
Code:
muzzleEffect = "MYADDON_Effects_HeavyCaliber";
And finally make sure your EvenHandler defenition looks like this:

Code:
class EventHandlers 
        {
            init = "_this call compile preProcessFile ""\my_addon\scripts\init.sqf"";";
            fired = "_this call MYADDON_Effects_EH_Fired;"; // on weapon fired
	    killed = "_this call MYADDON_Effects_EH_Killed;"; 
        };
That should be it !
__________________
--== КОНСТРУКТОРСКОЕ БЮРО "ОБЪЕКТ 915" ==--
--== RHS ==--

NEW! BMD-2 pack 1.0 for ArmA2 (RHS)
BMD-1 pack 1.0 for ArmA2


ArmA Modding ToolBox 1.1 for 3dsmax: http://forums.bistudio.com/showthread.php?t=78083

MaskMapper 2: http://forums.bistudio.com/showthread.php?t=90217
Soul_Assassin is online now   Reply With Quote
Reply
Go Back   Bohemia Interactive Forums > BI MILITARY GAMES FORUMS > ARMA 2 EDITING > ArmA 2 & OA : CONFIGS AND SCRIPTING (addons)  Reload this Page  Tutorial: Creating custom vehicle muzzleflashes

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:03 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.