I made it due to the lackluster weapons in the file archive. I was surprised no on has created a rifle with explosive rounds.
I will be using the ump45 as an example.
First, get the weapon's image file you want to use. I recommend using the _d file, as it is just rightsized. Copy and paste that file into the CC gfx folder. then rename it without the _d ("ump45_d.bmp" ---> "ump45.bmp"). then use Window's Turn Counter-Clockwise Feature to orient the image so the barrel of the weapon is facing up.
then move the sound file too.
Then, find the lua file of a similar weapon.
If the CS2d weapon is automatic, find the machinegun.lua weapon file and open it (preferably in Notepad++). then use find and replace to replace the words "machinegun" with the name of your weapon (eg. "ump45". Also, modify the line that says
1
cc.ump45.ammo=10
Change the ammo capacity to the ammo capacity of the UMP (25)
Then find the line that says
1
playerdamage(playercollision(),14)
Modify the 14 to the damage the UMP does in CS2d, or whatever you want.
If the weapon is a semi-auto then modify the pistol.lua file.
If the weapon is a shotgun, modify the shotgun.lua file.
If you want to do explosive rounds, you need to add the crater and explosion code. I recommend ripping the code from the Bazooka and scaling down the explosion.
Also, you can modify the color of bullets the gun shoots, by modifying these lines of code
1
2
3
4
5
6
2
3
4
5
6
function cc.ump45.bullet.draw(id)							-- Draw 	-- Setup draw mode 	setblend(blend_light) 	setalpha(1) 	setcolor(255,255,0) 	setscale(1,1)
You want to modify this line
1
setcolor(255,255,0)
There are multiple setcolor lines in the weapon scripts, so be sure that it is in the bullet.draw function.
I use red bullets to designate explosive/incindiary rounds, yellow to designate normal, green to designate hollowpoints (high push, low damage) and blue to designate AP (low push, high damage)
You can also modify the wind and gravity effect on bullets by modifying these lines
If you want to decrease wind effect, lower the 0.02 value.
If you want to increase it, raise that value
Same applies to gravity, except modify the 0.75 value
1
2
3
4
5
6
7
2
3
4
5
6
7
function cc.ump45.bullet.update(id)						-- Update 	-- Wind + Gravity influence on speed 	projectiles[id].sx=projectiles[id].sx+getwind()*0.02 	projectiles[id].sy=projectiles[id].sy+getgravity()*0.75 	-- Move 	cc.ump45.bullet.move(id) end
Modify the speed of the original bullet by changing the multiplication factor (in this example, 15.0)
Make it larger for a faster bullet, smaller for a slower bullet
1
2
2
projectiles[id].sx=math.sin(math.rad(getplayerrotation(0)))*15.0 		projectiles[id].sy=-math.cos(math.rad(getplayerrotation(0)))*15.0