AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Altering ham parameters (https://forums.alliedmods.net/showthread.php?t=244175)

GuskiS 07-14-2014 17:53

Altering ham parameters
 
I am trying to alter Ham_TakeDamage parameters with SetHamParam*.
This is how far I've got:
PHP Code:

    // Don't know if I need this temp
    
new temp victim;
    
SetHamParamEntity(1attacker);
    
SetHamParamEntity(3temp); 

But if I kill that victim, I get this DeathMsg:
Code:

Victim killed Attacker with player
I can see that that entities have swapped, but how do I change weapon to not show "player"? :D
Also, do I need that temp, or can I change those parameters directly? I will test, but answer from somebody who know for sure would help :)

EDIT: Also, what I'm trying to do is swap attacker and victim, so team damage would do damage to attacker.

klippy 07-14-2014 18:36

Re: Altering ham parameters
 
Try putting second param same as third, I heard that when you are being attack by a gun, both attacker and inflictor are one player entity. Or try putting them to attacker's gun entity, or just inflictor to gun entity. :D

GuskiS 07-14-2014 19:37

Re: Altering ham parameters
 
Setting to attacker didn't work. Will test weapons ent.

NikKOo31 07-14-2014 20:09

Re: Altering ham parameters
 
Just for testing purposes

PHP Code:

public fw_takedamage(victiminflictorattackerFloat:damagebits)
{
    if(!
is_user_alive(victim) || !is_user_connected(attacker))
        return 
HAM_IGNORED

    
if(victim != attacker)
        return 
HAM_IGNORED

    
//option 1
    
SetHamParamEntity(1attacker)
    
SetHamParamEntity(2attacker == inflictor victim:inflictor)
    
SetHamParamEntity(3victim)

    
//option 2
    /*SetHamParamFloat(4, 0.0)
    ExecuteHam(Ham_TakeDamage, attacker, attacker == inflictor ? victim:inflictor, victim, damage, bits)*/
    
return HAM_SUPERCEDE



hornet 07-14-2014 23:40

Re: Altering ham parameters
 
Quote:

Originally Posted by GuskiS (Post 2167654)
I can see that that entities have swapped, but how do I change weapon to not show "player"? :D

You never said what you wanted it to show.

GuskiS 07-15-2014 04:41

Re: Altering ham parameters
 
Attackers weapon instead of message "player".

EDIT: Victim killed Attacker with "attackerweap"

klippy 07-15-2014 05:13

Re: Altering ham parameters
 
Try leaving attacker as it is, and just swap first(this) and second(inflictor) parameter. :)

GuskiS 07-15-2014 06:30

Re: Altering ham parameters
 
Quote:

Originally Posted by NikKOo31 (Post 2167699)
Just for testing purposes

PHP Code:

public fw_takedamage(victiminflictorattackerFloat:damagebits)
{
    if(!
is_user_alive(victim) || !is_user_connected(attacker))
        return 
HAM_IGNORED

    
if(victim != attacker)
        return 
HAM_IGNORED

    
//option 1
    
SetHamParamEntity(1attacker)
    
SetHamParamEntity(2attacker == inflictor victim:inflictor)
    
SetHamParamEntity(3victim)

    
//option 2
    /*SetHamParamFloat(4, 0.0)
    ExecuteHam(Ham_TakeDamage, attacker, attacker == inflictor ? victim:inflictor, victim, damage, bits)*/
    
return HAM_SUPERCEDE



This changes "player" to weapon the actual victim(target) is carrying. I need actual attackers weapon.

Quote:

Originally Posted by KliPPy (Post 2167904)
Try leaving attacker as it is, and just swap first(this) and second(inflictor) parameter. :)

Nope, doesn't work.

Black Rose 07-15-2014 09:29

Re: Altering ham parameters
 
Create a dummy entity, set the classname to whatever weapon the attacker is using. Replace the inflictor parameter with this entity.
Don't create the entity with every event. Make one global and just change the classname.


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

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