Jump to content
Sign in to follow this  
mxswat

Healing gun

Recommended Posts

mxswat

Hi guys i found a way to have a "negative" damage but i don't know why is not working any more
I edited the clamps

Code:
function NewRaycastWeaponBase:_update_stats_values()
    self:_check_sound_switch()
    self._silencer = managers.weapon_factory:has_perk("silencer", self._factory_id, self._blueprint)
    self._locked_fire_mode = (not managers.weapon_factory:has_perk("fire_mode_auto", self._factory_id, self._blueprint) or not ids_auto) and managers.weapon_factory:has_perk("fire_mode_single", self._factory_id, self._blueprint) and ids_single
    self._fire_mode = self._locked_fire_mode or Idstring(self:weapon_tweak_data().FIRE_MODE or "single")
    self._ammo_data = managers.weapon_factory:get_ammo_data_from_weapon(self._factory_id, self._blueprint) or {}
    self._can_shoot_through_shield = tweak_data.weapon[self._name_id].can_shoot_through_shield
    self._can_shoot_through_enemy = tweak_data.weapon[self._name_id].can_shoot_through_enemy
    self._can_shoot_through_wall = tweak_data.weapon[self._name_id].can_shoot_through_wall
    self._armor_piercing_chance = self:weapon_tweak_data().armor_piercing_chance or 0
    self._movement_penalty = tweak_data.upgrades.weapon_movement_penalty[self:weapon_tweak_data().category] or 1
    local custom_stats = managers.weapon_factory:get_custom_stats_from_weapon(self._factory_id, self._blueprint)
    for part_id, stats in pairs(custom_stats) do
        if stats.movement_speed then
            self._movement_penalty = self._movement_penalty * stats.movement_speed
        end
        if tweak_data.weapon.factory.parts[part_id].type ~= "ammo" then
            if stats.ammo_pickup_min_mul then
                self._ammo_data.ammo_pickup_min_mul = self._ammo_data.ammo_pickup_min_mul and self._ammo_data.ammo_pickup_min_mul * stats.ammo_pickup_min_mul or stats.ammo_pickup_min_mul
            end
            if stats.ammo_pickup_max_mul then
                self._ammo_data.ammo_pickup_max_mul = self._ammo_data.ammo_pickup_max_mul and self._ammo_data.ammo_pickup_max_mul * stats.ammo_pickup_max_mul or stats.ammo_pickup_max_mul
            end
        end
    end
    if self._ammo_data then
        if self._ammo_data.can_shoot_through_shield ~= nil then
            self._can_shoot_through_shield = self._ammo_data.can_shoot_through_shield
        end
        if self._ammo_data.can_shoot_through_enemy ~= nil then
            self._can_shoot_through_enemy = self._ammo_data.can_shoot_through_enemy
        end
        if self._ammo_data.can_shoot_through_wall ~= nil then
            self._can_shoot_through_wall = self._ammo_data.can_shoot_through_wall
        end
        if self._ammo_data.bullet_class ~= nil then
            self._bullet_class = CoreSerialize.string_to_classtable(self._ammo_data.bullet_class)
            self._bullet_slotmask = self._bullet_class:bullet_slotmask()
            self._blank_slotmask = self._bullet_class:blank_slotmask()
        end
        if self._ammo_data.armor_piercing_add ~= nil then
            self._armor_piercing_chance = math.clamp(self._armor_piercing_chance + self._ammo_data.armor_piercing_add, 0, 1)
        end
        if self._ammo_data.armor_piercing_mul ~= nil then
            self._armor_piercing_chance = math.clamp(self._armor_piercing_chance * self._ammo_data.armor_piercing_mul, 0, 1)
        end
    end
    if self._silencer then
        self._muzzle_effect = Idstring(self:weapon_tweak_data().muzzleflash_silenced or "effects/payday2/particles/weapons/9mm_auto_silence_fps")
    elseif self._ammo_data and self._ammo_data.muzzleflash ~= nil then
        self._muzzle_effect = Idstring(self._ammo_data.muzzleflash)
    else
        self._muzzle_effect = Idstring(self:weapon_tweak_data().muzzleflash or "effects/particles/test/muzzleflash_maingun")
    end
    self._muzzle_effect_table = {
        effect = self._muzzle_effect,
        parent = self._obj_fire,
        force_synch = self._muzzle_effect_table.force_synch or false
    }
    local base_stats = self:weapon_tweak_data().stats
    if not base_stats then
        return
    end
    local parts_stats = managers.weapon_factory:get_stats(self._factory_id, self._blueprint)
    local stats = deep_clone(base_stats)
    local stats_tweak_data = tweak_data.weapon.stats
    local modifier_stats = self:weapon_tweak_data().stats_modifiers
    local bonus_stats = self._cosmetics_bonus and self._cosmetics_data and self._cosmetics_data.bonus and tweak_data.economy.bonuses[self._cosmetics_data.bonus] and tweak_data.economy.bonuses[self._cosmetics_data.bonus].stats or {}
    if managers.job:is_current_job_competitive() or managers.weapon_factory:has_perk("bonus", self._factory_id, self._blueprint) then
        bonus_stats = {}
    end
    if stats.zoom then
        stats.zoom = math.min(stats.zoom + managers.player:upgrade_value(self:weapon_tweak_data().category, "zoom_increase", 0), #stats_tweak_data.zoom)
    end
    for stat, _ in pairs(stats) do
        if stats[stat] < -9999 or stats[stat] > #stats_tweak_data[stat] then
            Application:error("[NewRaycastWeaponBase] Base weapon stat is out of bound!", "stat: " .. stat, "index: " .. stats[stat], "max_index: " .. #stats_tweak_data[stat], "This stat will be clamped!")
        end
        if parts_stats[stat] then
            stats[stat] = stats[stat] + parts_stats[stat]
        end
        if bonus_stats[stat] then
            stats[stat] = stats[stat] + bonus_stats[stat]
        end
        stats[stat] = math.clamp(stats[stat], -9999, #stats_tweak_data[stat])
    end
    self._current_stats_indices = stats
    self._current_stats = {}
    for stat, i in pairs(stats) do
        self._current_stats[stat] = stats_tweak_data[stat]
        if modifier_stats and modifier_stats[stat] then
            self._current_stats[stat] = self._current_stats[stat] * modifier_stats[stat]
        end
    end
    self._current_stats.alert_size = stats_tweak_data.alert_size[math.clamp(stats.alert_size, 1, #stats_tweak_data.alert_size)]
    if modifier_stats and modifier_stats.alert_size then
        self._current_stats.alert_size = self._current_stats.alert_size * modifier_stats.alert_size
    end
    if stats.concealment then
        stats.suspicion = math.clamp(#stats_tweak_data.concealment - base_stats.concealment - (parts_stats.concealment or 0), 1, #stats_tweak_data.concealment)
        self._current_stats.suspicion = stats_tweak_data.concealment[stats.suspicion]
    end
    self._alert_size = self._current_stats.alert_size or self._alert_size
    self._suppression = self._current_stats.suppression or self._suppression
    self._zoom = self._current_stats.zoom or self._zoom
    self._spread = self._current_stats.spread or self._spread
    self._recoil = self._current_stats.recoil or self._recoil
    self._spread_moving = self._current_stats.spread_moving or self._spread_moving
    self._extra_ammo = self._current_stats.extra_ammo or self._extra_ammo
    self._total_ammo_mod = self._current_stats.total_ammo_mod or self._total_ammo_mod
    self._has_gadget = managers.weapon_factory:get_parts_from_weapon_by_type_or_perk("gadget", self._factory_id, self._blueprint)
    self._scopes = managers.weapon_factory:get_parts_from_weapon_by_type_or_perk("scope", self._factory_id, self._blueprint)
    self._can_highlight_with_perk = managers.weapon_factory:has_perk("highlight", self._factory_id, self._blueprint)
    self._can_highlight_with_skill = managers.player:has_category_upgrade("weapon", "steelsight_highlight_specials")
    self._can_highlight = self._can_highlight_with_perk or self._can_highlight_with_skill
    self:_check_second_sight()
    self:_check_reticle_obj()
    self:replenish()
    local user_unit = self._setup and self._setup.user_unit
    local current_state = alive(user_unit) and user_unit:movement() and user_unit:movement()._current_state
    self._fire_rate_multiplier = managers.blackmarket:fire_rate_multiplier(self._name_id, self:weapon_tweak_data().category, self._silencer, nil, current_state, self._blueprint)
    if self:is_category("smg", "lmg", "assault_rifle", "minigun") and self:fire_mode() == "auto" or self:is_category("bow", "crossbow", "saw") then
        self._add_head_shot_mul = managers.player:upgrade_value("weapon", "automatic_head_shot_add", nil)
    end
end


Also for doing the test i was using the HE round that by default give "friendly fire"

Code:
self.wpn_fps_pis_judge.override = {
        wpn_fps_upg_a_explosive = {
        stats = {damage = -900},
            custom_stats = {
                ignore_statistic = true,
                rays = 1,
                damage_near_mul = 2,
                damage_far_mul = 2.5,
                bullet_class = "InstantExplosiveBulletBase"
            }
        }
    }


Guys this can be a very important discover for the pd2 comm!

  • Upvote 1

Share this post


Link to post
Share on other sites
Sanguin

mhm you could just had a look at the pvp option and see what it does and how it knows who could whom or who did whom damage then use that to instead doing damage add the done damage plus a choosen value ontop of that.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Stop being a peeping tom and join the community.... we got cookies

Join the crew now

Sign in

Already part of the crew? Board right here

Sign In Now

Sign in to follow this  

×