Jump to content
the1krisrob

Setting a unit on fire (without killing him)?

Recommended Posts

I've been messing around with an idea for a mission and basically I want to set a man on fire.


So my first move was to go to module/effects and select the fire module. I set the particle life time to 1.5 and damage to 0 and put it under a unit.


Looks great, exactly what I want. HOWEVER...


 


If I use the attachTo command to attach the module to the unit and start the mission, the module appears in the right place, perfectly under the unit, but once he starts walking, the fire just stays where he started.


It's almost like the attachTo command works and then instantly detaches.


I've tried using getPos/setPos to keep the module beneath the unit but nothing seems to work. I'm getting the feeling you can't move the module once initialization is over.


 


Anyone have any ideas how to make this work, or perhaps a better solution to simulate setting a man on fire (without damaging him)


Share this post


Link to post
Share on other sites

While I apologise that I have no skills in this area, I really hope this is figured out-it sounds great :) 

  • Like 1

Share this post


Link to post
Share on other sites

hi,

 

Try this. Execute the script in unit's init field 0 = [this] execVM "scripName.sqf"

 

It is far from perfect and it needs tweaking but it shows you how to do it.

//Fire effect script
//By Nikiller
//v0.9
//27/03/2016
//0 = [unitName] execVM "scriptName.sqf"

if !(hasInterface) exitWith {};

private ["_unit", "_velocity"];

_unit = _this select 0;

	while {alive _unit} do 
	{
		if (player distance _unit < 200) then 
		{
			_velocity = velocity _unit;
			Drop 
			[
				["\A3\data_f\ParticleEffects\Universal\Universal", 16, 10, 16], 
				"", 
				"Billboard", 
				1, 
				0.6 + random 0.4, 
				_unit selectionPosition "pelvis", 
				_velocity, 
				1, 
				0.005, 
				0.004, 
				0.038, 
				[1 + random 0.5, 2 + random 1, 3 + random 1.5 * 1.5], 
				[[0.9, 0.5 + random 0.1, 0.5 + random 0.1, 0], [0.2 + random 0.1, 0.2 + random 0.1, random 0.1, 0.3 + random 0.1], [0.9, 0.9, random 0.1, 0.3 + random 0.1 * 2], [0.9, 0.9, 0.3, 0]], 
				[0, 1],
				0.5, 
				0.05, 
				"", 
				"", 
				_unit
			];
		};
		sleep 0.001;
	};

cya.

 

Nikiller.

Share this post


Link to post
Share on other sites

the1krsrob:  My exploding barrel script has this code in it.  It finds nearby untis and attaches fires to them, then randomly plays various animations (running, squirming, rolling).  I chose to then kill the units with fire attached...except those who play the rolling right and left animations (those units survive because they rolled to put out the fire).  I apologize I don't have time to isolate the exact code for you, but if you're willing to read my scripts, everything you need is in there.  Plus its MP compatible.

  • Like 1

Share this post


Link to post
Share on other sites

The gameLogic/Module is only responsible for spawning a particle emitter, it is not the effect its self so attaching it will have no effect.

A reference to the emitter is stored on the gamelogic/Module in a variable called 'effectEmitter' and it is this that you need to attach.

Place this in your gameLogic/Modules init..

h = this spawn {
	waitUntil { count (_this getVariable [ "effectemitter", [] ]) > 0 };
	_emitter = ( _this getVariable "effectemitter" ) select 0;
	_emitter setPos getPos u1;
	_emitter attachTo [ u1 ];
};
Where U1 is the name of the unit.
  • Like 3

Share this post


Link to post
Share on other sites

The gameLogic/Module is only responsible for spawning a particle emitter, it is not the effect its self so attaching it will have no effect.

A reference to the emitter is stored on the gamelogic/Module in a variable called 'effectEmitter' and it is this that you need to attach.

Place this in your gameLogic/Modules init..

h = this spawn {
	waitUntil { count (_this getVariable [ "effectemitter", [] ]) > 0 };
	_emitter = ( _this getVariable "effectemitter" ) select 0;
	_emitter setPos getPos u1;
	_emitter attachTo [ u1 ];
};
Where U1 is the name of the unit.

 

 

Thank you so much dude, that works exactly how I wanted it to once I tweaked the positioning.

Really appreciate the help 

 

Interestingly though the flames move, but the light is left where the module is placed.

Share this post


Link to post
Share on other sites

Thank you so much dude, that works exactly how I wanted it to once I tweaked the positioning.

Really appreciate the help 

Great-looking forward to seeing some dudes on fire and running around now :)

Share this post


Link to post
Share on other sites

Well this is my floating "bad guy" for a zombie/demon themed mission. Looks pretty cool when there's a bolt of lightning and when the dust settles this dude just floating there in mid air.


SKI8Gvb.jpg?2

  • Like 1

Share this post


Link to post
Share on other sites

Well this is my floating "bad guy" for a zombie/demon themed mission. Looks pretty cool when there's a bolt of lightning and when the dust settles this dude just floating there in mid air.

 

Nice! That looks really good :)

Share this post


Link to post
Share on other sites

And this is what it looks like if you use 3 fire modules to light a zombie on fire.

I had to use 3 staggered up the body because 1 large fire would be attached to the feet of the zombie and then trail off behind him as he walked instead of rising up his body.

At the end of the video you can see the light on the ground. That's where the modules are. As Iarrow said you're not attaching the module, just the particle effect. Now to see if I can get the light to follow.

 


Share this post


Link to post
Share on other sites

hi,

 

I think you should use the same but with "effectLight".

h = this spawn {
	waitUntil { count (_this getVariable [ "effectLight", [] ]) > 0 };
	_emitter = ( _this getVariable "effectLight" ) select 0;
	_emitter setPos getPos u1;
	_emitter attachTo [ u1 ];
};

cya.

 

Nikiller.

  • Like 1

Share this post


Link to post
Share on other sites

hi,

 

I think you should use the same but with "effectLight".

h = this spawn {
	waitUntil { count (_this getVariable [ ""effectLight"", [] ]) > 0 };
	_emitter = ( _this getVariable ""effectLight"" ) select 0;
	_emitter setPos getPos u1;
	_emitter attachTo [ u1 ];
};

cya.

 

Nikiller.

Yeah that worked as well. 

 

Thank you so much 

Share this post


Link to post
Share on other sites

And this is what it looks like if you use 3 fire modules to light a zombie on fire.

I had to use 3 staggered up the body because 1 large fire would be attached to the feet of the zombie and then trail off behind him as he walked instead of rising up his body.

At the end of the video you can see the light on the ground. That's where the modules are. As Iarrow said you're not attaching the module, just the particle effect. Now to see if I can get the light to follow.

 

Would it be possible to have the exact script for this? Just a super cool idea and plan on using it for my demons :)

Share this post


Link to post
Share on other sites

Bare in mind there's probably much better ways to do this but what I did was put down 3 fire modules and put the following in their init.

h = this spawn {   waitUntil { count (_this getVariable [ "effectemitter", [] ]) > 0 };   
_emitter = ( _this getVariable "effectemitter" ) select 0;   
_emitter setPos getPos fireZombie;   
_emitter attachTo [ fireZombie, [0, .2, x], "lchodidlo" ];  };

then make that x in the last line into 0 for the first fire module, 0.6 for the second and 1 for the third and name the zombie "fireZombie"

 

Again this was a dirty hack for proof of concept, there's probably much much better and more efficient ways to do this.

Share this post


Link to post
Share on other sites

here's an alternative method from one of my scripts. the light is a little bright. but that can be easily tweaked.

_u = _this;


_l1 = "#lightpoint" createVehicleLocal getpos _u;

_l1 setLightDayLight true;

_l1 setLightColor [5, 2.5, 0];

_l1 setLightBrightness 0.1;

_l1 setLightAmbient [5, 2.5, 0];

_l1 lightAttachObject [_u, [0, 0, 0]];

_l1 setLightAttenuation [3, 0, 0, 0.6];



_source01 = "#particlesource" createVehicleLocal getpos _u;
_source01 setParticleClass "ObjectDestructionFire1Tiny";
_l1 attachTo [_u, [0,0,0], "Spine3"];

_source01 attachTo [_u, [0,0,0], "Spine3"];

  • Like 1

Share this post


Link to post
Share on other sites

The gameLogic/Module is only responsible for spawning a particle emitter, it is not the effect its self so attaching it will have no effect.

A reference to the emitter is stored on the gamelogic/Module in a variable called 'effectEmitter' and it is this that you need to attach.

Place this in your gameLogic/Modules init..

h = this spawn {
	waitUntil { count (_this getVariable [ "effectemitter", [] ]) > 0 };
	_emitter = ( _this getVariable "effectemitter" ) select 0;
	_emitter setPos getPos u1;
	_emitter attachTo [ u1 ];
};
Where U1 is the name of the unit.

 

 

Dude, I love you! :wub:

 

Thanks a lot!

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

×