Modding weapons - yvt/openspades GitHub Wiki
Modding weapons can be done by editing script files and replacing the default model/sound files.
Scripting
An AngelScript script file loads the required model/sound files, renders models at the correct location, and plays gunshot sounds. There are two scripts for each weapon:
Scripts/Skin/(Rifle|Shotgun|SMG)/ThirdPerson.as
- this one is used for all players but the local player.Scripts/Skin/(Rifle|Shotgun|SMG)/View.as
- this one is for the first-person weapon.
Always include ThirdPerson.as
and View.as
in your Mods even if you didn't modify the script. If you don't do this, your mods are likely to break in the future version of OpenSpades. (In fact, some mods ceased working on 0.0.12 because they didn't do this!)
Never include unrelated script files (i.e. other weapon's View/ThirdPerson.as, MainScreen.as) or there will be some compatibility issues.
Note: if you modified script files, make sure to add your credits to them.
Models
OpenSpades uses KV6 format, so you can use any software that can export KV6, e.g., SLAB6 and VoxelShop, to create models for OpenSpades.
Sounds
You can rewrite whole the sound logic to provide more sound diversity or reduce the number of sound files. However, you also have an option to stick to the original one.
This table describes the purpose of each sound file in the original sound logic:
File Name | First / Third | Stereo? | Perspective |
---|---|---|---|
FireLocal.wav |
First person | Yes | Close |
Fire.wav |
Third person | No | Close |
FireFar.wav |
Third person | No | Far |
FireStereo.wav |
Third person | Yes | Close & Far |
This table summarizes which sound files can be heard in each situation:
First / Third | Perspective | Sound Files |
---|---|---|
First person | Close | FireLocal.wav |
Third person | Close | Fire.wav (positional) + FireStereo.wav |
Third person | Far | FireFar.wav (positional) + FireStereo.wav |
The stereo wav file FireStereo.wav
gives an illusion of a wide and open field.
(note: make sure files whose Stereo column is marked 'No' are mono wav files! 3D sound doesn't work for stereo sound files.)
Package
It's recommended to package files into ".pak" file for easier installation.
(note: future version might checksum official paks (pak000-Nonfree.pak and so on) for additional services.)