-
Notifications
You must be signed in to change notification settings - Fork 2
External Mod API
Want to make addons that play with Bio-Annihilation II? Here are some internals of BA2 that could help:
More hooks may be added on inquiry - feel free to ask!
BA2_OnZombieKilled(Entity zombie, CTakeDamageInfo dmginfo): Called when a BA2 Infected nextbot's OnKilled is called, i.e. when it dies.
-
zombie: The Infected that was killed. -
dmginfo: The DamageInfo object used to kill the zombie.
BA2_MODVERSION: A string containing the current version of Bio-Annihilation II being run, excluding the edition (Hotfix 0A).
DMG_BIOVIRUS: To be used with CTakeDamageInfo:SetDamageCustom(). If an entity is killed by damage with this custom damage type, they will become a zombie. An alternative way to raise zombies through damage if you don't want to change the inflictor. It's recommended to use the latter method when possible, because this might not work if the damage is too high. (Release Update 0+)
ent.BA2Infection: Accesses an entity ent's current infection quantity.
These variables must be retrieved with a corresponding function, such as GetNWInt for integers.
int "BA2GasmaskFilterPct": The player's current gas mask filter percentage. Despite being a networked integer, it can be a decimal. Just don't question it.
int "BA2GasmaskFilters": The number of filters a player is currently carrying.
bool "BA2GasmaskOn": Returns true if a player is currently wearing a gas mask.
bool "BA2GasmaskOwned": Returns true if a player has a gas mask, whether they're wearing it or not.
In order to use the below functions, you MUST add this line to the top of your code:
include("ba2/methods.lua")
nil BA2_AddInfection(Entity ent,int amnt): Adds amnt infection to ent. amnt must be positive.
bool BA2_GetActiveMask(Entity ent): (Release 2) Returns true if ent is a player wearing a gas mask with a working filter, or if ent is an NPC with a gas mask. These NPCs include Gas Mask Citizens and all Combine NPCs. Returns false if none of these criteria are met.
Entity (ba2_infection_manager) BA2_InfectionManager(): Returns the Infection Manager entity, and creates one if it doesn't exist. The Infection Manager serves as a source for infection damage. DamageInfo with the Infection Manager as the INFLICTOR will raise zombies if it kills.
nil BA2_RaiseZombie(Entity ent): Raises ent as a zombie, keeping its skin and bodygroups. ent can techincally be anything with a model, but it is designed to use an NPC, player, or ragdoll.
If you manually create nb_ba2_infected, you can set these properties before you initialize it:
Color ColorOverride: If set, the zombie will spawn with this color.
String/table InfBody: The model the zombie will use. Can be a single model path or a table of model paths. If a table is used, the zombie will use a random entry in the table as its model. If set to "CUSTOM", the zombie will use a Custom Infected model. Must be set manually.
table InfBodyGroups: The bodygroups the zombie will use. Bodygroups can be obtained from an existing entity with ent:GetBodyGroups(). If unset, all bodygroups will be randomized.
int InfSkin: The skin number the zombie will use. If unset, a random skin will be used.
int InfVoice: The voice the zombie will use:
- 0: Male
- 1: Female
- 2: Combine
- 3: Soldier
If unset, the voice will be automatically set based on its model path.
bool noRise: If set to true, the zombie won't play its "getting up" animation when it spawns in.