Garry's Mod

Garry's Mod

评价数不足
[TTT2] Prosecutor [ROLE]
   
奖励
收藏
已收藏
取消收藏
素材类型: 插件
插件类型: 服务器内容
插件标签: 快乐
文件大小
发表于
更新日期
390.804 KB
2021 年 11 月 22 日 下午 6:50
6 月 1 日 下午 12:05
6 项改动说明 ( 查看 )

订阅以下载
[TTT2] Prosecutor [ROLE]

描述
Once the detective has determined the killer, it's your time to deliver justice!

You have to use TTT2 in order to use this role.



The Prosecutor is an innocent with an instant kill magnum! Their role is kept secret so they can stay in the shadows waiting for the time to deliver justice, or reveal their role to use their gun as an active threat. If they shoot a non-traitor or non-neutral team(configurable), they face punishment! (Instant death! Configurable)

They are unable to kill people via any other means besides their magnum, only able to reduce health to a certain amount(25 by default, configurable) before damage is ineffective. They also have a shop and start with 1 credit. They can only buy damage resistances and immunities to ensure they last long enough to deliver instant justice!

Plays best with:



Convars are variables that are introduced to allow server owners to customize the gameplay without changing the code. There are always a handful of convars automatically created by TTT2, that define the spawn parameters of this role and are found in ULX. Additionally there might be some role specific convars, which have to be set in the server config file.

Normal Role Convars (also found in ULX):

# enable or disable this role ttt_prosec_enabled [0/1] (default: 1) # the percentage of players that are spawned as this role ttt_prosec_pct [0.0..1.0] (default: 0.15) # the limit of players that spawn as this role each round, this overwrites the percentage ttt_prosec_max [0..n] (default: 1) # the probability each round of this role being spawned at all ttt_prosec_random [0..100] (default: 15) # the amount of players needed for this role to spawn ttt_prosec_min_players: [0..n] (default: 5) # the amount of credits this role starts with ttt_prosec_credits_starting: [0..1] (default: 1)

Rolespecific Convars:

# What is the lowest the Prosecutor can lower someones health without their magnum? ttt_prosecutor_damage_hp_cutoff [0..100] (default: 25) # What method is used to determine if the Prosecutor shot a terrorist/evil person? # 0 - Traitors Team # 1 - All Non-Innocent Teams # 2 - Traitor Team + Neutral Team # 3 - None(Always Punish) ttt_prosecutor_detection_method [0-3] (default: 1) # What punishment should the Prosecutor go through if they shot an innocent? # 0 - Death # 1 - Half Max Health(+Resign) # 2 - Quarter Max Health(+Resign) # 3 - Resign Only # 4 - None ttt_prosecutor_punishment [0-4] (default: 0)

For modders/people familiar with lua

The mod adds two hooks, ShouldProsecutorBePunished(prosecutor, target) and DoProsecutorPunishment(prosecutor).

Returning false or a non-nil value on DoProsecutorPunishment cancels the standard prosecutor punishment.

And for role mods, you really shouldn't hook and change the return value for ShouldProsecutorBePunished unless you absolutely need to, and if you do, please respect the convar. (Unless you are a server owner specifically programming custom Prosecutor behavior, then ignore this warning, lol.)

TODOS:
  • Implement special code if Swapper role is installed so the prosecutor doesn't die.
  • Reload animation after the gun is fired to make it more clear it has a 5 second cooldown.

Credits
Murder, where this role idea came from. (I thought it'd interesting to port a sheriff role from an entirely different game into TTT2)

Person who created the silent role, which I used to create the thumbnail for this addon.

My friends who play tested this role.
2 条留言
MissingTextureMeow101  [作者] 5 月 30 日 上午 8:08 
There may be a bug where ttt_prosec_max isn't defaulting to 1, atleast in my test environment. I suggest making sure it is 1
Bacon The Protogen 2021 年 11 月 22 日 下午 6:54 
First addon lets go!