N!tmod, a Wolfenstein: Enemy Territory Modification!

You are not logged in.


You can donate to help us keeping services online.

#1 26-Nov-10 01:08:38

Registered: 30-Mar-10
Posts: 1,090

Re: HOWTO : Custom Weapon Scripting

Here is an example of custom weapon script and some explainations. (You should Copy/Paste it in a text editor such as wordpad. Forum view sucks)

This script allow you to control weapons parameters in order to customize your server as much as possible.

Each script must be named exactly the same as the original .weap files (see the /weapons folder in etmain/pak0.pk3 and nitmod/nitmod_*.*.pk3).

Create a new .pk3 file and place it in the nitmod directory of your server.

Inside this .pk3, create a folder (ex.: "wpscripts") and add the scripts in it.

Set the server cvar "g_WeaponScriptsDir" to whatever you named the new folder you created inside your .pk3 file (ex.: set g_weaponScriptsDir "wpscripts").

Here are the possible parameters you can add in each script :

//Custom stuff start here.
	both {
		// Available parameters.
		name "MP40"					// Name of the weapon
		damage 18					// Damage inflicted (see lower for headshots)
		spread 400					// Bullets spread (higher = less accuracy)
		coolRate 0						// Speed at which weapon cools after overheating
		defaultStartingAmmo 30			// Ammount of ammo you spanw with
		defaultStartingClip 30			// Ammout of ammo in the 1st clip you spawn with
		fireDelayTime 100				// Delay before firing first round
		maxammo 90					// Max ammo you can carry for this weapon
		maxclip 30						// Max ammount of ammo in clip for this weapon
		maxHeat 0					// Time it takes for this weapon to overheat
		nextShotTime 150				// Delay between rounds
		SpreadScaleAdd 15				// Ammout of spread to add
		SpreadScaleAddRand 10			// Random ammout of spread to add to SpreadScaleAdd
		recoilDuration 0					// Recoil duration
		recoilYaw 0.0					// Distance left or right to move view from weapon firing
		recoilPitch 0.0					// Distance up or down to move view from weapon firing
//		limboKill 						// Add this parameter to enable : Players killed by this weapon are not reviveable
		KillMessage "was killed by"			// "<TARGET_NAME> <KillMessage> <ATTACKER_NAME> <KillMessage2>"
		KillMessage2 "'s MP40"			// "<TARGET_NAME> <KillMessage> <ATTACKER_NAME> <KillMessage2>"
		selfKillMessage "killed himself"		// Selfkill message
		HeadshotWeapon yes				// yes/no : Allow headshots from this weapon
		GibbingWeapon no				// yes/no : Allow this weapon to gib dead bodies
		movementSpeedScale 0			// Speed reduction when player is holding this weapon
//		noMidclipReload					// Add this parameter to disable mid-clip reload
		DistanceFalloff no				// yes/no : Damage of this weapon is reduced by distance
		HeadshotRatio 2.0				// Multiplier of damage by headshots inflicted with this weapon
		minHeadshotDamage 50			// Minimum damage inflicted by headshots with this weapon
		spreadRatio 0.6					// Ratio at which the spread is increased by moving/turning
		velocity2spread no				// yes/no : Moving around will cause this weapon to increase its spread
		viewchange2spread	no			// yes/no : Turning around will cause this weapon to increase its spread
//End of custom stuff

// This is from the original .weap files (found in etmain/pak0.pk3 
// or nitmod/nitmod_*.*.pk3.
	client {
		standModel			"models/weapons2/mp40/mp40_stand.mdc"
		pickupModel			"models/weapons2/mp40/mp40.md3"
		weaponConfig		"models/weapons2/mp40/weapon.cfg"
		handsModel		"models/weapons2/mp40/v_mp40_hand.mdc"
		flashDlightColor	1.0 0.6 0.23
		flashSound			"sound/weapons/mp40/mp40_fire.wav"
		flashEchoSound		"sound/weapons/mp40/mp40_far.wav"

		reloadSound			"sound/weapons/mp40/mp40_reload.wav"
		reloadFastSound		"sound/weapons/mp40/mp40_reload_fast.wav"

		weaponSelectedIcon	"icons/iconw_mp40_1_select"

		ejectBrassFunc		"MachineGunEjectBrass"		
		firstPerson {
			model		"models/weapons2/mp40/v_mp40.md3"
			flashModel		"models/weapons2/mp40/v_mp40_flash.mdc"

				part 0
					tag		"tag_barrel"
					model	"models/weapons2/mp40/v_mp40_barrel.mdc"
				part 1
					tag		"tag_barrel2"
					model	"models/weapons2/mp40/v_mp40_barrel2.mdc"
				part 2
					tag		"tag_barrel3"
					model	"models/weapons2/mp40/v_mp40_barrel3.mdc"
					axisskin	"models/weapons2/mp40/"
					alliedskin	"models/weapons2/mp40/"
		thirdPerson {
			model		"models/weapons2/mp40/ss_mp40.md3"
			flashmodel		"models/weapons2/mp40/mp40_flash.mdc"



Board footer

Powered by FluxBB