Banner
Simple Mayhem Rebalance
Thumbnail
1
Downloads126
Views2,685
Publish Date2 years ago
Last Updated2 years ago by
Version1.0
Members
Avatar

Do the changes to the NPC M1014 actually sync to other clients?

Cause I wanna use that code myself for my own mod.

Avatar

I believe it should, from my understanding the host simulates damage and sends it to all other clients.

Avatar

Alright. I consulted a more experienced modder friend of mine and it seems that no it does actually cause desync so I will patch this at some point. Will probably just remove the damage penalty and keep it otherwise the same.

Avatar

@staryoshi06 Though you could probably achieve the same effect you wanted with GenSec Heavies by repurposing a ZEAL Heavy Marksman and giving him a Jackal and Bronco. Just make sure you change their tweak table name to heavy_swat

(Hook this to copbase.lua)

if Network:is_client() or StreamHeist then --Leftover from when Moon/Miki made this for me
	return
end

local difficulty = Global.game_settings and Global.game_settings.difficulty or "normal"

--[[
    difficulties and corresponding internal names, follows the format below
    in-game difficulty name / internal name / difficulty index (Thanks, Miki)

    Easy            / easy          / 1 (easy is unused)
    Normal          / normal        / 2
    Hard            / hard          / 3
    Very Hard       / overkill      / 4
    Overkill        / overkill_145  / 5
    Mayhem          / easy_wish     / 6
    Death Wish      / overkill_290  / 7
    Death Sentence  / sm_wish       / 8
]]
local weapon_mapping = {

	easy_wish = {
		[Idstring("units/pd2_dlc_drm/characters/ene_zeal_swat_heavy_sniper/ene_zeal_swat_heavy_sniper"):key()] = {"ump", "raging_bull"}
	}
}

local tweak_mapping = {
	easy_wish = {
		heavy_swat_sniper = "heavy_swat"
	}
}
tweak_mapping.overkill_290 = clone(tweak_mapping.easy_wish) --ignore this

Hooks:PreHook( CopBase, "post_init", "weapon_changes_idk", function(self)
	local weapon_tweak = weapon_mapping[difficulty] and weapon_mapping[difficulty][self._unit:name():key()]
	if weapon_tweak then
		self._default_weapon_id = type(weapon_tweak) == "table" and table.random(weapon_tweak) or weapon_tweak or self._default_weapon_id
	end

	local unit_tweak = tweak_mapping[difficulty] and tweak_mapping[difficulty][self._tweak_table]
	if unit_tweak then
		self._post_init_change_tweak_name = unit_tweak
	end
end )

Hooks:PostHook( CopBase, "change_char_tweak", "thanks_overkill_change_char_tweak", function(self, tweak)
	if not (Global.game_settings and Global.game_settings.single_player) then
		managers.network:session():send_to_peers_synched("sync_change_char_tweak", self._unit, tweak)
	end
end )

iirc this SHOULD sync with other clients.

Alternatively, if you don't want ZEALs below Death Sentence, replace fbi_heavy_swat with heavy_swat on Mayhem, and give a GenSec Heavy Rifleman a UMP.

Avatar

@tangerinepaint Oh huh, you can network tweak changes? That's interesting.

Avatar

@staryoshi06 As a follow-up to that last sentence about changing GenSec Heavies, replacing fbi_heavy_swat with heavy_swat shouldn't affect the usage stats of rifles and shotguns, only other weapons such as Pistols, SMGs, and Revolvers.

34 1025