SejtanPL 0 Posted November 16, 2013 Welcome. I would like to add some own effects (never ending smoke :P or burning vehicle sounds) to each destroyed vehicle in the mission. And here is the problem, because I don`t know how to assign the script for each destroyed vehicle. Is it possible to achieve the desired result? Sorry for my english as usual :P Share this post Link to post Share on other sites
MulleDK19 21 Posted November 16, 2013 (edited) { _x addEventHandler ["Killed", {(_this select 0) execVM "some_script.sqf";}]; } forEach vehicles; Will execute some_script.sqf with _this being the killed vehicle. Eg. some_script.sqf: private ["_vehicle"]; _vehicle = _this; hint format ["Vehicle %1 was destroyed", _vehicle]; Edited November 17, 2013 by MulleDK19 Changed allVehicles to vehicles Share this post Link to post Share on other sites
SejtanPL 0 Posted November 16, 2013 (edited) Error, undefined variable in the expression. Screen EDIT: I changed allVehicles on vehicles and now it's works. One more question... how to exclude boats from the script? burning boat under the water would look weird :p Edited November 16, 2013 by Sejtan Share this post Link to post Share on other sites
MulleDK19 21 Posted November 17, 2013 Error, undefined variable in the expression. ScreenEDIT: I changed allVehicles on vehicles and now it's works. One more question... how to exclude boats from the script? burning boat under the water would look weird :p Whoops, my bad. Fixed. This should do the trick: { if (!(_x isKindOf "Ship")) then { _x addEventHandler ["Killed", {(_this select 0) execVM "some_script.sqf";}]; }; } forEach vehicles; Share this post Link to post Share on other sites
SejtanPL 0 Posted November 17, 2013 Thanks a lot MulleDK19! :bounce3: I modified the script a little bit and eliminated all of the vehicles in the water. Now it's looks like this: init.sqf BIS_fn_createFireEffect = { private ["_effect","_pos","_fire","_smoke"]; private ["_light","_brightness","_color","_ambient","_intensity","_attenuation"]; _pos = _this select 0; _effect = _this select 1; _fire = ""; _smoke = ""; _light = objNull; _color = [1,0.85,0.6]; _ambient = [1,0.3,0]; switch (_effect) do { case "FIRE_SMALL" : { _fire = "SmallDestructionFire"; _smoke = "SmallDestructionSmoke"; _brightness = 1.0; _intensity = 10; _attenuation = [0,0,0,1]; }; case "FIRE_MEDIUM" : { _fire = "MediumDestructionFire"; _smoke = "MediumDestructionSmoke"; _brightness = 1.0; _intensity = 400; _attenuation = [0,0,0,2]; }; case "FIRE_BIG" : { _fire = "BigDestructionFire"; _smoke = "BigDestructionSmoke"; _brightness = 1.0; _intensity = 1600; _attenuation = [0,0,0,1.6]; }; case "SMOKE_SMALL" : { _smoke = "SmallDestructionSmoke"; }; case "SMOKE_MEDIUM" : { _smoke = "MediumSmoke"; }; case "SMOKE_BIG" : { _smoke = "BigDestructionSmoke"; }; }; if (_fire != "") then { _eFire = "#particlesource" createVehicleLocal _pos; _eFire setParticleClass _fire; _eFire setPosATL _pos; }; if (_smoke != "") then { _eSmoke = "#particlesource" createVehicleLocal _pos; _eSmoke setParticleClass _smoke; _eSmoke setPosATL _pos; }; //create lightsource if (_effect in ["FIRE_BIG", "FIRE_MEDIUM", "FIRE_SMALL"]) then { _pos = [_pos select 0,_pos select 1,(_pos select 2)+1]; _light = createVehicle ["#lightpoint", _pos, [], 0, "CAN_COLLIDE"]; _light setPosATL _pos; _light setLightBrightness _brightness; _light setLightColor _color; _light setLightAmbient _ambient; _light setLightIntensity _intensity; _light setLightAttenuation _attenuation; _light setLightDayLight false; }; }; MISSION_ROOT = call { private "_arr"; _arr = toArray str missionConfigFile; _arr resize (count _arr - 15); toString _arr }; { _x addEventHandler ["Killed", {(_this select 0) execVM "effect.sqf";}]; } forEach vehicles; effect.sqf private ["_veh"]; _veh = _this; _isWater = surfaceIsWater position _veh; waitUntil {isTouchingGround _veh}; if (speed _veh == 0 || !_isWater) then { playSound3D [MISSION_ROOT + "sounds\fire01.wss", _veh, false, getPosASL _veh, 10, 1, 50]; sleep 120; [getPosASL _veh, "SMOKE_BIG"] call BIS_fn_createFireEffect; }; For proper operation requires some burning fire sound. I use THIS after a little modification. ;) Share this post Link to post Share on other sites
Von Quest 1163 Posted November 17, 2013 This looks promising. Was tinkering with an Idea myself. Should notify Armaholic maybe for release? I was thinking of needing long lasting effects for Aviation Craft. Will have to try yours out... Neat. Share this post Link to post Share on other sites
SejtanPL 0 Posted November 17, 2013 I'm glad to be helpful. The script works pretty well, but not without bugs. In place of "SMOKE_BIG", you can give "SMOKE_MEDIUM", "SMOKE_SMALL" or "FIRE_BIG", "FIRE_MEDIUM", "FIRE_SMALL". When you use the "FIRE_BIG" for example, fire will burn all the time but sound will be heard only by about 2.5 minutes (the length of the recorded sound). Unfortunately, burning time is different for types of vehicles. Sometimes you can hear the flames, although the flames have extinguished. On the contrary ... the fire still burning, and the sound has faded ... I also noticed that when at one time will be destroyed more vehicles, not all sound comes. As far as the visuals, everything seems to be fine ;) I must say that without help, roy86 who helped me with the function responsible for burning vehicles, Killzone_Kid tutorial and help MulleDK19, the script probably would not exist :P Ones again sorry for my English. I use Google Translate to communicate with you :P Share this post Link to post Share on other sites
SejtanPL 0 Posted November 18, 2013 I make some demo mission. I hope it will be helpful. Share this post Link to post Share on other sites