AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Executing Ham_TakeDamage (https://forums.alliedmods.net/showthread.php?t=242927)

ezio_auditore 06-27-2014 02:00

Executing Ham_TakeDamage
 
Hello all.
I am trying to execute Ham_TakeDamage like this.
Code:
ExecuteHam(Ham_TakeDamage, iVictim, iAttacker);

Where i am wrong in this.? :shock:

YamiKaitou 06-27-2014 02:08

Re: Executing Ham_TakeDamage
 
You are missing the other parameters

Code:

        /**
        * Description:                Usually called whenever an entity takes any kind of damage.
        *                                        Inflictor is the entity that caused the damage (such as a gun).
        *                                        Attacker is the entity that tirggered the damage (such as the gun's owner).
        * Forward params:        function(this, idinflictor, idattacker, Float:damage, damagebits);
        * Return type:                Integer.
        * Execute params:        ExecuteHam(Ham_TakeDamage, this, idinflictor, idattacker, Float:damage, damagebits);
        */
        Ham_TakeDamage,


ezio_auditore 06-27-2014 02:36

Re: Executing Ham_TakeDamage
 
Then I must.

Code:
#include <hamsandwich> /*...*/ ExecuteHam(Ham_TakeDamage, iVictim, 0, iAttacker, 0.0, DMG_RADIATION);

And what is [b]Inflictor[b]

YamiKaitou 06-27-2014 02:59

Re: Executing Ham_TakeDamage
 
Re-read the Description as it answer that

HamletEagle 06-27-2014 04:16

Re: Executing Ham_TakeDamage
 
inflictor is the entity that produce a damage. attacker is the owner of inflictor.
If attacker==inflictor, then the damage was inflicted by a player.

Black Rose 06-27-2014 07:20

Re: Executing Ham_TakeDamage
 
And for compatibility with other plugins that may hook this event I suggest using ExecuteHamB().

ezio_auditore 07-03-2014 03:28

Re: Executing Ham_TakeDamage
 
O.K.

Here is some code for executig Ham_Killed.

Code:
ExecuteHamB(Ham_Killed, iVictim, iKiller, 2);

Here 2 is the shouldgib paramater.
So it makes the kill effect very ugly.
If i change shouldgib paramter to some player index, will it mean that the entity is being killed by a player? :shock:

NiHiLaNTh 07-03-2014 04:04

Re: Executing Ham_TakeDamage
 
shouldgib only defines whether killed entity should be gibbed or not. It can has 3 values:
GIB_NEVER = 0; never gib regardless last taken damage amount
GIB_NORMAL = 1; gib only when victim has taken very high damage
GIB_ALWAYS = 2; gib regardless last taken damage amount

ezio_auditore 07-04-2014 03:12

Re: Executing Ham_TakeDamage
 
So changing the ShouldGib paramater should change the killtime effect?

NiHiLaNTh 07-04-2014 04:20

Re: Executing Ham_TakeDamage
 
exactly.

Quote:

If i change shouldgib paramter to some player index, will it mean that the entity is being killed by a player? :shock:
For that just set iKiller as player index.


All times are GMT -4. The time now is 21:13.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.