Need Help on Coding Custom Weapon

Discuss Certain Aspects of Mapping, Modeling, and Coding.
Post Reply
samwonghc
Vertex
Vertex
Posts: 5
Joined: Mon May 13, 2013 4:06 pm

Need Help on Coding Custom Weapon

Post by samwonghc »

I am interested on making a railgun.Is there any way to fire with a "rail",I mean the effect.I have tried to code custom ammo,but seem that when I load the map,error appears.."Sorry for my ENG"
Here is my code.
WeaponData
{
// Weapon fdata is loaded by both the Game and Client DLLs.
"printname" "RailGun"
"viewmodel" "models/weapons/v_gauss.mdl"
"playermodel" "models/weapons/w_gauss.mdl"
"anim_prefix" "gauss"
"bucket" "2"
"bucket_position" "2"

"clip_size" "100"
"clip2_size" "100"
"default_clip" "100"
"default_clip2" "100"

"primary_ammo" "railgun"
"secondary_ammo" "None"

"weight" "4"
"item_flags" "0"

// Sounds for the weapon. There is a max of 16 sounds per category (i.e. max 16 "single_shot" sounds)
SoundData
{
"single_shot" "Weapon_Gauss.Single"
"special1" "Weapon_Gauss.Special1"
"special2" "Weapon_Gauss.Special2"
}

// Weapon Sprite data is loaded by the Client DLL.
TextureData
{

"weapon"
{
"font" "WeaponIcons"
"character" "h"
}
"weapon_s"
{
"font" "WeaponIconsSelected"
"character" "h"
}
"ammo"
{
"file" "sprites/a_icons1"
"x" "26"
"y" "90"
"width" "27"
"height" "27"
}
"crosshair"
{
"font" "Crosshairs"
"character" "Q"
}
"autoaim"
{
"file" "sprites/crosshairs"
"x" "0"
"y" "48"
"width" "24"
"height" "24"
}
"Advanced" // only for Weapon_Scripted
{

// **Primary Attack**

// 0 = none, 1 = Basic Bullet, 2 = Burst, 3 = shotgun, 4 = autoshotgun, 5 = laser, 6 = warp
"FireType1" "1"


// Rate of Weapons Fire ( Not for laser or warp )
"FireRate1" "5"

// Allow a refire as fast as the player can click, Basic Bullet Only.
"FastFire1" "1"

// Allow Fire Underwater?
"FireUnderWater1" "0"

// For Bullet accuracy
"FireCone1" "5" // Starting Value ( 0-20 )
"FireConeLerp1" "0" // Bool
"FireConeLerpto1" "3" // Value to lerp accuracy too ( 0-20 )

}

// **Secondary Attack**

// 0 = none, 1 = Basic Bullet, 2 = Burst, 3 = shotgun, 4 = autoshotgun, 5 = laser, 6 = warp, 8 = scope
"FireType2" "0"

// Rate of Weapons Fire ( Not for laser or warp )
"FireRate2" "1.0"

// Allow a refire as fast as the player can click, Basic Bullet Only.
"FastFire2" "0"

// Allow Fire Underwater?
"FireUnderWater2" "0"

// Secondary Fire uses Secondary Ammo Type. If 0, will use primary ammo.
"SecondaryAmmoUsed" "0"

// For Bullet accuracy
"FireCone2" "1" // Starting Value ( 0-20 )
"FireConeLerp2" "1" // Bool
"FireConeLerpto2" "3" // Value to lerp accuracy too ( 0-20 )
And here is the code of the custom ammo
CustomAmmo
{
"railgun"
{
"dmgtype" "1"
"tracer" "2"
"plrdmg" "200" //Damage done by players using this ammo.
"npcdmg" "200" //Damage done by NPCs using this ammo.
"maxcarry" "200"
"grains" "200" // 1 grain = 64.79891 milligrams
"ftpersec" "1225"
}
Is there something I did wrong,or its not even possible to make a railgun.
Please help,Thanks so much :(
MaestraFénix
Team Member
Team Member
Posts: 2470
Joined: Mon May 10, 2010 11:50 am
Location: Spain
Contact:

Re: Need Help on Coding Custom Weapon

Post by MaestraFénix »

I´m unable to see something wrong. What error appears on the console? Do you used the entity weapon_scripted, with the name of the script as "custom_name" without the ".txt"?
Click on my photo to add me into your friends in Steam
Image
Steam photos | Steam videos

Image
landmouse682
Pixel
Posts: 1
Joined: Tue May 14, 2013 3:29 am
Contact:

Re: Need Help on Coding Custom Weapon

Post by landmouse682 »

I am working for the same project but it's did't shoot the bullet like the "rail", just have sound for the weapon and the damage for the NPC or the player !
samwonghc
Vertex
Vertex
Posts: 5
Joined: Mon May 13, 2013 4:06 pm

Re: Need Help on Coding Custom Weapon

Post by samwonghc »

Maestro Fénix wrote:I´m unable to see something wrong. What error appears on the console? Do you used the entity weapon_scripted, with the name of the script as "custom_name" without the ".txt"?
Thanks for replying.It seems that the game is unable to load up the custom ammo,I will check at home for a detailed information about the error.Fortunately I can shoot with my weapon but it just became a automatic gauss gun /w super high fire rate but not with the "tracer". Do I need to work on the weapon script or the custom ammo script.Sorry for being silly but do you mean I need to use the weapon_scripted to work on this.This weapon is based on the gauss gun script
P.S. I heard that the Rail and Beam tracer is not working?Is that true.Thanks
MaestraFénix
Team Member
Team Member
Posts: 2470
Joined: Mon May 10, 2010 11:50 am
Location: Spain
Contact:

Re: Need Help on Coding Custom Weapon

Post by MaestraFénix »

Yes, usually, you use the weapon_scripted to use a custom_weapon (there are other ways, but try this first).

And yes, the rail and beam tracers of the custom ammo are broken.

http://wiki.obsidianconflict.net/?title ... ed_Weapons

http://wiki.obsidianconflict.net/?title ... stom_Ammos


P.D: For the Gauss gun, do you mean the Tau cannon that we have?
Click on my photo to add me into your friends in Steam
Image
Steam photos | Steam videos

Image
samwonghc
Vertex
Vertex
Posts: 5
Joined: Mon May 13, 2013 4:06 pm

Re: Need Help on Coding Custom Weapon

Post by samwonghc »

Maestro Fénix wrote:Yes, usually, you use the weapon_scripted to use a custom_weapon (there are other ways, but try this first).

And yes, the rail and beam tracers of the custom ammo are broken.

http://wiki.obsidianconflict.net/?title ... ed_Weapons

http://wiki.obsidianconflict.net/?title ... stom_Ammos


P.D: For the Gauss gun, do you mean the Tau cannon that we have?
Thanks For helping,Is that the Primary Attack needed to be the same with Primary Ammo?Just like If I put "Buckshot" in Primary ammo then I need to put "3" in the Primary Attack?Then If I put "GaussEnergy" in Primary ammo,then what should I put in the Primary attack in order to have the original Tau cannon tracer?cus it just shoot with out anything.

Anyway,gauss gun is the Tau cannon that we are using.

P.S Is that possible that I use TracerType,TracerFrequency and ImpactEffect to make it work?but can I use those command without Primary Attack thing?

P.S By the way,maybe I put the custom ammo code in the wrong place,where should I put it in actually?I just add the code at the bottom of the file "oc_lobby_modify.txt",am I doing right or I need to work on this in Hammer?
MaestraFénix
Team Member
Team Member
Posts: 2470
Joined: Mon May 10, 2010 11:50 am
Location: Spain
Contact:

Re: Need Help on Coding Custom Weapon

Post by MaestraFénix »

samwonghc wrote:Thanks For helping,Is that the Primary Attack needed to be the same with Primary Ammo?Just like If I put "Buckshot" in Primary ammo then I need to put "3" in the Primary Attack?Then If I put "GaussEnergy" in Primary ammo,then what should I put in the Primary attack in order to have the original Tau cannon tracer?cus it just shoot with out anything.

Anyway,gauss gun is the Tau cannon that we are using.

P.S Is that possible that I use TracerType,TracerFrequency and ImpactEffect to make it work?but can I use those command without Primary Attack thing?

P.S By the way,maybe I put the custom ammo code in the wrong place,where should I put it in actually?I just add the code at the bottom of the file "oc_lobby_modify.txt",am I doing right or I need to work on this in Hammer?
Yes, you have to match the type of the weapon with the ammo.

Currently, is not possible to make energy weapons, so you can´t make a Tau cannon. Also, using the weapon_gauss with a custom script will make the weapon have bugs, since looks like somewhere in the code makes this replacement fail.

No, you must use your ammo on your map modify. NEVER modify the script of another map, since you could have errors when playing online due the differences.


*Also this reminds me to expand the page about the Scripted Weapons, it doesn´t mention how to use them or the ways to get them work*
Click on my photo to add me into your friends in Steam
Image
Steam photos | Steam videos

Image
samwonghc
Vertex
Vertex
Posts: 5
Joined: Mon May 13, 2013 4:06 pm

Re: Need Help on Coding Custom Weapon

Post by samwonghc »

Maestro Fénix wrote:
samwonghc wrote:Thanks For helping,Is that the Primary Attack needed to be the same with Primary Ammo?Just like If I put "Buckshot" in Primary ammo then I need to put "3" in the Primary Attack?Then If I put "GaussEnergy" in Primary ammo,then what should I put in the Primary attack in order to have the original Tau cannon tracer?cus it just shoot with out anything.

Anyway,gauss gun is the Tau cannon that we are using.

P.S Is that possible that I use TracerType,TracerFrequency and ImpactEffect to make it work?but can I use those command without Primary Attack thing?

P.S By the way,maybe I put the custom ammo code in the wrong place,where should I put it in actually?I just add the code at the bottom of the file "oc_lobby_modify.txt",am I doing right or I need to work on this in Hammer?
Yes, you have to match the type of the weapon with the ammo.

Currently, is not possible to make energy weapons, so you can´t make a Tau cannon. Also, using the weapon_gauss with a custom script will make the weapon have bugs, since looks like somewhere in the code makes this replacement fail.

No, you must use your ammo on your map modify. NEVER modify the script of another map, since you could have errors when playing online due the differences.


*Also this reminds me to expand the page about the Scripted Weapons, it doesn´t mention how to use them or the ways to get them work*
Thanks again for replying,So How do I create the custom ammo,also which one in the "dmgtype" and "tracer" are working?

Also,I need to create my own map_modify.txt in order to make it work?Thanks alot
MaestraFénix
Team Member
Team Member
Posts: 2470
Joined: Mon May 10, 2010 11:50 am
Location: Spain
Contact:

Re: Need Help on Coding Custom Weapon

Post by MaestraFénix »

samwonghc wrote:Thanks again for replying,So How do I create the custom ammo,also which one in the "dmgtype" and "tracer" are working?

Also,I need to create my own map_modify.txt in order to make it work?Thanks alot
All the settings of dmgtype works. On tracer, only the options 0,1 and 4 (none,line and Line and Whiz).

Yes, you need a map, so you have to do a mapname_modify to put inside the custom ammo.
Click on my photo to add me into your friends in Steam
Image
Steam photos | Steam videos

Image
samwonghc
Vertex
Vertex
Posts: 5
Joined: Mon May 13, 2013 4:06 pm

Re: Need Help on Coding Custom Weapon

Post by samwonghc »

Maestro Fénix wrote:
samwonghc wrote:Thanks again for replying,So How do I create the custom ammo,also which one in the "dmgtype" and "tracer" are working?

Also,I need to create my own map_modify.txt in order to make it work?Thanks alot
All the settings of dmgtype works. On tracer, only the options 0,1 and 4 (none,line and Line and Whiz).

Yes, you need a map, so you have to do a mapname_modify to put inside the custom ammo.
Thanks,Here is the last thing I wanna ask,If I use Custom Ammo,Which FireType Should I use?Just BasicBullet?
MaestraFénix
Team Member
Team Member
Posts: 2470
Joined: Mon May 10, 2010 11:50 am
Location: Spain
Contact:

Re: Need Help on Coding Custom Weapon

Post by MaestraFénix »

samwonghc wrote:Thanks,Here is the last thing I wanna ask,If I use Custom Ammo,Which FireType Should I use?Just BasicBullet?
All works except the laser and warp fire types. Read the wiki pages.
Click on my photo to add me into your friends in Steam
Image
Steam photos | Steam videos

Image
Post Reply