AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   dealing Extra Damage to func_breakable (https://forums.alliedmods.net/showthread.php?t=317625)

Ynet 07-21-2019 17:00

dealing Extra Damage to func_breakable
 
so lets say that i want to make it so that players will be able to destroy vents as twice as fast than what it would usually take how do i deal damage to the entity?

PHP Code:

RegisterHam(Ham_TakeDamage"func_breakable""Breakable_damage"true);

public 
Breakable_damage(thisAttackerboolbGib)
{


    
//how to deal damage to (this) ??

    
    
return HAM_HANDLED


i tried ham_takedamage didn't work very well ;p

OciXCrom 07-21-2019 17:17

Re: dealing Extra Damage to func_breakable
 
First of all you need to register the event as "pre", not "post". Set the last parameter in "RegisterHam" to "false". In "post" you cannot change the damage, as it's already been done. "pre" is called before dealing the damage.

Your arguments in the "Breakable_damage" function are wrong. Take a look at the API. They should be:

PHP Code:

victiminflictorattackerFloat:damagedamage_bits 

Now you need to modify the 4th argument (damage). Doubling it should make the entity die twice as fast.

PHP Code:

SetHamParamFloat(4damage 2


Ynet 07-21-2019 17:25

Re: dealing Extra Damage to func_breakable
 
Quote:

Originally Posted by OciXCrom (Post 2660088)
First of all you need to register the event as "pre", not "post". Set the last parameter in "RegisterHam" to "false". In "post" you cannot change the damage, as it's already been done. "pre" is called before dealing the damage.

Your arguments in the "Breakable_damage" function are wrong. Take a look at the API. They should be:

PHP Code:

victiminflictorattackerFloat:damagedamage_bits 

Now you need to modify the 4th argument (damage). Doubling it should make the entity die twice as fast.

PHP Code:

SetHamParamFloat(4damage 2




aight it worked thanks alot mate appreciete it


All times are GMT -4. The time now is 00:05.

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