About Injuries And Diseases
What kind of survival game doesn't let you break your leg? With this plugin, players can sustain injuries and become infected with diseases. Currently there are 6 status conditions, each fully customizable through the plugin's configuration file.
/inflict <player> concussion
/cure <player> concussion
- Periodically blurs the player's vision.
- Chance to occur when a player is headshot.
- More likely to occur with more powerful weapons.
/inflict <player> foodpoisoning
/cure <player> foodpoisoning
- Forces the player to vomit occasionally which damages their food and thirst levels.
- Caused by eating spoiled meat.
- Can be cured by drinking healing tea.
/inflict <player> brokenleg
/cure <player> brokenleg
- Prevents sprinting and causes damage when moving.
- Can happen when taking fall damage, chance increases the greater the height.
- Can also occur when being shot in the leg, this is more likely to happen the more powerful the weapon is.
/inflict <player> rabies
/cure <player> rabies
- Periodically deals damage to the victim and flashes their screen red.
- Can be rarely contracted from the bites of wild animals.
- There is no cure, it's best to put the victim out of their misery.
/inflict <player> tapeworm
/cure <player> tapeworm
- The effect of food and water consumption is greatly reduced.
- Can occur from consuming raw or uncooked meat.
- Easily treatable with anti-biotics (anti-rad pills).
/inflict <player> z13virus
/cure <player> z13virus
- Not much is known about this disease, however it is often mistaken for rabies.
- Something terrible occurs when the victim dies...
- Seems to occur when a player is bitten by a zombie (scarecrow).
Each status condition has properties that can be customized through the plugin config. Here is a quick description of each of the properties.
Enabled - Set to false to disable this condition.
Likeliness - The chance (0 - 1.0) of this condition occurring through any means. For some conditions, like concussion or broken leg, this will be the MINIMUM chance for this to occur, and it will become more likely depending on how much damage is taken. This is only relevant for some conditions, other conditions may use items/entities to inflict players.
Icon - The url of the icon for this condition.
From Legshots - (Broken Leg Only) Set to false to disable this from occurring when a player is shot in the leg.
From Falling - (Broken Leg Only) Set to false to disable this from occurring when a player takes fall damage.
Damage Scale - The damage effect multiplier for the status condition. This will modify the damage taken for all types (hunger, thirst, ect.) not just health. For example, a value of 0.5 will do half damage while a value of 2.0 will do double damage.
Show Duration - Set to false if you do not want player's to see how many seconds are remaining for this condition. There is a slight performance cost for this being set to true.
Show Indicator - Set to false if you do not want a custom status framework indicator to show up for this condition.
Cure Items - Item short names with corresponding chances from 0-1.0. The items listed will have a chance to cure the condition when consumed/used by the player. An item skin can optionally be specified, see Item Skins section.
Interval Min Seconds - The minimum amount of time in seconds between a condition's symptom from occurring. Only relevant for some conditions.
Interval Max Seconds - The maximum amount of time in seconds between a condition's symptom from occurring. Only relevant for some conditions.
Duration Min Seconds - The minimum number of seconds a condition will last for.
Duration Max Seconds - The maximum number of seconds a condition will last for.
Move Items to Zombie - (Z13 Virus Only) Set to false to disable moving items from a corpse to the newly spawned zombie. The items will instead be left in a backpack.
Reanimation Seconds - (Z13 Virus Only) The number of seconds before an infected player's corpse is reanimated into a zombie.
Infliction Entities - Entity short names with corresponding chance of inflictions from 0-1.0. The entities listed will have a chance to inflict the condition when dealing damage to a player.
Infliction Items - Item short names with corresponding chance from 0-1.0. The items that are listed will have a chance to inflict the condition when consumed/used by the player. An item skin can optionally be specified, see Item Skins section.
Infliction Damage Action - Determined the way that an infliction entity must deal damage in order to inflict a condition. The allowed values are "melee", "ranged" or "any".
You can optionally specify that only an item with a certain skin will count for Cure and Infliction items. To do so just append #<skin id here> to the end of the item shortname. If both a skinned item and a non skinned item definition are specified, then the skinned definition will take priority if applicable. For example if your config looks like this then...
- If Anti-Rad Pills with the Skin 12345 are consumed, then it has a 100% cure chance.
- Anti-Rad Pills with any other skin (including default) only have a 50% cure chance.
- Only Apples with the 67890 skin have a 100% cure chance.
- All other Apples have 0% cure chance (because they are not listed).
Creating Your Own Custom Status Conditions
Please note, this is a WIP feature, there may be some bugs, please report them if you find them!
As of v1.2.0 you can use the API method "CreateCondition" to create your own plugin that can register custom status conditions through Injuries and Diseases. But what if you're not a developer? No problem! I have created a plugin for you with a ton of configurable options for you to create your own status conditions. In either case, here are some guides for what you need to do to create your own status conditions.
If you are not a plugin developer and you would like to create your own custom status conditions then you can download this plugin file and edit the config that it generates to customize the status conditions how you like. Currently there is a limited amount of things you can do for a status condition. If there is a specific condition, trigger, or effect you would like included, please open a support ticket and make a suggestion! Or, if you want full freedom, you can see the developer section to create your own status condition plugin exactly how you would like.
If you are a plugin developer and would like to create a plugin that adds some custom status conditions, then you can make use of the "CreateCondition" API method (see API section) to register any custom conditions you would like to add. To see a code example of how this will work you can refer to the plugin file download like mentioned in the "For Non-Developers" section above. That plugin contains some hints on how the plugin must operate to work with Injuries and Diseases. When creating a custom condition, there are certain aspects that Injuries and Diseases will handle, and others that your plugin will need to take care of. Here is a breakdown of some of those things:
Injuries and Diseases will handle...
- Showing status indicators
- Status duration and countdowns
- Showing infliction, cure and diagnosis messages (they need to be in YOUR plugin's localization file though)
- The effect that occurs on intervals and when the condition is first inflicted (you pass these methods into the CreateCondition method)
- Whether your conditions duration/indicator is shown (pass this into the CreateCondition method)
- Registering conditions using the API
- Means of inflicting your condition (entity attack, item consumed, ect)
- Means of curing your condition
- Localization (Injuries and Diseases will reference some of these)
- Adding images to image library
- Any configuration options pertaining to your custom conditions
- Required for admin commands
- Designates a player as a doctor
- Required for doctor commands
/inflict <player> <condition> <revealed?>
- Inflicts the player with the specified condition (see status conditions section).
- Optionally, you can set if the status will be revealed or not. Default value is set in the config.
/cure <player> <condition?>
- Cures the player from all conditions.
- If the condition is specified, the player will be cured of just that condition.
- Returns a list of all the conditions a player is suffering from and includes the remaining duration.
/reveal <player> <condition>
- Reveals the condition to the player if it has no already been revealed.
As an optional feature, you can assign a player as a doctor. Doctors can diagnose players, which will reveal to the player the condition that their are afflicted with. By default, this isn’t necessary, as players will automatically be notified of what their condition is. However, in the config, you can set it so that conditions are unknown to players until they get a doctor to diagnose them. Once they have diagnosed a player, the doctor will also be informed of how to cure the condition. Doctors can be assigned with the doctor perm, and have access to the following command:
- Will diagnose any undiagnosed conditions of the player they are looking at. Will also recommend treatment if available.
Injuries and Diseases has built in support for the following plugins:
- The default config values contain support for ZombieHorde zombies to inflict the Z13 Virus
- The keyword in the config for zombie horde entities is "zombie"
- The default config values contain support for Walking Dead zombies to inflict the Z13 Virus
- The Walking Dead plugin uses the "scarecrow" entity for their zombies, which is already included
- If you want BotReSpawn entities to inflict a condition, use the keyword "botrespawn" in the infliction entities section of the condition config.
Death Removes Conditions - Set to false if you want conditions to persist even when a player dies.
Pause on Disconnect - Set to false if you want the condition timer to continue even when a player is sleeping. Set to true if you want it to pause when they are sleeping.
Require Diagnosis - Set to false if you want conditions to be automatically revealed to player's when they are inflicted. Set to true if you want them to appear as unknown until a doctor diagnoses them.
Show Doctor Indicator - Set to true if you want an indicator to appear for player's with the doctor permission.
Messages Enabled - Set to false if you do not want messages to appear in the chat for player's when their conditions status is updated.
Message Icon ID - The steam ID of the player portrait you want to appear for all chat messages from this plugin.
Images - A list of image urls for various images used in this plugin.
Status Conditions - Configuration for status conditions (see customization section).
Version - Keeps track of what version your configuration was generated for, do not edit manually.
With these developer API tools you can extend the functionality of existing conditions through code. You can add additional effects by making use of the various hooks for each condition.
* Returns a list of all enabled conditions.
* Returns a list of conditions a player is inflicted with.
List<string> GetPlayerConditions(ulong userId);
* Returns true if the player has the specified condition.
bool HasCondition(ulong userId, string conditionNameId);
* Inflicts the player with the specified condition.
void SetCondition(ulong userId, string conditionNameId, bool revealed);
* Removes the condition for the player.
void RemoveCondition(ulong userId, string conditionNameId, bool cured);
* Removes all conditions for the player.
void RemoveAllConditions(ulong userId, bool cured);
* Reveals the condition to the player if it is not already revealed.
void RevealCondition(ulong userId, string conditionNameId);
* Create a custom condition. BETA
void CreateCondition(Plugin plugin, string conditionNameId, string imageLibraryIconName, int minIntervalSeconds, int maxIntervalSeconds, int minDurationSeconds, int maxDurationSeconds, bool showDuration, bool showIndicator, Action<BasePlayer> beginEffect = null, Action<BasePlayer> intervalEffect = null);