Server Side Modding

The Official Modding Resource for Battlefield 1942 and Battlefield Vietnam
It is currently Mon Oct 19, 2009 5:30 pm

All times are UTC - 6 hours [ DST ]

Getting Started
Getting Started
Prepping Your Files
  Testing Methods
Auto-Start Map
True Testing Enviroment
General How-To's
Stop Base Camping
Removing Out Of Bounds
Stop Base Camping 2
Disabling Parachutes
Add Repair Points
Add Spawn Points
Main Base Swapping
Modifying the Point System
Conquest Ticket System
Making CTF Versions of Maps
Vehicle How-To's
Replace/Add Vehicles
Lock Vehicles
Partially Disabling Vehicles
Totally Disabling Vehicles
Making a Carbomb
Adding Nitrous
Making Amphibious
Performance Tweaking
Adding Healing Supply
Adding/Changing/Removing Carrier Vehicles
Weapon How-To's
Spawn Weapon Kits
Change the Weapon Kits of Soldiers
Modifying Weapon Attributes
Disabling Weapons
Modifying the Damage System
Disabling Overheating
Fix Wall Hacks
How to Fix Wall/Floor Hacks
Basrah's Edge
Lost Village
Al Khafji Docks
El Alamein
Other Fixes
Leaning F16 Fix
Glass Humvee
Oil Fields Exploding A-10
Operation Bragg Fixes
Object List
Weapon Kits List
Global Object Spawners
Global Soldier Spawns
Projectile Material Numbers

Disabling Weapons

There are two ways to basically disable a handweapon. Each way has a unique effect on how exactly the weapon is broken.

Changing the magType

One way to disable a handweapon is to change it's magType to 1.

For example:

ObjectTemplate.Active AK47
ObjectTemplate.magType 1

This will disable the AK47. If you try to fire it, you'll hear shots, but it will do no damage. (magType 1 is what the medic's medical kit uses as a magazine type).

The_Claw posted the code to create an "All Knives" map using this method. You can check it out in this thread

Changing the setInputFire

Another way of disabling weapons is to change the button that actually fires the weapon. Whenever this is changed on the server (no matter what weapon) it totally breaks the trigger (even the new button it was set to doesn't work).

For example, to break the AK47 using this method, one could use this code:

ObjectTemplate.Active AK47
ObjectTemplate.setInputFire c_PIMouseLook

For a list of handweapon kits, refer to Weapon Kits List

If using the second method, and you want to disable grenades totally (right and left click), use this code for the grenades:

ObjectTemplate.Active GrenadeAllies
ObjectTemplate.setInputFire c_PIMouseLook
ObjectTemplate.velocityDependentOnHeat 0
ObjectTemplate.heatAddWhenFire 0

Without the extra two lines, the left click wont work on grenades, but right click will (but not full strength).


No materials may be duplicated under any circumstances.