Garry's Mod Wiki

CTakeDamageInfo:SetDamageForce

CTakeDamageInfo:SetDamageForce

  CTakeDamageInfo:SetDamageForce( Vector force )

Description

Sets the directional force of the damage.

This function seems to have no effect on player knockback. To disable knockback entirely, see EFL_NO_DAMAGE_FORCES or use workaround example below.

Arguments

1 Vector force
The vector to set the force to.

Example

Workaround for player knockback quenching.

local oldvel = Entity( 1 ):GetVelocity() -- Damage taking example local dmgi = DamageInfo() dmgi:SetDamageType( DMG_RADIATION ) dmgi:SetDamage( 5 ) dmgi:SetAttacker( Entity(0) ) dmgi:SetInflictor( Entity(0) ) Entity( 1 ):TakeDamageInfo( dmgi ) local newvel = Entity( 1 ):GetVelocity() Entity( 1 ):SetVelocity( oldvel - newvel )

Special Pages


Wikis

?

Render Time: 21ms

DB GetPage 2
Generate Html 3
SaveChanges (1) 7
Render Body 0
Render Sidebar 7