This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

[Help] UTIL_RadiusDamage func_breakable NOT WORK!!!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nightfall1
Senior Member
Join Date: Aug 2008
Old 04-14-2011 , 12:04   [Help] UTIL_RadiusDamage func_breakable NOT WORK!!!
Reply With Quote #1

Frist original code:
PHP Code:
stock UTIL_RadiusDamage ( const Float:OriginCoord_e ], const Inflictor, const Attacker, const Float:Damage, const Float:Radius, const DamageBits )
{
static 
Entity;
static 
Trace;
static 
Float:AdjustedDamage;
static 
bool:InWater;
Entity NULL_ENT;
InWater UTIL_LiquidContentsOrigin );
while ( ( 
Entity find_ent_in_sphereEntityOriginRadius ) ) != NULL_ENT )
{
if ( 
Entity == Inflictor )
{
continue;
}
if ( 
pevEntitypev_takedamage ) && !zp_get_user_zombieEntity ) && !zp_get_user_last_humanEntity ) )
{
static 
Float:EntOriginCoord_e ];
static 
Float:EndPos Coord_e ];
static 
Float:Fraction;
pevEntitypev_originEntOrigin );
engfuncEngFunc_TraceLineOriginEntOriginIGNORE_MONSTERSInflictorTrace );
get_tr2TraceTR_flFractionFraction );
get_tr2TraceTR_vecEndPosEndPos );
if ( 
Fraction == 1.0 || get_tr2TraceTR_pHit ) == Entity )
{
static 
Float:DeltaCoord_e ];
static 
Float:Len;
if ( 
get_tr2TraceTR_StartSolid ) )
{
EndPos Origin;
Fraction 0.0;
}
AdjustedDamage Damage;
VectorSubtract EndPosOriginDelta );
if ( ( 
Len VectorLength Delta ) ) != 0.0 )
{
VectorScale DeltaLenDelta );
}
if ( 
Len 2.0 )
{
Len -= 2.0;
}
if ( ( 
AdjustedDamage *= ( 1.0 Len Radius ) ) <= )
{
continue;
}
if ( 
InWater || pevEntitypev_waterlevel ) > )
{
AdjustedDamage *= 0.5;
}
if ( 
Fraction != 1.0 )
{
ExecuteHamHam_TraceAttackEntityInflictorAdjustedDamageDeltaTraceDamageBits );
ExecuteHamHam_TakeDamageEntityInflictorAttackerAdjustedDamageDamageBits );
}
else
{
ExecuteHamHam_TakeDamageEntityInflictorAttackerAdjustedDamageDamageBits );
}
}
}
}

The probleme is the dmg for func_breakable will not work + error
Code:
[HAMSANDWICH] Null traceresult provided.
when I hit func_breakable...


The second code:
PHP Code:
stock UTIL_RadiusDamage ( const Float:OriginCoord_e ], const Inflictor, const Attacker, const Float:Damage, const Float:Radius, const DamageBits )
{
 static 
Entity;
 static 
Trace;
 static 
Float:AdjustedDamage;
 static 
bool:InWater;
 
 
Entity NULL_ENT;
 
InWater UTIL_LiquidContentsOrigin );
 
 while ( ( 
Entity find_ent_in_sphereEntityOriginRadius ) ) != NULL_ENT )
 {
  if ( 
Entity == Inflictor )
  {
   continue;
  }
 
  if(
pevEntitypev_takedamage))
  {
   static 
Float:EntOriginCoord_e ];
   static 
Float:EndPos   Coord_e ];
   static 
Float:Fraction;
 
   static 
Float:v;
   new 
kb get_pcvar_num(cvar_svdex_knockback)
   
kb AdjustedDamage
 
   pev
Entitypev_originEntOrigin );
 
   
engfuncEngFunc_TraceLineOriginEntOriginDONT_IGNORE_MONSTERSInflictorTrace );
 
   
get_tr2TraceTR_flFractionFraction );
   
get_tr2TraceTR_vecEndPosEndPos );
 
   if (
get_tr2TraceTR_pHit ) == Entity )
   {
    static 
Float:Delta[3];
    static 
Float:Len;
    if ( 
get_tr2TraceTR_StartSolid ) )
    {
     
EndPos Origin;
     
Fraction 0.0;
    }
 
    
AdjustedDamage Damage;
    
VectorSubtract EndPosOriginDelta );
 
    if ( ( 
Len VectorLength Delta ) ) != 0.0 )
    {
     
VectorScale DeltaLenDelta );
    }
 
    if ( 
Len 2.0 )
    {
     
Len -= 2.0;
    }
 
    if ( ( 
AdjustedDamage *= ( 1.0 Len Radius ) ) <= )
    {
     continue;
    }
 
    if ( 
InWater || pevEntitypev_waterlevel ) > )
    {
     
AdjustedDamage *= 0.5;
    }
 
    if ( 
Fraction == 1.0 )
    {
     
make_knockback EntityEntOriginv)
     
ExecuteHamBHam_TraceAttackEntityInflictorAdjustedDamageDeltaTraceDamageBits );
     
ExecuteHamBHam_TakeDamageEntityInflictorAttackerAdjustedDamageDamageBits );
    }
    else
    {
     
ExecuteHamBHam_TakeDamageEntityInflictorAttackerAdjustedDamageDamageBits );
    }
   }
  }
 }

is work for func_breakable but....
Ham_TraceAttack is not work like in frist code I try to " Weapon Physics [v2.1] " plugin from (Nomexous) and Ham_TraceAttack is not working
__________________
SIGNATURE
Nightfall1 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-14-2011 , 13:47   Re: [Help] UTIL_RadiusDamage func_breakable NOT WORK!!!
Reply With Quote #2

Mine seems to be rhoughly the same, but you can try it.

PHP Code:
#define    CLASS_NONE                0
#define CLASS_MACHINE            1
#define CLASS_PLAYER            2
#define    CLASS_HUMAN_PASSIVE        3
#define CLASS_HUMAN_MILITARY    4
#define CLASS_ALIEN_MILITARY    5
#define CLASS_ALIEN_PASSIVE        6
#define CLASS_ALIEN_MONSTER        7
#define CLASS_ALIEN_PREY        8
#define CLASS_ALIEN_PREDATOR    9
#define CLASS_INSECT            10
#define CLASS_PLAYER_ALLY        11
#define CLASS_PLAYER_BIOWEAPON    12 // hornets and snarks.launched by players
#define CLASS_ALIEN_BIOWEAPON    13 // hornets and snarks.launched by the alien menace
#define    CLASS_BARNACLE            99 // special because no one pays attention to it, and it eats a wide cross-section of creatures.

#define VectorAdd(%1,%2,%3) (%3[0] = %1[0] + %2[0], %3[1] = %1[1] + %2[1], %3[2] = %1[2] + %2[2])
#define VectorSub(%1,%2,%3) (%3[0] = %1[0] - %2[0], %3[1] = %1[1] - %2[1], %3[2] = %1[2] - %2[2])
#define VectorScale(%1,%2,%3) (%3[0] = %2 * %1[0], %3[1] = %2 * %1[1], %3[2] = %2 * %1[2])

RadiusDamage(Float:vecSrc[3], iInflictoriAttacker=0Float:flDamageFloat:flRadius=0.0iClassIgnore CLASS_NONEbitsDamageType)
{
    new 
pEntity FM_NULLENT
    
new    tr // yeah
    
new Float:flAdjustedDamageFloat:falloff
    
new Float:vecSpot[3]

    if ( 
flRadius )
    {
        
falloff flDamage flRadius
    
}
    else
    {
        
falloff 1.0
    
}

    new 
boolbInWater = (engfunc(EngFunc_PointContentsvecSrc) == CONTENTS_WATER)

    
vecSrc[2] += 1.0 // in case grenade is lying on the ground

    
if ( !iAttacker )
    {
        
iAttacker iInflictor
    
}

    
// iterate on all entities in the vicinity.
    
new Float:flTakeDamageFloat:flFractionFloat:vecEndPos[3], Float:vecViewOfs[3]
    while ((
pEntity engfunc(EngFunc_FindEntityInSpherepEntityvecSrcflRadius)) )
    {
    
/*    if( pEntity == iInflictor )
        {
            continue
        }*/
        
pev(pEntitypev_takedamageflTakeDamage)
        if ( 
flTakeDamage != DAMAGE_NO )
        {
            
// UNDONE: this should check a damage mask, not an ignore
            
if ( iClassIgnore != CLASS_NONE && ExecuteHamB(Ham_ClassifypEntity) == iClassIgnore )
            {
// houndeyes don't hurt other houndeyes with their attack
                
continue;
            }

            
// blast's don't tavel into or out of water
            
if( bInWater )
            {
                if( !
pev(pEntitypev_waterlevel) )
                {
                    continue
                }
            }
            else if( 
pev(pEntitypev_waterlevel) == )
            {
                continue
            }

        
//    ExecuteHam(Ham_BodyTarget, pEntity, vecSrc, vecSpot) // crash
            
pev(pEntitypev_originvecSpot)
            if( 
ExecuteHamB(Ham_IsPlayerpEntity) )
            {
                
pev(pEntitypev_view_ofsvecViewOfs)
                
VectorAdd(vecSpotvecViewOfsvecSpot)
            }

            
engfunc(EngFunc_TraceLinevecSrcvecSpotfalseiInflictortr );            

            
get_tr2(trTR_flFractionflFraction)
            if ( 
flFraction == 1.0 || get_tr2(trTR_pHit) == pEntity )
            {
// the explosion can 'see' this entity, so hurt them!
                
if (get_tr2(trTR_StartSolid))
                {
                    
// if we're stuck inside them, fixup the position and distance
                //    set_tr2(tr, TR_vecEndPos, vecSrc)
                //    xs_vec_copy(vecSrc, vecEndPos)
                //    set_tr2(tr, TR_flFraction, 0.0)
                //    vecEndPos = Float:{0.0,0.0,0.0}
                    
flFraction 0.0
                    flAdjustedDamage 
flDamage
                
}
                else
                {
                    
get_tr2(trTR_vecEndPosvecEndPos)
                    
VectorSub(vecSrcvecEndPosvecEndPos)
                    
flAdjustedDamage vector_length(vecEndPos) * falloff
                    flAdjustedDamage 
flDamage flAdjustedDamage;
                }

                if ( 
flAdjustedDamage 0.0 )
                {
                    
flAdjustedDamage 0.0;
                }
            
                if (
flFraction != 1.0)
                {
                    switch( 
get_tr2(trTR_iHitgroup) )
                    {
                        case 
HIT_HEAD:
                        {
                            
flAdjustedDamage *= 4.0
                        
}
                        case 
HIT_STOMACH:
                        {
                            
flAdjustedDamage *= 1.25
                        
}
                        case 
HIT_LEFTLEGHIT_RIGHTLEG:
                        {
                            
flAdjustedDamage *= 0.75
                        
}
                    }
                }
                
ExecuteHamB(Ham_TakeDamagepEntityiInflictoriAttackerflAdjustedDamagebitsDamageType )
            }
        }
    }

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-14-2011 , 13:57   Re: [Help] UTIL_RadiusDamage func_breakable NOT WORK!!!
Reply With Quote #3

Quote:
[HAMSANDWICH] Null traceresult provided.
As it says, you need to pass a valid traceresult handle.

To be used with Ham, you need to create before a handle using : new tr = create_tr2().
You must free the handle once it's used, using free_tr2( tr ).
__________________
Arkshine is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-14-2011 , 13:59   Re: [Help] UTIL_RadiusDamage func_breakable NOT WORK!!!
Reply With Quote #4

Send TraceAttack is not a good idea because it will add some multidamage that will never been proceeded.
Assuming that multidamage is cleared each time TraceAttack is sent and then ApplyMultidamage is sent, then it is ok, but i don't know if it's the case.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-14-2011 , 14:08   Re: [Help] UTIL_RadiusDamage func_breakable NOT WORK!!!
Reply With Quote #5

It doesn't matter, ApplyMultidamage won't be called.
__________________
Arkshine is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-14-2011 , 14:11   Re: [Help] UTIL_RadiusDamage func_breakable NOT WORK!!!
Reply With Quote #6

I mean if ApplyMultidamag is called later without ClearMultiDamage has been called.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-14-2011 , 14:13   Re: [Help] UTIL_RadiusDamage func_breakable NOT WORK!!!
Reply With Quote #7

ClearMultiDamage is always called before TraceAttack in the game. So, it should not be a problem.
__________________
Arkshine is offline
Nightfall1
Senior Member
Join Date: Aug 2008
Old 04-14-2011 , 15:06   Re: [Help] UTIL_RadiusDamage func_breakable NOT WORK!!!
Reply With Quote #8

good one but ...
I have a problem with chickens or their eggs)
cs_italy map of counter strike does not break, knowing that those chickens are safe func_breakable treble I shall fuck him in the ass to kill it. and sometimes on some maps does't get dmg func_breakable at all, + I shoot exact in him, I think that func_breakable is in the wall
Attached Thumbnails
Click image for larger version

Name:	bug.jpg
Views:	299
Size:	89.2 KB
ID:	84735  
__________________
SIGNATURE
Nightfall1 is offline
TheVaskov
Member
Join Date: Sep 2021
Location: Russia
Old 04-22-2023 , 07:39   Re: [Help] UTIL_RadiusDamage func_breakable NOT WORK!!!
Reply With Quote #9

PHP Code:


    
new 0
    
new Float:f_origin[3], Float:endpoint[3]
    new 
Float:f_origin_traceto[3]
    new 
i_aim[3]
    new 
float:f_aim[3]
    
pev(id_ownerpev_originf_origin)
    
f_origin[2]+=18.0
    get_user_origin
(id_owneri_aim3)

    
f_origin_traceto[0] = float(i_aim[0])
    
f_origin_traceto[1] = float(i_aim[1])
    
f_origin_traceto[2] = float(i_aim[2])

    new 
ttres create_tr2();
    
engfunc(EngFunc_TraceLinef_originf_origin_tracetoDONT_IGNORE_MONSTERSid_ownerttres)
    
get_tr2(ttresTR_vecEndPosf_origin_traceto);
    new 
hit get_tr2(ttresTR_pHit);
    
r_decal_index(ttres)
    if(
is_user_alive(hit))
    {
        
ExecuteHam(Ham_TraceAttackhitid_owner10.0f_origin_tracetottresDMG_BULLET);
    }
    
free_tr2(ttres); 
Not sure when I need make "free_tr2" but code works. and it works for func_breakable but not for every tracers.
__________________
TheVaskov is offline
hikdol
New Member
Join Date: Apr 2023
Old 04-26-2023 , 04:34   Re: [Help] UTIL_RadiusDamage func_breakable NOT WORK!!!
Reply With Quote #10

The majority of Carmax locations are open from noon to 7 PM on Sundays, but make sure to check your location's specific hours before going. what time carmax close
hikdol is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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