Setting dead players on fire

Post your scripting questions / solutions here

Moderator: Moderators

User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Setting dead players on fire

Post by tltrude »

In the Elite Force 2 map I am converting to Mohaa there is a new type of function entity called "func_explodeobject" and it seem to work in mohaa.

Anyway, I have a window set with it that explodes when players break it. There is a setthread that sets off a hall fire model and kills the player, but I would like the player's body to burn untill it vanishes. The problem is that the fire appears where the player died (on the healthpack) and not on the body. Any help would be great!

Code: Select all

//*** --------------------------------------------
//*** "Gas Window threads"
//*** --------------------------------------------

gas_window:
	
	wait .2
	$gas_window_fire anim start
	iprintln "GAS! GAS! GAS!"
	wait .2
	local.nothappy = parm.other
	local.fire = spawn script_model angle "-1"
	local.fire model "emitters/firegood.tik"
	local.fire.origin = local.nothappy.origin + (0 0 24)
	local.fire.scale = .75
	local.nothappy damage local.nothappy 110 local.nothappy (0 0 0) (0 0 0) (0 0 0) 1 2 6 0
	$gas_killer1 remove // trigger in front of window
	wait 10
	local.fire remove
	thread gaskill  // gas leak inside the window room
end

gaskill:

while (1)
	{
	wait 1
	radiusdamage $gas_killer2.origin 20 48
	}
	waitframe

end
If anyone has the game "Elite Force 2" I could sure use the .cpp file (code folder file) for the func_explodeobject--because I have no idea what the spawnflags for it do.
Tom Trude,

Image
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

The origin of the player is at his feet, so maybe you should try putting the fire in the chestal area. Try adding these lines:

Code: Select all

local.where = local.nothappy gettagposition "Bip01 Spine2"
local.fire.origin = local.where
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

spine2

Post by tltrude »

I already added 24 units on the Z axis to bring it up off the floor. Using your lines just moves the fire to where the players back was when he died.



Image

There is a code for making it stick with the player at death:

local.fire.detach_at_death = 0

But, using it makes the fire stay with the player when he respawns, and not on the body. A player can respawn before his dead body vanishes, which is how I took the screenshot by the way. I guess what I need is the targetname the game assigns to the body, or a way to leave the fire behind when the player respawns.
Tom Trude,

Image
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

what about this ?

local.fire attach local.nothappy "Bip01 Spine2"

I did a map where I attached JV's avatar to a dogs head this way . When the dog died the avatar disappeared a few seconds after the body.
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

no fire

Post by tltrude »

That didn't work at all because the fire did not even show up.

Code: Select all

//*** --------------------------------------------
//*** "Gass Window threads"
//*** --------------------------------------------

gas_window:
	
	wait .2
	$gas_window_fire anim start
	iprintln "GAS! GAS! GAS!"
	wait .2
	local.nothappy = parm.other
	if (local.nothappy istouching $gas_killer1)
	{
		local.fire = spawn script_model angle "-1"
		local.fire model "emitters/firegood.tik"
		//local.where = local.nothappy gettagposition "Bip01 Spine2" 
		//local.fire.origin = local.where
		//local.fire.origin = local.nothappy.origin + (0 0 24)
		local.fire attach local.nothappy "Bip01 Spine2"
		local.fire.scale = .75
		//local.fire.detach_at_death = 0
		local.nothappy damage local.nothappy 110 local.nothappy (0 0 0) (0 0 0) (0 0 0) 1 2 6 0
		$gas_killer1 remove
		wait 9.5
		local.fire remove
	}
	thread gaskill
end

gaskill:

while (1)
	{
	wait 1
	radiusdamage $gas_killer2.origin 20 48
	}
	waitframe

end
Tom Trude,

Image
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

have you tried vectoring the angles and then moving up the height of the body required?
hope this helps, prob not cos it's all foreign 2 me :-/
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

so basically, you want it to stay on the dead guy's back?
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Post by tltrude »

nuggets - How do I vector the angles to the body if I don't know the targetname for it? The body does not always fall the same direction, but I can get the fire at the right height above the floor.


Alcoholic - Yes, I want it to look like he was set on fire by the (hall fire) explosion.
Last edited by tltrude on Wed Sep 10, 2003 4:01 am, edited 1 time in total.
Tom Trude,

Image
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

Try to make your own sort of "glue" or "bind". In your gas_window thread add this:

Code: Select all

local.nothappy thread fire_glue local.fire
And have your fire_glue thread like this:

Code: Select all

fire_glue local.fire:

local.starttime = level.time
local.stoptime = (level.time + 4)

while (1)
{
     waitframe
     if (isalive self) //player respawned
     {
          end
     }

     if (level.time >= local.stoptime) //if its been 4 seconds
     {
          end
          //we stop because i dont think any death anims last 4 seconds...
     }

     local.where = self gettagposition "Bip01 Spine2"
     local.fire.origin = local.where.origin
}
end
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Alcoholic's way is probably the best . I was wrong anyway the avatars didn't dissapear I removed them after death . I had a simular problem with binding a trigger only way seemed to be to just keep moveing the trigger binding or glueing didn't work too well .
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

respawn

Post by tltrude »

That's fine, but I wanted the fire to stay with the body and not vanish when the player respawns. A body will last about 8-10 seconds after a player dies.

The map is almost done, so I may have to scrap the whole idea.

EF2 Axis Station
Image
Tom Trude,

Image
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Maybe if you do this

fire_glue local.fire:
while (isalive self)
{
waitframe
local.where = self gettagposition "Bip01 Spine2"
local.fire.origin = local.where.origin
}
waitframe
local.fire droptofloor // I have never tried this but may work
wait 10
local.fire remove
end

the thread will end leaveing the local.fire on the floor at the last origin of the player
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

while !(isalive self)
{local.fire.angles = (vector_toangles (self.origin - attacker.origin))}
hope this helps, prob not cos it's all foreign 2 me :-/
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

Ugh, time to get lost in vector maths. :roll:
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Wahoo!

Post by tltrude »

Local Nothappy is happy now! I got it working by adding a wait--so that the death animation can finish before the fire is spawned.

Image

Here is the threads, if anyone else want to use them. This "body-on-fire" could also be used for a high voltage electrocution thread or anything that uses fire to kill.

Code: Select all

//*** --------------------------------------------
//*** "Gass Window threads"
//*** --------------------------------------------

gas_window:
	
	wait .2
	$gas_window_fire anim start
	iprintln "GAS! GAS! GAS!"
	wait .2
	local.nothappy = parm.other
	if (local.nothappy istouching $gas_killer1)
	{
		local.nothappy damage local.nothappy 120 local.nothappy (0 0 0) (0 0 0) (0 0 0) 1 2 6 0
		wait 1
		local.fire = spawn script_model angle "-1"
		local.fire model "emitters/firegood.tik"
		local.fire.scale = .75 
		local.fire.origin = local.nothappy.origin + (0 0 16)
		local.player = parm.other
		$gas_killer1 remove
		wait 9.5
		local.fire remove
		$gas_window_fire remove
	}
	thread gaskill
end

gaskill:

while (1)
	{
	wait 1
	radiusdamage $gas_killer2.origin 20 48
	}
	waitframe

end
Tom Trude,

Image
Post Reply