greu

killings through the walls

Recommended Posts

Hello everyone, tell me how you can turn off the killings through the walls on one or two weapons?

Share this post


Link to post
Share on other sites

In player damage callback reject all damage with level.iDFLAGS_PENETRATION flag. (Keep in mind, you will not be able to make double\triple kills.)

Share this post


Link to post
Share on other sites
Posted (edited)
19 hours ago, T-Max said:

In player damage callback reject all damage with level.iDFLAGS_PENETRATION flag. (Keep in mind, you will not be able to make double\triple kills.)

Thank you for helping, but is it possible a little more detailed, I don’t even understand where to start

 

on the example of the rifle m40a3

Edited by greu

Share this post


Link to post
Share on other sites

_globallogic.gsc has Callback_PlayerDamage script function. There you have iDFlags argument. When bullet hits player directly - it wouldn't contain  level.iDFLAGS_PENETRATION value. But when bullet hits player through wall or other player - it will contain this value. (logical AND is enough to check).

sWeapon may contain m40a3_mp or m40a3_acog_mp in case if player was hit using these weapons.

Share this post


Link to post
Share on other sites
Posted (edited)

    if ( sWeapon == m40a3_mp&&m40a3_acog_mp && iDFlags & level.iDFLAGS_PENETRATION )
        return;

 

maybe this should be so?

Edited by greu

Share this post


Link to post
Share on other sites

bulet()
{
    while (1)  //cycle
    {
    self waittill("weapon_change", weapon); //waiting for a choice of weapons
    if (self.sWeapon == "mp44_mp" && self.iDFLAGS_PENETRATION)  //if the player has weapons mp44_mp, then idflags with the variable _PENETRATION
        wait 1;
        return;
    }
    
}

wrote comments, as I understand it

Edited by greu

Share this post


Link to post
Share on other sites

You dont need a separate function. As T-Max posted, in the player damage callback, in global logic, you can add a line to it that checks for this condition along with all the rest such as team kills and juggy. For testing, somewhere near the top will work best. Then you can look for odd scenarios where it shouldnt prevent damage. A simplified version to get you started.

if ( sWeapon == "mp44_mp" && iDFlags & level.iDFLAGS_PENETRATION )
{
if( isPlayer( eAttacker) ) //For testing.
eAttacker iprintln("PD callback. idFlags penetration check for mp_44. No Damage done to victim." );
return;
}

As posted above, the drawback is that you wont get multikills from a single round because going through a player body registers as a penetration flag no different than passing through a wall. If you are using an open warfare based mod, with their framework, in global logic look for these lines that do the same kind thing. If you turn off damage through walls then do nothing.

if ( level.scr_bullet_penetration_enabled == 0 && iDFlags & level.iDFLAGS_PENETRATION )
return;

  • Thanks 1

Share this post


Link to post
Share on other sites
10 hours ago, Sheryl said:

You dont need a separate function. As T-Max posted, in the player damage callback, in global logic, you can add a line to it that checks for this condition along with all the rest such as team kills and juggy. For testing, somewhere near the top will work best. Then you can look for odd scenarios where it shouldnt prevent damage. A simplified version to get you started.

if ( sWeapon == "mp44_mp" && iDFlags & level.iDFLAGS_PENETRATION )
{
if( isPlayer( eAttacker) ) //For testing.
eAttacker iprintln("PD callback. idFlags penetration check for mp_44. No Damage done to victim." );
return;
}

As posted above, the drawback is that you wont get multikills from a single round because going through a player body registers as a penetration flag no different than passing through a wall. If you are using an open warfare based mod, with their framework, in global logic look for these lines that do the same kind thing. If you turn off damage through walls then do nothing.

if ( level.scr_bullet_penetration_enabled == 0 && iDFlags & level.iDFLAGS_PENETRATION )
return;

 

 

Thanks for the help. I have it spelled out like that

    if ( level.scr_bullet_penetration_enabled == 0 && iDFlags & level.iDFLAGS_PENETRATION )   equally 1 // here the killings through the walls are off
        return;

 

 

 

Callback_PlayerDamage( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, psOffsetTime )
{
    self.iDFlags = iDFlags;
    self.iDFlagsTime = getTime();

    if ( game["state"] == "postgame" )
        return;

    if ( self.sessionteam == "spectator" )
        return;

    if ( isDefined( self.canDoCombat ) && !self.canDoCombat )
        return;

    if ( level.inStrategyPeriod )
        return;

    if ( level.inTimeoutPeriod && level.timeoutTeam != self.pers["team"] )
        return;

    if ( isDefined( eAttacker ) && isPlayer( eAttacker ) && isDefined( eAttacker.canDoCombat ) && !eAttacker.canDoCombat )
        return;

    if ( level.gametype == "ftag" && self.freezeTag["frozen"] )
        return;
        
    if ( level.scr_bullet_penetration_enabled == 0 && iDFlags & level.iDFLAGS_PENETRATION )
        return;
        
    if ( sWeapon == "mp44_mp" && iDFlags & level.iDFLAGS_PENETRATION )
        {
        if( isPlayer( eAttacker) ) //For testing.
        eAttacker iprintln("
PD callback. idFlags penetration check for mp_44. No Damage done to victim" );
        return;
        }        
        
  if ( ( isDefined( self.spawn_protected ) && self.spawn_protected )  && (sMeansOfDeath == "MOD_FALLING") )
      return;

Share this post


Link to post
Share on other sites

if ( ( isDefined( self.spawn_protected ) && self.spawn_protected ) && (sMeansOfDeath == "MOD_FALLING") )
return;

Watch out for that one. No real need for MOD_FALLING in player damage checks. Players should still receive damage from falling, spawn protected or not, to keep them from using it to their advantage to get into areas they should not be. Its a pain in the ass but every line of code you write you must ask yourself:

"How can I use this to exploit or cheat? Because if I can, I will."

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.