Weapon Modifications and Attributes - nZombies-Time/nZombies-Rezzurrection GitHub Wiki

Overview

This page is directed at developers who know what they're doing. This page contains a list of things you can apply to your weapons that will modify their behaviour in nZombies. None of these things will change how it behaves in any other gamemode, and will not modify its general behaviour.


List of Modifiers


Wonder Weapon

Marking a weapon as a Wonder Weapon makes it not appear in the box if a player is already carrying it, or another box has it after being bought. This will essentially, as long as cheats or scripts aren't used, make it so that there can only ever be one in the map at a time. It is applied like so:

SWEP.NZWonderWeapon = true

Pack-a-Punch Function

This function is run when the weapon is Pack-a-Punched. When this function exists on the weapon, it will be run once the weapon is Pack-a-Punched. It is created like so:

function SWEP:OnPaP()
    -- Do stuff
    -- Return true to prevent default behaviour
end

If true is returned, it will stop default Pack-a-Punch behaviour, such as modifying magazine size and applying attachments and materials.

Re-Pack-a-Punch Function

This function is run when the weapon is Pack-a-Punched after already being Pack-a-Punched. When this function exists on the weapon, it will be able to go through Pack-a-Punch multiple times for 2000 points. It is created like so:

function SWEP:OnRePaP()
    -- Do stuff
    -- Return true to prevent default behaviour
end

If true is returned, it will stop default Pack-a-Punch behaviour, which for now is only rerolling attachments for CW2 and FAS2 weapons.

You can also set custom text to appear in-game when looking at Pack-a-Punch with the weapon when it is already upgraded. That is done like so:

SWEP.NZRePaPText = "your text here"

It will automatically get "Press E to " and " for 2000 points." added to either side. The example above would result in Press E to your text here for 2000 points.

Pack-a-Punch Name

This allows you to modify the name that appears on the HUD when a weapon is Pack-a-Punched. It can be applied like so:

SWEP.NZPaPName = "Some Name"

The above way is the better way to do it, but it is also possible to apply to weapons without modifying their code by running this external function anywhere:

AddPackAPunchName(class, papname)

class can also be a Display Name, and will then apply to all weapons that have this display name (Not capital sensitive).

Pack-a-Punch Replacement

Setting this will allow you to set which weapon this one will be replaced with when Pack-a-Punched. When Pack-a-Punch is applied to the weapon, rather than modifying its magazine and attachments, it will completely replace it with another weapon set by this class. It will also blacklist the weapon set, making it unable to be gotten from the Random Box by default (Will not remove from Random Box list if already added). If the weapon is invalid, it will do default behaviour. It is set like so:

SWEP.NZPaPReplacement = "weapon_class"

Max Ammo Function

This function is run when max ammo is applied to the weapon. Max ammo gets applied to a weapon in the case of a Max Ammo drop, buying ammo off a wall, or getting the weapon from the box or from Pack-a-Punch. If this function exists, normal behaviour will not be run on the weapon. Creating this function works like so:

function SWEP:NZMaxAmmo()
	-- Do stuff
end

Remember that normal behaviour will not be run if this function exists. That means you should refund all the ammo here as well, even if your function just does something that is supposed to be on top of ammo supply.

More Weapon Attributes

SWEP.NZPreventBox = true/false

Prevents this weapon from being added to the random box list

SWEP.NZTotalBlacklist = true/false

Prevents this weapon from showing up by any means, including being a valid wall buy and being in the box. It will only be spawnable via code with this to true.