Jump to content

Recommended Posts

hi all!
i've a problem with fire....seems i cant stop it form working !
i've a script that uses       " test_EmptyObjectForFireBig "        effect    and smoke too  with          "test_EmptyObjectForSmokeBig ",
the problem is that i wish it to end after 1 minute (or a selectable time around 1 to 5 minutes).
any idea how do this ? there is another fire/smoke that auto-ends after some time?
thanks guys !

Share this post


Link to post
Share on other sites

thanks man ! gonna try it now !

Share this post


Link to post
Share on other sites

ok i'm reading this.....but not sure to have understood.....or how merge with my script.
here is the code :
 

Spoiler

params ["_veh","_HandleDamageEvent"];
private ["_vehRestCode", "_sfxEnabled", "_exagEffectsEnabled"];
_vehRestCode = missionNamespace getVariable "r0ed_SurvivableCrashesVar_VehicleRestCode";
_sfxEnabled = missionNamespace getVariable "r0ed_SurvivableCrashesVar_SoundEffectsEnabled";
_exagEffectsEnabled = missionNamespace getVariable "r0ed_SurvivableCrashesVar_ExaggeratedEffectsEnabled";
_onCrashCode = missionNamespace getVariable "r0ed_SurvivableCrashesVar_OnCrashCode";

_veh setFuel 0;
_veh setDamage .88;
_veh setHitPointDamage ["HitHRotor",.88];
_veh setHitPointDamage ["HitVRotor",.88];
_veh setHitPointDamage ["HitEngine",.88];

_fire = 0;
if(_exagEffectsEnabled) then {
    _fire = createVehicle ["test_EmptyObjectForFireBig", position _veh, [], 0, "CAN_COLLIDE"];
    _fire attachTo [_veh,[0,0.0,0.0],"motor"];
} else {
    _fire = createVehicle ["test_EmptyObjectForSmoke", position _veh, [], 0, "CAN_COLLIDE"];
    _fire attachTo [_veh,[0,0.0,0.0],"motor"];
};
_veh allowDamage false;
[_veh, _sfxEnabled, _exagEffectsEnabled, _vehRestCode, _fire] spawn {
    params ["_veh","_sfxEnabled", "_exagEffectsEnabled",  "_vehRestCode", "_fire"];
    private ["_velocityVehPrev"];
    if (_sfxEnabled) then {
        [_veh] remoteExec ["r0ed_SurvivableCrashes_PlaySfx", -2];
    };
    _velocityVeh = vectorMagnitude velocity _veh;
    waitUntil{
        _velocityVehPrev = _velocityVeh;
        _velocityVeh = vectorMagnitude velocity _veh;
        isTouchingGround _veh
    };
    if(_exagEffectsEnabled) then {
        [_veh,_velocityVehPrev] call {
            params ["_veh", "_aproxVel"];
            
            _velocityVeh = velocity _veh;
            _dir = (_velocityVeh select 0) atan2 (_velocityVeh select 1);
            _speed = 4 + random 2;
            
            _velocityVeh = [(sin _dir) * _speed * sqrt abs(_velocityVeh select 0),
                (cos _dir) * _speed * sqrt abs(_velocityVeh select 1),
                (1 + random 4) * sqrt(abs(_aproxVel)) + .4 ]; // being tested - post 1.2.1
            _veh setVelocity _velocityVeh;
        };
    };
    waitUntil {
        sleep 1; _totalSpeed = vectorMagnitude velocity _veh;
        _totalSpeed < 1;
    };
    [_veh, _velocityVehPrev] call _vehRestCode;
    if(!(isNull _fire)) then {
        _fire spawn {
            // delete fire
            _this addMPEventHandler ["MPKilled", {
                _this = _this select 0;
                {
                    deleteVehicle _x;
                } forEach (_this getVariable ["effects", []]);
                if (isServer) then {
                    deleteVehicle _this;
                };
            }];
            _this setDamage 1;
        };
    };
};
{
    [_x] remoteExecCall ["r0ed_fnc_vehicleCrashLocal", _x];
} forEach crew _veh;

[_veh, _HandleDamageEvent] spawn _onCrashCode;

 //////////////////////////////////////////// D added to delete fire

sleep 55;
_fire call fnc_deleteTestObj;

 


i think i'm in the same situation.....i need to delete the fire and smoke....and  "emitters"  ??
i'm not very good with code....i fear i need a help on this :(
thanks !
 

Share this post


Link to post
Share on other sites

Later in 1.71 dev and 1.72 stable you should be able to delete fire object without hassle

  • Like 1

Share this post


Link to post
Share on other sites

Nice ! Good news !!

Was just for optimization....but turns out a bit more difficult than i expected !!

right now what should i do exactly to terminate that fire after x time ?

Thanks !

Share this post


Link to post
Share on other sites

In your script you attach these troublesome fire objects to your vehicle.

Therefor you need to add an eventhandler to the vehicle that deletes the fire after 60 seconds or whatever time you want.

So in the end of your script put:

_veh addMPEventHandler ["MPkilled",{

	_sleep = _this spawn {

		params ["_veh"];
		sleep 5;

		{

			_obj = _x;
			_emitters = _obj getvariable ["effects",[]];

			{deletevehicle _x} forEach _emitters;

			if (isServer) then {deletevehicle _x};

		} forEach attachedObjects _veh;
	};
}];

You might experience the burning effect is still there, but that's just the regular fire from the vehicle, the emitters from the big fire objects will be deleted.

Adjust the 5 to any time you want, anything above 60 seconds should do fine.

 

Cheers

  • Like 2

Share this post


Link to post
Share on other sites


huge thanks man !!
it works perfectly !! really thanks, i will study your code to try learn something !!
thanksssssss

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, Grumpy Old Man said:

forEach attachedObjects


Actually that would not delete the light source. Never mind because the global fix is coming.

Share this post


Link to post
Share on other sites
9 minutes ago, killzone_kid said:


Actually that would not delete the light source. Never mind because the global fix is coming.

Tested it in the editor before posting.

Tested it right now at night, no lights or emitters left. All deleted.

:yay:

 

Cheers

  • Like 1

Share this post


Link to post
Share on other sites
3 minutes ago, Grumpy Old Man said:

Tested it in the editor before posting.

Tested it right now at night, no lights or emitters left. All deleted.

:yay:

 

Cheers


Ah yeah sorry, didn't notice you are deleting all stored in variable effects instead of all attached effects. Then yes, all will go.

  • Like 1

Share this post


Link to post
Share on other sites

It works it works, thanks guys !!! 

Share this post


Link to post
Share on other sites

_myobject getvariable "effects" doesn't return anything, nor does allvariables have that variable.

Has this been removed?

Share this post


Link to post
Share on other sites
9 hours ago, Tankbuster said:

Has this been removed?

No they are still referenced, although they do now delete themselves( not so sure they originally did ).

 

Spoiler

class test_EmptyObjectForFireBig: test_EmptyObjectForBubbles
{
  author="$STR_A3_Bohemia_Interactive";
  _generalMacro="test_EmptyObjectForFireBig";
  displayName="$STR_A3_cfgVehicles_test_EmptyObjectForFireBig0";
  class EventHandlers
  {
    init="(_this select 0) call compile preprocessFile ""\A3\weapons_f\data\scripts\fire.sqf"";";
    deleted="{deleteVehicle _x} forEach (_this select 0 getVariable [""effects"",[]])";
  };
};

\A3\weapons_f\data\scripts\fire.sqf


//snip

_source06 = "#particlesource" createVehicleLocal _pos01;
_source06 setParticleClass "ObjectDestructionSmoke2x";
_source06 attachto [_object,[0,0,0]];

_li = "#lightpoint" createVehicleLocal _pos01;
_li setLightBrightness 0.08;
_li setLightAmbient [1,0.28,0.05];
_li setLightColor [1,0.28,0.05];
_li lightAttachObject [_object, [0,0,0]];

_object setVariable ["effects",[_source01,_source02,_source03,_source04,_source05,_source06,_li]];

 

_obj = createVehicle [ "test_EmptyObjectForFireBig", player getPos[10, getDir player], [], 0, "CAN_COLLIDE" ];
hint str ( _obj getVariable[ "effects", [] ] );

Will hint back the array of emitters.

  • Like 2

Share this post


Link to post
Share on other sites
On 15/12/2018 at 5:16 AM, Larrow said:

No they are still referenced, although they do now delete themselves( not so sure they originally did ).

 

  Reveal hidden contents


class test_EmptyObjectForFireBig: test_EmptyObjectForBubbles
{
  author="$STR_A3_Bohemia_Interactive";
  _generalMacro="test_EmptyObjectForFireBig";
  displayName="$STR_A3_cfgVehicles_test_EmptyObjectForFireBig0";
  class EventHandlers
  {
    init="(_this select 0) call compile preprocessFile ""\A3\weapons_f\data\scripts\fire.sqf"";";
    deleted="{deleteVehicle _x} forEach (_this select 0 getVariable [""effects"",[]])";
  };
};

\A3\weapons_f\data\scripts\fire.sqf



//snip

_source06 = "#particlesource" createVehicleLocal _pos01;
_source06 setParticleClass "ObjectDestructionSmoke2x";
_source06 attachto [_object,[0,0,0]];

_li = "#lightpoint" createVehicleLocal _pos01;
_li setLightBrightness 0.08;
_li setLightAmbient [1,0.28,0.05];
_li setLightColor [1,0.28,0.05];
_li lightAttachObject [_object, [0,0,0]];

_object setVariable ["effects",[_source01,_source02,_source03,_source04,_source05,_source06,_li]];

 


_obj = createVehicle [ "test_EmptyObjectForFireBig", player getPos[10, getDir player], [], 0, "CAN_COLLIDE" ];
hint str ( _obj getVariable[ "effects", [] ] );

Will hint back the array of emitters.

That works on the test object, but on vehicles destroyed in the mission, it doesn't. I still get empty array back

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

×