Jump to content
mcslavko

Explosion and fire script

Recommended Posts

Hi all

 

I want to use the explosion and fire script (DKM) but I have a problem, the effect itself is short ... which parameter is responsible for the length of the fire and smoke effect? At this moment they both disappear together, and it would be good if the fire first extinguished before the smoke disappeared.

 

thank you in advance for your help

 

mentioned script:

 

_t = _this 

?format["%1", _t] == "scalar bool array string 0xfcffffef": exit
?count (getpos _t) > 0: goto "nobug"
exit
#nobug

[_t] exec "\effects\kia_sparksandshock.sqs"

? "Air" countType [_t] == 1: _gl = "logic" createVehicle [getpos _t select 0,getpos _t select 1,0]; _gl setpos getpos _t; _gl setDir (getDir _t); [_gl,_t,3] exec "\effects\dustwaveA.sqs"
? "LandVehicle" countType [_t] == 1: [_t,3] exec "\effects\dustwave.sqs" 

~1.5

? "LandVehicle" countType [_t] == 1 && random 1.0001 > 0.5: _logic = "logic" createVehicle getpos nearestObject [_t,"crater"]; _logic setpos getpos nearestObject [_t,"crater"]; [_logic,0,0 + random 0.2,10 + random 5] exec "\effects\hotground.sqs"

~random 1.5
_h = .1
@ (getpos _t select 2) < 5
_f = "nmod_smoke" createvehicle getpos _t
_s = "nmod_fire" createvehicle getpos _t
_ar = [_f,_s]
_timer = 0 
_bsay = 1
_hsay = 1
_f inflame true
_s inflame true
_anumb = 1.3

private ["_sensor"];
_sensor = "EmptyDetector" createVehicle [0,0,0]
_calcH = {private["_result"]; _sensor setpos [getpos _t select 0, getpos _t select 1]; _result = getpos _sensor select 2; _result};

    _i = Random (3)
    _i = _i - (_i Mod 1)
    ? _i == 1: _t exec "\effects\fuelboom.sqs"

#cycle
    goto "smoke"
#explosion

#smoke

_f inflame true
_s inflame true

_anumb = 1.3

? abs (call _calcH) <= 2.4: "deletevehicle _x" foreach _ar; exit

? (vehicle player != player): goto "skip"
? (player distance _f < 7) && _hsay == 1: player globalChat "Getting kind of hot here..."; _hsay = 0
? (player distance _f < 4) && alive player: TitleText ["", "black faded",random 0.1]
? (player distance _f < 4) && _bsay == 1: player globalChat "Argh, I'm getting burned!"; _bsay = 0
? (player distance _f < 4): player setDamage (damage player) + 0.01
#skip
? (getpos _t select 2 > 3): _anumb = getpos _t select 2

    drop ["cl_fire" , "" , "Billboard" , 1 , 5 + random 5, [getpos _t select 0,getpos _t select 1,1.3] , [random 2 - random 2,random 2 - random 2,2 + random 2] , 1 , 1 , 1 , 0.2 , [random 0.09] , [[1,1,1,1],[1,1,1,0.75],[1,1,1,0.50],[0,0,0,0]] , [0,1] , 0 , 0.1 , "" , "" , ""]
    _f inflame true
    _s inflame true
    "_x setpos [getpos _t select 0, getpos _t select 1,_anumb]" foreach _ar
    ~_h
    _timer = _timer + _h 
    ? _timer == 20 : _h = 1
    ? _timer < 20 : goto "cycle"
    ? _timer < 120 : goto "smoke" 

"deletevehicle _x" foreach _ar
exit

 

 

Share this post


Link to post
Share on other sites

Hi mate,

 

i can't test cause i don't have the necessary addon but replace the following lines at the end of the script :

 

    ? _timer == 20 : _h = 1
    ? _timer < 20 : goto "cycle"
    ? _timer < 120 : goto "smoke" 

"deletevehicle _x" foreach _ar
exit

 

By :

 

    ? _timer == 20 : _h = 1
    ? _timer < 20 : goto "cycle"
    ? _timer < 120 : goto "smoke" 

deletevehicle _s

	? _timer < 240 : goto "smoke" 

deletevehicle _f              
              
exit

If i understand well, "nmod_smoke" is the smoke and it's called here _f (which is weird, i would have called it _s), and "nmod_fire" is the fire and it's called _s.

 

You should have the smoke last twice longer than the fire. You can change "120" and "240" by the values you prefer.

 

Share this post


Link to post
Share on other sites

thanks for help but unfortunately it doesn't work :down: changing the value of "timer" doesn't change how long the effect lasts. Additionally, the spark effect and fire sound are still there

Share this post


Link to post
Share on other sites

Ok, the best way would be to get that addon and try it by myself. Thats script is strangely written, it must have been changed a few times aleady. Could you point me to that addon (dl link ?). Thee must be some pbo, not only script.

Share this post


Link to post
Share on other sites
_t = _this 

?format["%1", _t] == "scalar bool array string 0xfcffffef": exit
?count (getpos _t) > 0: goto "nobug"
exit
#nobug

[_t] exec "\ffur_effects\kia_sparksandshock.sqs"

? "Air" countType [_t] == 1: _gl = "logic" createVehicle [getpos _t select 0,getpos _t select 1,0]; _gl setpos getpos _t; _gl setDir (getDir _t); [_gl,_t,3] exec "\ffur_effects\dustwaveA.sqs"
? "LandVehicle" countType [_t] == 1: [_t,3] exec "\ffur_effects\dustwave.sqs" 

~1.5

? "LandVehicle" countType [_t] == 1 && random 1.0001 > 0.5: _logic = "logic" createVehicle getpos nearestObject [_t,"crater"]; _logic setpos getpos nearestObject [_t,"crater"]; [_logic,0,0 + random 0.2,10 + random 5] exec "\ffur_effects\hotground.sqs"

~random 1.5
_h = .1
@ (getpos _t select 2) < 5
_f = "nmod_smoke" createvehicle getpos _t
_s = "nmod_fire" createvehicle getpos _t
_ar = [_f,_s]
_timer = 0 
_bsay = 1
_hsay = 1
_f inflame true
_s inflame true
_anumb = 1.3

private ["_sensor"];
_sensor = "EmptyDetector" createVehicle [0,0,0]
_calcH = {private["_result"]; _sensor setpos [getpos _t select 0, getpos _t select 1]; _result = getpos _sensor select 2; _result};

	_i = Random (3)
	_i = _i - (_i Mod 1)
	? _i == 1: _t exec "\ffur_effects\fuelboom.sqs"

#cycle
_f inflame true
_s inflame true

#smokeandfire

_anumb = 1.3

? abs (call _calcH) <= 2.4: "deletevehicle _x" foreach _ar; exit

? (vehicle player != player): goto "skip"
? (player distance _f < 7) && _hsay == 1: player globalChat "Getting kind of hot here..."; _hsay = 0
? (player distance _f < 4) && alive player: TitleText ["", "black faded",random 0.1]
? (player distance _f < 4) && _bsay == 1: player globalChat "Argh, I'm getting burned!"; _bsay = 0
? (player distance _f < 4): player setDamage (damage player) + 0.01
#skip
? (getpos _t select 2 > 3): _anumb = getpos _t select 2

	drop ["cl_fire" , "" , "Billboard" , 1 , 5 + random 5, [getpos _t select 0,getpos _t select 1,1.3] , [random 2 - random 2,random 2 - random 2,2 + random 2] , 1 , 1 , 1 , 0.2 , [random 0.09] , [[1,1,1,1],[1,1,1,0.75],[1,1,1,0.50],[0,0,0,0]] , [0,1] , 0 , 0.1 , "" , "" , ""]

	"_x setpos [getpos _t select 0, getpos _t select 1,_anumb]" foreach _ar
	~_h
	_timer = _timer + _h 
	? _timer == 20 : _h = 1
	? _timer < 20 : goto "smokeandfire"
	? _timer < 120 : goto "smokeandfire" 

_s inflame false

#smokeonly

_anumb = 1.3

? abs (call _calcH) <= 2.4: "deletevehicle _x" foreach _ar; exit

? (getpos _t select 2 > 3): _anumb = getpos _t select 2

	"_x setpos [getpos _t select 0, getpos _t select 1,_anumb]" foreach _ar
	~_h
	_timer = _timer + _h 
	? _timer < 180 : goto "smokeonly" 

"deletevehicle _x" foreach _ar

exit

 

Hi, i modified the original script and it works well.

 

You can adapt the value of the timer (120 and 180) to your needs.

I also removed damage effect and sparking effect when the fire is over.

Share this post


Link to post
Share on other sites

unfortunately it doesn't work, value of the timer = 120 It turns out that it is responsible for the sparks and the sound of fire, the change of this value actually lengthens this time

 

The fire effect disappears after a short time  :down:

Share this post


Link to post
Share on other sites

Is there maybe somewhere this time the fire effect?

 

drop ["cl_fire" , "" , "Billboard" , 1 , 5 + random 5, [getpos _t select 0,getpos _t select 1,1.3] , [random 2 - random 2,random 2 - random 2,2 + random 2] , 1 , 1 , 1 , 0.2 , [random 0.09] , [[1,1,1,1],[1,1,1,0.75],[1,1,1,0.50],[0,0,0,0]] , [0,1] , 0 , 0.1 , "" , "" , ""]

Share this post


Link to post
Share on other sites

I'm sorry i don't understand what you exactly want. The script i posted works well, i tried it. It stops the fire and sparking and dammage effect when _timer reaches 120, then it stops the script when _timer reach 180.

 

The sound you here doesn't come from the script but from the 'fire'/'smoke' (nmod_fire and nmod_smoke) objects created, inheriting from the camp fire object. 

 

It can be changed (removing the "fire" sound from the smoke object), but you have to edit ffur effect config.cpp and add :

 

sound="";

like this :

 

class nmod_smoke:nmod_fire
		{

		class Light
			{
			Shape="koulesvetlo";
			color[]={1,0.54,0,1};
			ambient[]={1,0.3,0,1};
			position="";
			size=0.25;
			brightness=0.6;
			sound="";
			};

		class Smoke
			{
			interval=0.3;
			cloudletDuration=30;
			cloudletAnimPeriod=1.0;
			cloudletSize=2.5;
			cloudletAlpha=0.7;
			cloudletGrowUp=3.5;
			cloudletFadeIn=0.01;
			cloudletFadeOut=8.0;
			cloudletAccY=0.5;
			cloudletMinYSpeed=0.5;
			cloudletMaxYSpeed=5.0;
			cloudletShape="cl_basic";
			cloudletColor[]={0.2,0.2,0.2,0.1};
			initT=1000;
			deltaT=429496679;
			maxT=0;
			density=0.5;
			size=0.1;
			initYSpeed=1.7;
			timeToLive=350;
			in=0;
			out=0;

			class Table
				{

				class T1
					{
					maxT=0;
					color[]={0.2,0.2,0.2,0.8};
					};

				class T2
					{
					maxT=900;
					color[]={0.3,0.3,0.3,0.6};
					};

				class T3
					{
					maxT=1000;
					color[]={0.3,0.3,0.3,0.3};
					};
				};

			};
		};

 

Share this post


Link to post
Share on other sites

changing the _timer value only affects the fire sound effect and sparkling effect, but not the visual fire particle effect

Share this post


Link to post
Share on other sites

yes, I've tried this but still no impact on the fire particle effect time

Share this post


Link to post
Share on other sites

I have the same, try extending the time of visual/particle fire effect to 4 minutes (240 sec)

Share this post


Link to post
Share on other sites

Ok, i finally understood what the problem was : it's the fire object (nmod_fire) which has a limited time to live set to 150 (contrary to the smoke object which has a time to live set to 350).

 

So you'll have to edit the config.cpp, find the following entry :

 

class nmod_fire:All
		{
		reversed=0;
		hasDriver=0;
		picture="ivojak";
		Weapons[]={};
		magazines[]={};
		type=1;
		threat[]={0.0,0.0,0.0};
		maxSpeed=0;
		coefInside=2;
		coefInsideHeur=4.3000002;
		side=4;
		scope=0;
		simulation="fire";
		sound="Fire";
		icon="Unknown_object";
		model="empty";
		displayName="";
		accuracy=0.2;
		typicalCargo[]={};
		mapSize=0;
		cost=0;
		armor=20;

		class Light
			{
			Shape="koulesvetlo";
			color[]={1.0,0.6,0.0,1.0};
			ambient[]={0.7,0.2,0.0,0.0};
			position="";
			size=0.4;
			brightness=0.1;
			};

		class Smoke
			{
			interval=0.08;
			cloudletDuration=0.8;
			cloudletAnimPeriod=0.4;
			cloudletSize=0.4;
			cloudletAlpha=0.8;
			cloudletGrowUp=0.5;
			cloudletFadeIn=0.05;
			cloudletFadeOut=0.7;
			cloudletAccY=1.5;
			cloudletMinYSpeed=0.3;
			cloudletMaxYSpeed=2.5;
			cloudletMaxXSpeed=0.0;
			cloudletShape="cl_fire";
			cl_basic=0;
			cloudletColor[]={1,1,1,0};
			initT=1000;
			deltaT=-500;
			density=0.9;
			size=0.51;
			in=0;
			out=0;
			initYSpeed=0.0;
			timetolive=150.0;

			class Table
				{

            class T1
            {
               maxT=0;
               color[]={0.800000,0.800000,0.800000,0.7};
            };
            class T2
            {
               maxT=900;
               color[]={0.820000,0.8500000,0.8500000,0.6};
            };
            class T3
            {
               maxT=1000;
               color[]={0.9,0.90,0.9,"random 0.300000"};
            };

				class T4
					{
					maxT=1000;
					color[]={0.8,0.8,0.8,0.2};
					};
				};
			};
		};

 

And change the timetolive parameter to 350, for example :

 

timetolive=350.0;

I tried it, it works flawlessly.

 

Sorry for having been slow at understanding your problem :huh2:

  • Thanks 1

Share this post


Link to post
Share on other sites

YES!!!!!!!!!!!!!!!!  this is it!

 

Thanks ProfTournesol for the in-depth analysis and problem solving!

 

once again huge thanks!

Share this post


Link to post
Share on other sites

I've got another problem with the same script (as posted by ProfT). In #smokeandfire section it introduces effect of player getting burned by the fire, however it doesn't work in MP. How can I make it work?

 

Everything else works fine, but burning only in SP.

Share this post


Link to post
Share on other sites

I have the idea to move the script from "killed" to "init" by adding the script at the beginning of this line  

 

_t = _this Select 0
@ GetDammage _t >= 0.95 

 

EH "killed" is local, "init" global.

 

I hope it will work.

Share this post


Link to post
Share on other sites

Hi Slavko,

 

In SP since there is only one player the variable "player" works. In MP you have more than one player and "player" will not work. You need to send an array of the player slot names through the script (ie. [p1, p2, p3, p4, p5, p6, p7, p8, p9, p10]). The script will need some work and each mission may need a trigger to perform an "alive check".

Share this post


Link to post
Share on other sites

The problem is that it is not a script to mission only to the EH main config, now I know that it will not work :(

Share this post


Link to post
Share on other sites

The EH in the config should be OK. from what I see it is this part of the script that will not work in MP.

 

? (vehicle player != player): goto "skip"
? (player distance _f < 7) && _hsay == 1: player globalChat "Getting kind of hot here..."; _hsay = 0
? (player distance _f < 4) && alive player: TitleText ["", "black faded",random 0.1]
? (player distance _f < 4) && _bsay == 1: player globalChat "Argh, I'm getting burned!"; _bsay = 0
? (player distance _f < 4): player setDamage (damage player) + 0.01

 

Share this post


Link to post
Share on other sites

I understand, but I have a problem to run the rest of the script in "init", shows the error:    getdamage _t>=I#I 0.95': error getdamage: type array, expected object

Share this post


Link to post
Share on other sites

it works! succeeded, it works in "init"!

 

script start (based on WW4):

 

I'll check if it works in MP


_t = _this select 0

#alivecheck
~1
?(isNull _t): exit
?(alive _t): goto "alivecheck" 

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

×