Left 4 Dead 2

Left 4 Dead 2

Gun Damage Multiplier
38 Comments
skysky199  [author] 30 Jun @ 2:42am 
@Absolute Sucker

Yes.
Check if GetActiveWeapon() == "weapon_melee"
Check netprops m_usingMountedWeapon and(or?) m_usingMountedGun of players.

If you want to apply it to a specified melee, check netprops of m_strMapSetScriptName of weapons.
Note that m_strMapSetScriptName doesn't always work. For example, it doesn't work on dropped weapons from infected (like riot).
You can use model name instead if you need higher accuracy.
Absolute Sucker 30 Jun @ 12:56am 
@skysky199

Is it also possible to have "z_hit_chainsawer_factor" active when any melee weapon is held or controlling a mounted gun?
skysky199  [author] 30 Jun @ 12:47am 
@Absolute Sucker

Possible.

Check GetActiveWeapon() and IsFiringWeapon()
if condition is met
new damage = old damage * z_hit_chainsawer_factor
Absolute Sucker 29 Jun @ 11:21pm 
@skysky199

Is it possible to have "z_hit_chainsawer_factor" active if a chainsaw is held but not in use?
Absolute Sucker 12 Apr @ 8:02am 
@skysky199

Tyty <3
skysky199  [author] 12 Apr @ 2:17am 
@Absolute Sucker

No.
SI = smoker, boomer, hunter, jockey, spitter and charger.
Absolute Sucker 12 Apr @ 2:13am 
@skysky199

No, sorry I was vague.

What I meant was, if I set the spas shotgun's damage to 2.0 for SI, does it do 2.0 damage to Tank and Witches as well?
Absolute Sucker 12 Apr @ 1:15am 
@skysky199

Quick question, does damage multiplier for SI affect tanks and witches?
时空之轨迹 4 Apr @ 12:12am 
對不起對不起對不起對不起對不起對不起對不起對不起對不起對不起對不起對不起對不起對不起對不起對不起對不起
skysky199  [author] 3 Apr @ 10:36pm 
不然你試著把ems拉出來 讓腳本重跑一次看看
时空之轨迹 19 Mar @ 10:33pm 
好的,謝謝作者大大,我會自己找辦法解決的
skysky199  [author] 19 Mar @ 10:24pm 
@时空之轨迹

不可同時存在2同名的weapon scripts
若你想同時使用 需手動合併
时空之轨迹 19 Mar @ 4:41pm 
確實和你説的一樣,KtScript Base Lib是無辜的,我又發現是
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2997687853
導致的
skysky199  [author] 19 Mar @ 6:32am 
@时空之轨迹

我裝了你說的 包含那個作者的全部腳本 還是正常的
时空之轨迹 18 Mar @ 9:56pm 
作者大大,好像發現了原因,可能是Mod
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2894738540
導致的,我加了該Mod後,霰彈槍(修改為1傷害,用Gun Damage Multiplier提高到我設置的傷害)能一槍打死1000血的Witch,而兩槍打死Tank應該也是其他用了該Mod當前置的Mod導致的
看來我不能把Gun Damage Multiplier當作霰彈槍的傷害編輯器了
时空之轨迹 18 Mar @ 3:52pm 
好吧,謝謝作者大大了,我會去排查我用的腳本mod的
skysky199  [author] 18 Mar @ 10:04am 
@时空之轨迹

我試著將傷害改成1 然後設定為32 並沒有發生你說的情況
我猜你其他的腳本也有weapon script
假設是預設 則為 25*32*10 = 8000 剛好是你說的2發就會死
时空之轨迹 17 Mar @ 1:25pm 
哦哦哦,對不起對不起,我把1發全中的傷害寫成了8發全中的傷害了,但這樣就更奇怪了,也就是説10000血的tank被泵動式霰彈槍打出640的傷害就死了
skysky199  [author] 17 Mar @ 11:15am 
@时空之轨迹

就 1 * 32 * 發數
weapon script只改傷害的話是320 (無衰減的話)
2560意思是你的一槍是80顆子彈?
时空之轨迹 17 Mar @ 5:13am 
作者大大,我想請問一下霰彈槍的傷害倍率是怎麼算的,我把泵動式霰彈槍的傷害改成了1,然後讓泵動式霰彈槍對tank有32倍的傷害,如果是按子彈數量來計算的話那一槍 無衰減 全中的傷害是2560,對10000血的tank需要4槍,但我在遊戲裏只開了2槍就打死tank了
Solid 11 Mar @ 10:36pm 
I wanted to make it so that the z_shotgun bonus was applied to other ammo types, but maybe the damage multipliers are defined by witch's "code". I don't know nearly enough about scripting and where to find the vanilla code for these things. So yeah as you said just writing a new script for extra damage against witches would be better, thanks.
skysky199  [author] 11 Mar @ 10:28pm 
@Soild

So you want to change ammo type when attacking to witch, and back to default when to others?
I think that's not possible.
Why not manually compute and change damages?
Like
if (weapon == "" && target =="witch")
Damage = Damage * z_shotgun_bouns...;
Solid 11 Mar @ 1:23pm 
Thanks for the reply.
I was refering to crowning witches as in killing them.
the reasons you can crown a witch is that they are affected by the
Cvars z_shotgun_bonus_damage_range (100) and z_shotgun_bonus_damage_multiplier (5)
just like common infected (or not exactly the same as witches only recieve the 5x bonus damage on headshots in expert difficulty).
But it's still these cvars that make it possible and I know they specifically trigger when using
AMMO_TYPE_SHOTGUN and AMMO_TYPE_AUTOSHOTGUN. "Weapontype" doesn't matter but the ammo type does so yes you can get this effect by
changing a weapon script to use one of the shotgun ammo types but that comes with other multipliers,
like less damage on headshots for special infected and less damage on tanks for the auto shotgun ammo type.
skysky199  [author] 9 Mar @ 12:43am 
@Soild

I don't fully understand what you said.
As far as I know, using weapon script is the easiest way to modify ammo type.
It is possible to change ammo type by modify netprops with vscript, but I'm not sure if it works.
I don't know the relation between ammo type and z_shotgun..., and why that affects crowning witches.
I guess you're talking about knocking back witches with a headshot, but I remember that it's damage-related, not ammo type.
Solid 8 Mar @ 3:16pm 
Is it possible to make a mod that edits ammo type properties like damage multipliers?
specifically I want to make it so that "AMMO_TYPE_MINIGUN" or maybe "AMMO_TYPE_MAGNUM" is affected by "z_shotgun_bonus_damage_range" and "z_shotgun_bonus_damage_multiplier" so they can crown witches. I haven't found any useful info searching the internet but you seem very skilled at scripting.
skysky199  [author] 8 Mar @ 6:00am 
@时空之轨迹

確實 沒sourcemod的話 能做到的東西很有限
时空之轨迹 7 Mar @ 5:45pm 
作者大大,我有一些創意工坊裏還沒出現過的想法(也可能是我沒找到),就是槍械的一些雜類配置
比如
可以配置哪些槍械不能拾取子彈(特殊彈藥仍然可以拾取)
可以配置哪些槍械拿在手上的時候會有正面和背面的不同的受傷倍率
可以配置哪些槍械在射擊後會讓生還者自身出現硬直或受傷

不過我自己看下來感覺這些功能實現起來應該是蠻難的,所以作者大大可以無視我的這些想法
skysky199  [author] 3 Feb @ 2:22am 
@Hazel

I don't know how to calculate performance between 2 codes.
I can only tell you that the concept is similar.
Hazel 3 Feb @ 2:15am 
@skysky199 Nice! Do you recommend plugins or vscripts for better performance, or there is no difference?
skysky199  [author] 3 Feb @ 1:57am 
I think I remembered wrong. GL is feasible.:steammocking::steammocking:
Hazel 2 Feb @ 7:07pm 
I'm using the sourcemod plugin @skysky199 ty
something something house 2 Feb @ 6:48pm 
@Hazel, these are the commands for the grenade launcher
grenadelauncher_damage
grenadelauncher_ff_scale
grenadelauncher_ff_scale_self
grenadelauncher_force_kill
grenadelauncher_radius_kill
grenadelauncher_radius_stumble
grenadelauncher_show_radius
grenadelauncher_startpos_forward
grenadelauncher_startpos_right
grenadelauncher_startpos_up
grenadelauncher_vel_up
grenadelauncher_vel_variance
grenadelauncher_velocity
skysky199  [author] 2 Feb @ 11:46am 
@Hazel

I remember no, but that is in sourcemod. May be doable in vscript, not tried.
Hazel 2 Feb @ 11:40am 
Is there a way to change the GL damage individually like the other weapons?
something something house 19 Oct, 2024 @ 11:34pm 
well it is okay i think ill try figuring out how this deploy mod ( https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=3031612443&searchtext=deploy ) works :D
skysky199  [author] 19 Oct, 2024 @ 11:00pm 
@something something house

I think shooting and reloading are possible, not sure about deploying.
Need tests.
something something house 19 Oct, 2024 @ 7:27am 
is a gun shooting/deploy/reload speed modifier or multiplier possible?