• The original Code for Hl2 weapons
    11 replies, posted
[B]Does anyone know where to find the original code for the weapons From Hl2? like if i wanted to copy them then edit them? [/B]The only thing i could find in the folders was file called the weapons name then _.txt So like weapon_shotgun.txt This would normally be fine but it takes all the weapons information from the client.dll's like you can see here [code]// Shotgun WeaponData { // Weapon data is loaded by both the Game and Client DLLs. "printname" "#HL2_Shotgun" "viewmodel" "models/weapons/v_shotgun.mdl" "playermodel" "models/weapons/w_shotgun.mdl" "anim_prefix" "shotgun" "bucket" "3" "bucket_position" "0" "bucket_360" "1" "bucket_position_360" "1" "clip_size" "6" "primary_ammo" "Buckshot" "secondary_ammo" "None" "weight" "4" "rumble" "5" "item_flags" "0" // Sounds for the weapon. There is a max of 16 sounds per category (i.e. max 16 "single_shot" sounds) SoundData { "empty" "Weapon_Shotgun.Empty" "reload" "Weapon_Shotgun.Reload" "special1" "Weapon_Shotgun.Special1" "single_shot" "Weapon_Shotgun.Single" "double_shot" "Weapon_Shotgun.Double" // NPC WEAPON SOUNDS "reload_npc" "Weapon_Shotgun.NPC_Reload" "single_shot_npc" "Weapon_Shotgun.NPC_Single" } // Weapon Sprite data is loaded by the Client DLL. TextureData { "weapon" { "font" "WeaponIcons" "character" "b" } "weapon_s" { "font" "WeaponIconsSelected" "character" "b" } "weapon_small" { "font" "WeaponIconsSmall" "character" "b" } "ammo" { "font" "WeaponIconsSmall" "character" "s" } "crosshair" { "font" "Crosshairs" "character" "Q" } "autoaim" { "file" "sprites/crosshairs" "x" "0" "y" "48" "width" "24" "height" "24" } } } [/code] Can't quite find the Dll's and i'm not sure if i want to, if i edit these can't i get a vac ban too?
The original weps are in C++. You can find the 2007 source here: [url]https://github.com/LestaD/SourceEngine2007[/url]
[QUOTE=code_gs;50696805]The original weps are in C++. You can find the 2007 source here: [url]https://github.com/LestaD/SourceEngine2007[/url][/QUOTE] Adding to this, most of the functions in the original code are exposed to Lua, so they can be "translated" into a SWEP.
[QUOTE=zerf;50696870]Adding to this, most of the functions in the original code are exposed to Lua, so they can be "translated" into a SWEP.[/QUOTE] That seems to be where i'm stuck i've had experience with C+, i've had a lot less with Lua and i don't know where i'd start to transfer that into a swep, I don't want to look like i'm lazy but any help would be greatly appreciated
I still have this bookmarked. [URL]https://code.google.com/archive/p/swep-bases/downloads[/URL] Basically all HL2 weapons as SWEPS Assuming the url / content hasn't changed
[QUOTE=McDunkable;50696894]I still have this bookmarked. [URL]https://code.google.com/archive/p/swep-bases/downloads[/URL] Basically all HL2 weapons as SWEPS Assuming the url / content hasn't changed[/QUOTE] Thank's! thank you thank you! Seriously if i had something to give you i'd give you it. But i don't.. so. just have this thread instead. [editline]12th July 2016[/editline] Hey i'm looking at some of the code for the shotgun and it seems like the spread is broken dispute changing the cone value it always has perfect accuracy [code]SWEP.Primary.Empty = Sound( "Weapon_Shotgun.Empty" ) SWEP.Primary.Reload = Sound( "Weapon_Shotgun.Reload" ) SWEP.Primary.ReloadNPC = Sound( "Weapon_Shotgun.NPC_Reload" ) SWEP.Primary.Special1 = Sound( "Weapon_Shotgun.Special1" ) SWEP.Primary.Sound = Sound( "Weapon_Shotgun.Single" ) SWEP.Primary.SoundNPC = Sound( "Weapon_Shotgun.NPC_Single" ) SWEP.Primary.Damage = 8 SWEP.Primary.NumShots = 7 SWEP.Primary.NumAmmo = 1 SWEP.Primary.Cone = 8 SWEP.Primary.ClipSize = 6 // Size of a clip SWEP.Primary.Delay = 0.7 SWEP.Primary.DefaultClip = 6 // Default number of bullets in a clip SWEP.Primary.Automatic = true // Automatic/Semi Auto SWEP.Primary.Ammo = "Buckshot" SWEP.Primary.Tracer = 4 SWEP.Primary.TracerName = "Tracer" SWEP.Secondary.Sound = Sound( "Weapon_Shotgun.Double" ) SWEP.Secondary.Damage = 8 SWEP.Secondary.NumShots = 12 SWEP.Secondary.NumAmmo = 2 SWEP.Secondary.ClipSize = -1 // Size of a clip SWEP.Secondary.DefaultClip = -1 // Default number of bullets in a clip SWEP.Secondary.Automatic = true // Automatic/Semi Auto SWEP.Secondary.Ammo = "None" function SWEP:GetBulletSpread() local cone = 8; return cone; end [/code] This is the snippit i susepect of causing it could anyone point out the problem with it i'm not seeing it. i tried changing the cone value but it doesn't do anything This is the original code is as follows [code] SWEP.Primary.Empty = Sound( "Weapon_Shotgun.Empty" ) SWEP.Primary.Reload = Sound( "Weapon_Shotgun.Reload" ) SWEP.Primary.ReloadNPC = Sound( "Weapon_Shotgun.NPC_Reload" ) SWEP.Primary.Special1 = Sound( "Weapon_Shotgun.Special1" ) SWEP.Primary.Sound = Sound( "Weapon_Shotgun.Single" ) SWEP.Primary.SoundNPC = Sound( "Weapon_Shotgun.NPC_Single" ) SWEP.Primary.Damage = 4 SWEP.Primary.NumShots = 7 SWEP.Primary.NumAmmo = 1 SWEP.Primary.Cone = VECTOR_CONE_10DEGREES SWEP.Primary.ClipSize = 6 // Size of a clip SWEP.Primary.Delay = 0.7 SWEP.Primary.DefaultClip = 6 // Default number of bullets in a clip SWEP.Primary.Automatic = true // Automatic/Semi Auto SWEP.Primary.Ammo = "Buckshot" SWEP.Primary.Tracer = 4 SWEP.Primary.TracerName = "Tracer" SWEP.Secondary.Sound = Sound( "Weapon_Shotgun.Double" ) SWEP.Secondary.Damage = 4 SWEP.Secondary.NumShots = 12 SWEP.Secondary.NumAmmo = 2 SWEP.Secondary.ClipSize = -1 // Size of a clip SWEP.Secondary.DefaultClip = -1 // Default number of bullets in a clip SWEP.Secondary.Automatic = true // Automatic/Semi Auto SWEP.Secondary.Ammo = "None" function SWEP:GetBulletSpread() local cone = self.Primary.Cone; return cone; end [/code] i'd Expect it to be the weird way the cone is done it being "vector_cone" then used with a function instead of a number Any one have any idea how to fix it?
Might have to update the base, it's 6 years old. Alternatively, maybe those enumerations don't exist.
[QUOTE=McDunkable;50697094]Might have to update the base, it's 6 years old[/QUOTE] So it's something wrong with the base as a whole not just the single line or lines of code? like functions or something was changed so now this no longer works?
Try changing "VECTOR_CONE_10DEGREES" to a number, such as 10
[QUOTE=zerf;50699667]Try changing "VECTOR_CONE_10DEGREES" to a number, such as 10[/QUOTE] I already tried that, i showed it in the 3rd post i made on this thread, it had no effect on it, i thought that's what caused it but it didn't seem to be the case, thank you for your input though.
I'm currently remaking the Source weapon base and CS:S/HL2(DM) weps in Lua; if you want to add me on Steam I can keep you updated.
[QUOTE=code_gs;50700223]I'm currently remaking the Source weapon base and CS:S/HL2(DM) weps in Lua; if you want to add me on Steam I can keep you updated.[/QUOTE] That would be cool, i think i may take you up on that, i'm rather interested in whats wrong in this exact instance with this swep i'd like to learn from this and maybe even fix it, it mostly working its just this little bump that needs to be overcome
Sorry, you need to Log In to post a reply to this thread.