Left 4 Dead 2

Left 4 Dead 2

Not enough ratings
[QCSA] Add custom ammunition type (Custom Scripted ammunition)
By .
   
Award
Favorite
Favorited
Unfavorite
Introduction
About Custom special ammunition:
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?edit=true&id=2177748959

This article will teach you how to create new ammunition type

How it works
The game does not allow adding new entities, so this mod is implemented by changing the upgrade package entity
Creating new ammunition type
Before starting, you need to install VScript Autoloader

Create a new file with the name qcsa_(any number).nut
Put the file in (scripts\vscripts\autorun\qcsa\)




The first step has been completed
Add custom ammunition content
First, you need to add some content

PrintName <- "Nice name" // The name of the new ammunition type HintIcon <- "icon_explosive_ammo" // Ammunition type icons (You can find it in mod_textures.txt) ViewModel <- "models/v_models/v_super_explosive_ammopack.mdl" // First-person model WorldModel <- "models/w_models/weapons/w_eq_super_explosive_ammopack.mdl" // Third-person model AmmoModel <- "models/props/terror/super_exploding_ammo.mdl" // Ammunition pile model ReplacePrecentage <- 35 // Replacement percentage (0-100)



After doing this, your custom ammunition has been added to the game
But no effect, you also need to add a callback function

The OnBulletImpact function gives the position where the bullet hits as well as the player and the weapon entity



You can create some entities, any entity can

The OnTakeDamage function will be called after you damage any entity with custom ammunition



You can change the damage through this function, or more advanced
Callback Function
void OnBulletImpact(QEntity player, QEntity weapon, vector position)
Called on bullet impact

void OnTakeDamage(table damageinfo)
Called after damaging an entity with custom ammunition

void OnAmmoCreated(QEntity Ammunition pile entity)
Called when the ammunition pile entity is created
You can remove this entity and create other entities