Limiting rocket damage to players?Solved
Does anyone have any idea how I could entirely prevent rocket damage to all players whilst keeping their building damage all the same?  The issue I run into is when I am using Damage Control and I scale explosive damage to players way back, it doesn't stop all of the damage.  When explosive damage is set to 1x it kills you of course, when at 0.01x it still does 80 damage.  I found in order to mitigate  the remaining damage I had to set blunt AND bullet damage to 0.01x.  At this point the rocket does 3 damage to players and the original amount to buildings, but now its funked up both bullet and blunt damage scales and I need those at 1.0x.  I think there should be a much easiser way.  Maybe a way to globall turn off explosive damage to players?  I tried using the WeaponDamageScaler in conjunction to sepereately stop damage from both rocket ammo and rocket launchers to all body parts but it doesnt work.
try
object OnEntityTakeDamage(BaseCombatEntity entity, HitInfo hitinfo)
{
    if (hitinfo.WeaponPrefab.ShortPrefabName.Contains("rocket"))
        return false;
    return null;
}​
 
Thank you so much for your reply Miracle, where would I put this code?  Would I be making my own cs file and plugin so to speak? Is some of the text placeholders that I need to replace? 

Try this:

class BlockRocketDamage : RustPlugin{
    object OnEntityTakeDamage(BaseCombatEntity entity, HitInfo hitinfo){
        if (hitinfo.WeaponPrefab.ShortPrefabName.Contains("rocket") && (entity is BasePlayer))
            return false;
        return null;
    }​
}


Moderator edit: Forum posts are for sharing snippets, not entire plugins. Please use PM if sharing full plugins.

Thanks Goku!  I am using this to implement rockets into a mixed age medival server so I dont break the pvp balance.  Will this block damage from all rocket ammo?  Also looking to do the same with the eoka pistol and flamethrower, no player damage to force melee combat only, I take I can probably repeat the same code with these other weapons to get the same result for them.  
pgoody
Thanks Goku!  I am using this to implement rockets into a mixed age medival server so I dont break the pvp balance.  Will this block damage from all rocket ammo?  Also looking to do the same with the eoka pistol and flamethrower, no player damage to force melee combat only, I take I can probably repeat the same code with these other weapons to get the same result for them.  

Yes this is simple, get the item short name in the: item list

and add to the list of this code:

object OnEntityTakeDamage(BaseCombatEntity entity, HitInfo hitinfo){
    var weaponList = new List<string>(){ // This is the allow weapons list
        "bow.hunting",
        "knife.bone",
        "knife.butcher",
        "knife.combat"
    };
    
    if((entity is BasePlayer))
        foreach(var shortItem in weaponList)
            if(!hitinfo.WeaponPrefab.ShortPrefabName.Contains(shortItem)) return false;

    return null;
}​

Moderator edit: Forum posts are for sharing snippets, not entire plugins. Please use PM if sharing full plugins.

Thank you!!!

Tip:

If would you like add all weapons of same short name part, example all items with "knife" in the name, you just add "knife" in the list 

Thats very easy, do I take this second list code you gave me and then transplant it onto the first such that it relaplaces everything starting at object OnEntityTakeDamage? as it looks like you switched the code from being single item oriented to a list setup, or should i leave it as is and it its own .cs file?

Only copy this:

var weaponList = new List<string>(){ // This is the allow weapons list
        "bow.hunting",
        "knife.bone",
        "knife.butcher",
        "knife.combat"
    };

    if((entity is BasePlayer))
        foreach(var shortItem in weaponList)
            if(!hitinfo.WeaponPrefab.ShortPrefabName.Contains(shortItem)) return false;

    return null;

and paste inside this:

object OnEntityTakeDamage(BaseCombatEntity entity, HitInfo hitinfo){
      // HERE
}

in the plugin

Locked automatically