Garry's Mod

Garry's Mod

[E2] DamageCore
Sir Papate  [developer] 16 Jan, 2014 @ 7:58pm
Documentation
Functions
Domage Type Enumerations

Function Return Description runOnDmg(N) runOnDmg(N,E) runOnDmg(N,R) E:trackDamage() E:stopTrackDamage() damage() DMG Retruns an empty damage. dmgClk() N Retruns the clk. lastDamage() DMG Retruns the last damage. lastDamageVictim() E Returns the last victim.
Function Return Description DMG:getDamage() N Returns damage. DMG:getAttacker() E Returns the attacker of damage. DMG:getForce() V Returns a vector representing the damage force. DMG:getPosition() V Returns the position where the damage was or is going to be applied to. DMG:getType() N Returns a bitflag which indicates the damage type of the damage. DMG:getInflictor() E Returns the inflictor of the damage. This is not necessarily a weapon. DMG:isBulletDamage() N Returns 1 if the damage was caused by a bullet. DMG:isExplosionDamage() N Returns 1 if the damage contains explosion damage. DMG:isFallDamage() N Returns 1 if the damage contains fall damage. DMG:setDamage(N) Sets the amount of damage. DMG:setAttacker(E) Sets the attacker of the damage. DMG:setForce(V) Sets the directional force of the damage. DMG:setPosition(V) Sets the position of where the damage gets applied to. DMG:setType(N) Sets the damage type. DMG:setInflictor(E) Sets the inflictor of the damage for example a weapon.
Function Description E:takeDamage(DMG) Applies the damage specified by the damage info to the entity. E:takeDamage(N) Applies the specified amount of damage to the entity. (Damage) E:takeDamage(N,E) Applies the specified amount of damage to the entity. (Dmage, Attacker) E:takeDamage(N,E,E) Applies the specified amount of damage to the entity. (Dmage, Attacker, Inflector) blastDamage(DMG,V,N) Applies spherical damage based on damage info to all entities in the specified radius. (Damage, Position, Radius) blastDamage(E,E,V,N,N) Applies explosion damage to all entities in the specified radius. (Attacker, Inflector, Position, Radious, damage)

Old Functions, but still working.
Function Description E:dmgApplyDamage(N) Applies the damage specified by the damage info to the player.
Function Return Description dmgDamage() N Returns the total damage. dmgVictim() E Return the entity taking damage. dmgAttacker() E Returns the attacker for example a player that shot the weapon. dmgInflictor() E Returns the inflictor of the This is not necessarily is a weapon. dmgPos() V Returns the position where the damage was or is going to be applied to. dmgForce() V Returns a vector representing the damage force. dmgType() S Returns type of the damage.

For the PlayerCore WorkShop, click here.
For the WeaponCore WorkShop, click here.
Last edited by Sir Papate; 22 Oct, 2016 @ 3:30pm
< >
Showing 1-15 of 18 comments
OUIIJM GUIITPS 5 Dec, 2015 @ 7:12pm 
What do you mean specified by the damage info?

like

owner():dmgApplyDamage(10000)
does not work
>me bee 29 Jan, 2016 @ 7:28pm 
The "dmgApplyDamage" does not work, it always throws an error everytime I want to apply damage to a player entity, and apparently it's in the script for the extension.
OUIIJM GUIITPS 30 Jan, 2016 @ 10:18pm 
Originally posted by Mudkip:
The "dmgApplyDamage" does not work, it always throws an error everytime I want to apply damage to a player entity, and apparently it's in the script for the extension.
Indeed. There was a way to use it, i just forgot how ill keep you updated if i find it
>me bee 31 Jan, 2016 @ 9:07am 
Originally posted by Alex')DROP TABLE Players--:
i just forgot how ill keep you updated if i find it

What do you mean by that
I get notifications if there are new comments here
Last edited by >me bee; 31 Jan, 2016 @ 9:07am
OUIIJM GUIITPS 31 Jan, 2016 @ 11:57am 
Originally posted by Mudkip:
Originally posted by Alex')DROP TABLE Players--:
i just forgot how ill keep you updated if i find it

What do you mean by that
I get notifications if there are new comments here
Yeah ill say here if i figure it out
BaboucheOne 22 Oct, 2016 @ 3:25pm 
Originally posted by Mudkip:
The "dmgApplyDamage" does not work, it always throws an error everytime I want to apply damage to a player entity, and apparently it's in the script for the extension.

Try to indicate if the entity target is valid.

if(Ent:isValid())
{
//Code
}
Sanders 22 Feb, 2017 @ 4:23pm 
in trying to do this if(Power & ONN:count() != 0){ONN[1,entity]:dmgApplyDamage(2000)}
L=holoEntity(1):getConstraints() but when i wanna have an input of like L or anything it does not wanna go valid nor will it work
BaboucheOne 24 Feb, 2017 @ 8:49am 
Originally posted by NSA☆☆SANDERS☆☆:
in trying to do this if(Power & ONN:count() != 0){ONN[1,entity]:dmgApplyDamage(2000)}
L=holoEntity(1):getConstraints() but when i wanna have an input of like L or anything it does not wanna go valid nor will it work


Hi,

You cannot put constraints on holoEntitys that why it does an error !
I hope this is your problem because I do not realy understand you question...

bye :O
Sanders 25 Feb, 2017 @ 2:18am 
im trying to get it so what ever the holo is parented to it will damage it (if its npc or plyer) i know it wouldnt damage a prop
Sanders 6 Mar, 2017 @ 6:28pm 
Originally posted by Alexwall"quit:
What do you mean specified by the damage info?

like

owner():dmgApplyDamage(10000)
does not work

lol that does work i tested it just today
StonerRabbit 14 Sep, 2017 @ 4:13pm 
Originally posted by LUMOS ☆☆SANDERS☆☆:
Originally posted by Alexwall"quit:
What do you mean specified by the damage info?

like

owner():dmgApplyDamage(10000)
does not work

lol that does work i tested it just today


Originally posted by BaboucheOne:
Originally posted by Mudkip:
The "dmgApplyDamage" does not work, it always throws an error everytime I want to apply damage to a player entity, and apparently it's in the script for the extension.

Try to indicate if the entity target is valid.

if(Ent:isValid())
{
//Code
}

This is probably because of the prop protection :P
>me bee 15 Sep, 2017 @ 1:24am 
apart from being late for several months, how can prop protection interfere with a player entity?
BaboucheOne 16 Sep, 2017 @ 6:42am 
Originally posted by Undeadhero:
Originally posted by LUMOS ☆☆SANDERS☆☆:

lol that does work i tested it just today


Originally posted by BaboucheOne:

Try to indicate if the entity target is valid.

if(Ent:isValid())
{
//Code
}

This is probably because of the prop protection :P

[If I remenber well the conversation]
Not because of the props protection because I'm admin, more because most of time people apply dmg on player and after add some params to this player, but... the player is dead then cannot ! because the variable is set to "null" so we put a 'isValid'
Seleramis 24 Jul, 2019 @ 6:18am 
I want to get the amount of damage an entity has taken. I tried DMG:getDamage() but it's not working.
Last edited by Seleramis; 24 Jul, 2019 @ 6:24am
>me bee 24 Jul, 2019 @ 10:53am 
First off, you could've made a new thread rather than necro a 2-to-3 year old thread.
< >
Showing 1-15 of 18 comments
Per page: 1530 50