By Postal
Intermediate
Several times I have been asked how to make a weapon set
someone on fire.
So instead of continuing to shrug off these people, I have
decided to make a tutorial.
This code was given to me by Necron_99 and its quite simple
so this is what I’m sharing with you, I doubt that Necron would
mind.
First of all, we will make a projectile that will stick to the person and hurt them.
//===============================================
//
BurnerProj.
//===============================================
class BurnerProj expands Projectile;
var float
HurtTime;
var float LifeTime; //how long it
lives
Function Tick(float
deltatime)
{
HurtTime+=deltatime;
LifeTime-=deltatime;
if (HurtTime>0.3)
{
//Hurt the target
Base.TakeDamage(Damage,Instigator,Location,Vect(0,0,0),'Burned');
HurtTime=0;
// Basically ever .3 deltatime this hurts some
one
}
if ((LifeTime<0)||(Base==None))
{
Destroy(); //When
its life is up, it dies
}
}
defaultproperties
{
Damage=5.000000 // How much damage it does
Mesh=LodMesh'UnrealShare.FlameM' // What it looks like
bUnlit=True
}
If for instance you were making a poison gas grenade, or
poison arrow, you could always change the damage type and remove not
use that mesh.
Now we need this projectile to be attached to the person.
So in the projectile add:
simulated function
ProcessTouch (Actor Other, Vector HitLocation)
{
local
BurnerProj AnOther,FinalBurn;
if (
Other.Isa('Pawn')) // If the targets a pawn(bot, player, monster,
etc.)
{
//This makes sure a person is only set on fire
once
foreach
AllActors(class'BurnerProj',AnOther)
{
If (AnOther.Base==Other)
FinalBurn=AnOther;
}
//If that person not already on fire
If
(FinalBurn==None)
{
//Make the fire
FinalBurn=Spawn(class'BurnerProj',Instigator,,Other.Location,Other.Rotation)
//Set if to have a life time
of 1(good for flame-thrower, but if you
//are making a incendiary arrow, or so forth,
crank it up to something like 5
FinalBurn.LifeTime=1.0;
// Attaches the fire to the target
FinalBurn.SetBase(Other);
}
else
{
// If the target already on
fire, make the fire last longer.
FinalBurn.LifeTime+=5.0;
}
}
}
Hope this helps your pyromaniac urges.