• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/
  • Weve updated the Tripwire Privacy Notice under our Policies to be clearer about our use of customer information to come in line with the EU General Data Protection Regulation (GDPR) rules that come into force today (25th May 2018). The following are highlights of our changes:


    We've incorporated the relevant concepts from the GDPR including joining the EU and Swiss Privacy Shield framework. We've added explanations for why and how Tripwire processes customer data and the types of data that we process, as well as information about your data protection rights.



    For more information about our privacy practices, please review the new Privacy Policy found here: https://tripwireinteractive.com/#/privacy-notice

How does fire work?

xmrmeow

Active member
Mar 23, 2015
1,005
7
38
OK so I know where a lot of things are in the code of the game, but one thing I still don't fully understand is where fire damage exactly "is".

I know that when firing a flamethrower at a zed, it will do damage to that zed, and apply the DoT. What I want to know is where can I change the damage it does, and where are DoT damages calculated.

What I want to do it is reduce the the on-hit damage to either 0 or a very low number, and make the DoT damage higher to compensate, as well as making ground fire last much longer, that way firebug will be all about spraying paths of fire to light up zeds and burn them to death with the DoT, rather than spraying the flamethrower directly at the zeds.

The 2 things I want to know are:
  • where is the on-hit damage on the flamethrower
  • what does the DoTDamageScale variable base it's scale off of

I believe it is the X and Y components in Spray Damage in the spray archetype but I'm not sure.


Also, does anyone know how I would go about giving a weapon an ability that has a cooldown? It'd just be something simple like fire a projectile, but using it would have a cooldown.
 
Last edited:

Pharrahnox

FNG / Fresh Meat
Feb 3, 2016
268
71
0
Cranny mate
I know this thread is old, but I hate it when I search for things and I see threads like this and wish there was an answer. So here it is:

As far as I can tell, yes, the SprayDamage.X and .Y in SprayActor_Flame are responsible for the "impact" damage. In KFSprayActor:

Code:
/** Damage amounts done at DamageInterval. X = damage closest to nozzle, Y = damage at far end of spray */
var(SprayDamage) vector2d    SprayDamage;
As for the DoT_DamageScale variable, in KFWeap_FlameBase:

Code:
static simulated function float CalculateTraderWeaponStatDamage()
{
    local float BaseDamage, DoTDamage;
    local class<KFDamageType> DamageType;

    BaseDamage = default.FlameSprayArchetype.SprayDamage.X;

    DamageType = default.FlameSprayArchetype.MyDamageType;
    if( DamageType != none && DamageType.default.DoT_Type != DOT_None )
    {
        DoTDamage = (DamageType.default.DoT_Duration / DamageType.default.DoT_Interval) * (BaseDamage * DamageType.default.DoT_DamageScale);
    }

    return BaseDamage + DoTDamage;
}
Also, in KFPawn.ApplyDamageOverTime:

Code:
NewDoTDamage = Round( Damage * KFDT.default.DoT_DamageScale );
So it appears that the damage applied on each tick of the DoT is simply the damage of the "impact" damage multiplied by the DoT_DamageScale.

To give a weapon a cooldown, you can simply use timers. Each time you perform the attack, set a timer to the cooldown duration, and each time you attempt to perform the attack, check if the timer is inactive. You can check an implementation of this in KFWeap_MeleeBase for the cooldown of parries, in the state MeleeBlocking. You would do something like:

Code:
if(!IsTimerActive(nameof(SomeTimer))) //or !IsTimerActive('SomeTimer')
{
    //perform the attack
    //reset the timer
}
And you can stick some code in that timer function if you wanted something to happen when it finished.