-
Notifications
You must be signed in to change notification settings - Fork 6
Creating your own Register File
If you want to use only certain weapons for a map you plan to release publicly you can make your own Register File to include only assets belonging to that weapon, and modify some information about it as you see fit. This will be your Map Script.
Start by creating a register file for your map (in .as format) inside this folder: scripts/maps/ins2/.
For example: mymapname_register.as.
This file will be used in your map's .cfg file.
Now that the file has been created, you can start including especific weapons into it.
For example:
#include "arifl/weapon_ins2akm"
#include "handg/weapon_ins2makarov"The AKM with the GP25 grenade launcher and the Makarov will now be included in the register file you just made.
Now you need to precache the weapon, for this we will start by making a custom function that will be executed everytime you start the map (Do not include multiple map scripts that has the same function name, this will give you an error on AngelScript).
For example:
void MapInit()
{
INS2_AKM::Register();
INS2_MAKAROV::Register();
}Now that the weapons are being registered, go to your map's .cfg file and call the map script you just made: map_script ins2/mymapname_register.
You can go ahead, start the map and give the weapons to yourself.
Additionally you can use our newly provided .fgd file to place the entities you're registering on the level you're creating.
You want to make sure to send all files the player will need to see, hear and pickup the weapons, along with other visual assets that the weapons use.
There are also files that will be precached no matter the weapon. These files are:
sound/ins2/wpn/in1.ogg
sound/ins2/wpn/in2.ogg
sound/ins2/wpn/in3.ogg
sound/ins2/wpn/out1.ogg
sound/ins2/wpn/out2.ogg
sound/ins2/wpn/out3.ogg
sound/ins2/wpn/empty.ogg
sound/ins2/wpn/ammo.ogg
sprites/ins2/firemodes.spr
sprites/ins2/bipod.spr
sprites/ins2/wpn1024.spr
Remember to include them in your release.
Take a look inside each weapon script to know what files you'll need when releasing the map along with the weapons.
In this particular tutorial we're using the AKM and the Makarov, so the files you'll need for them are:
- AKM:
models/ins2/wpn/akm/w_akm.mdl
models/ins2/wpn/akm/v_akm.mdl
models/ins2/wpn/akm/p_akm.mdl
models/ins2/shells/762.mdl
models/ins2/wpn/akm/gp25.mdl
models/ins2/ammo/mags.mdl
sound/ins2/wpn/fdraw1.ogg
sound/ins2/wpn/fdraw2.ogg
sound/ins2/wpn/fdraw3.ogg
sound/ins2/wpn/fdraw4.ogg
sound/ins2/wpn/fdraw5.ogg
sound/ins2/wpn/fdraw6.ogg
sound/ins2/wpn/akm/shoot.ogg
sound/ins2/wpn/akm/empty.ogg
sound/ins2/wpn/gp30/shoot.ogg
sound/ins2/wpn/gp30/empty.ogg
sound/ins2/wpn/akm/bltbk.ogg
sound/ins2/wpn/akm/bltrel.ogg
sound/ins2/wpn/akm/rof.ogg
sound/ins2/wpn/akm/magin.ogg
sound/ins2/wpn/akm/magout.ogg
sound/ins2/wpn/akm/magrtl.ogg
sound/ins2/wpn/akm/magrel.ogg
sound/ins2/wpn/gp30/desel.ogg
sound/ins2/wpn/gp30/ins.ogg
sound/ins2/wpn/gp30/insclk.ogg
sound/ins2/wpn/gp30/load.ogg
sound/ins2/wpn/gp30/sel.ogg
sound/ins2/wpn/gren/det1.ogg
sound/ins2/wpn/gren/det2.ogg
sound/ins2/wpn/gren/det3.ogg
sound/ins2/wpn/gren/wdet1.ogg
sound/ins2/wpn/gren/wdet2.ogg
sound/ins2/wpn/gren/wdet3.ogg
sprites/ins2/arf/weapon_ins2akm.txt
events/muzzle_ins2_MGs_big.txt
- Makarov:
models/ins2/wpn/pm/w_pm.mdl
models/ins2/wpn/pm/v_pm.mdl
models/ins2/wpn/pm/p_pm.mdl
models/ins2/shells/9x18.mdl
models/ins2/ammo/mags.mdl
sound/ins2/wpn/pdraw1.ogg
sound/ins2/wpn/pdraw2.ogg
sound/ins2/wpn/pdraw3.ogg
sound/ins2/wpn/pdraw4.ogg
sound/ins2/wpn/pdraw5.ogg
sound/ins2/wpn/pm/shoot.ogg
sound/ins2/wpn/pm/empty.ogg
sound/ins2/wpn/pm/sldbk.ogg
sound/ins2/wpn/pm/sldrel.ogg
sound/ins2/wpn/pm/hit.ogg
sound/ins2/wpn/pm/magin.ogg
sound/ins2/wpn/pm/magout.ogg
sound/ins2/wpn/pm/magrel.ogg
sound/ins2/wpn/pm/safe.ogg
sprites/ins2/hdg/weapon_ins2makarov.txt
Don't forget that the server running your map script will also need the .as files you're using, in all cases you'll need your Register File, the Weapon you're using (including its projectile script if its using one) and the base.as script (which is a requirement for every single weapon on this project).
You don't need to modify the weapon scripts themselves to customize some information that the weapon uses. Each weapon script allows you to modify certain values such as:
- Model Path
- Shoot/Empty Sound Path
- Position and Slot on the HUD bucket
- Damage
- Weight
- Maximum amount of ammo
- Magazine Size
- Rate of Fire (Air and Water, for some weapons RPM in Water is discarted if the weapon in question doesn't need it)
- Amount of ammo to give on weapon pick up
- Item Flags
- Ammo type
Take a look inside each weapon script to know which values to modify in your Map Script.
In this tutorial we're going to modify the Position and Slot on the HUD bucket:
void MapInit()
{
INS2_AKM::SLOT = 4;
INS2_AKM::POSITION = 4;
INS2_MAKAROV::SLOT = 2;
INS2_MAKAROV::POSITION = 4;
INS2_AKM::Register();
INS2_MAKAROV::Register();
}In this case we moved the Makarov over to Slot 2, which is the SMGs slot, and now it is occupying the first position available, and the AKM was moved over to Slot 4, which is the Explosives slot, and it is also occupying the first position available.