• Anathema Weapon Base
    77 replies, posted
[img]https://dl.dropboxusercontent.com/u/965202/gun2.png[/img] [i]'cause no project is official without a logo[/i] The Anathema Weapon Base is a project I've been working on the past few weeks, partially because I don't like how weapons work by default, and partially because I think this holds true for lots of other people. I've been coding this with the idea of the public in mind. I emphasize customization and clean code when possible. That's not to say I'm a supreme coder or anything - I'm just a newbie - but I want people to be able to use this for their needs. It's got variables to control a working range, accuracy/recoil when using ironsights or not, sprinting and ironsight animations, and other neat things. Information and downloads can be found [url=http://www.dotbsp.com/anathema]here[/url]. Thanks everyone. [b]EDIT:[/b] Hey you! Don't download anything from that page. Download the new [url=http://facepunch.com/showthread.php?t=1334377&p=43385896&viewfull=1#post43385896]beta[/url] instead! There's major bugfixes that the old versions don't have, and the old versions I had didn't play nice in multiplayer. This one should be at least a million times better.
Not bad, the only other pack I've seen with range dropoff is leetnoobs FAS pack but his method of calculating it is rather lazy (damage dropoff is calculated via the case length of the bullet eg 9mm has brutal dropoff and is pretty much useless beyond 30-40 metres or so) a few ideas for extra features: armor pierce variable - converts a percentage of the weapons total damage output into armor ignoring damage, setting a negative value makes the weapon do reduced damage to armored targets hard target damage multiplier - a multiplier for the amount of damage the bullets do to vehicles, props, entities etc distant firing sounds - I've actually added this to the mad cows base myself but i never finished the code properly so i could probably help you out if you wanted to add it to your base. Basically firing unsilenced weapons makes that rat-tat-tat sound of distant gunfire that can be heard everywhere on the map. This would need to be togglable by convar because i can imagine some people would find it annoying/unnecessary trails - a bullet trail effect so if you say had a large and ridiculously powerful sniper rifle you could give it trails so it gave away the shooters position when fired. Trails can be set up with custom thickness and colour/alpha suppression - basically weapons can have a suppression value, this means that bullets passing close to players will 'suppress' them based on the weapons suppression multiplier. Having the suppression effect slightly blurs and shakes your vision and slows your movespeed for a couple of seconds. This is probably not necessary for faster paced gamemodes like ttt and deathmatch but it would make a nice touch for RP
[QUOTE=legendofrobbo;43201705]Not bad, the only other pack I've seen with range dropoff is leetnoobs FAS pack but his method of calculating it is rather lazy (damage dropoff is calculated via the case length of the bullet eg 9mm has brutal dropoff and is pretty much useless beyond 30-40 metres or so)[/quote] Thanks. That guy actually helped me a little bit with little bits of the code. Oh, and Kilburn too! [QUOTE=legendofrobbo;43201705]a few ideas for extra features: armor pierce variable - converts a percentage of the weapons total damage output into armor ignoring damage, setting a negative value makes the weapon do reduced damage to armored targets[/quote] That's a neat idea, I'll have to look into this for my next update. [QUOTE=legendofrobbo;43201705]hard target damage multiplier - a multiplier for the amount of damage the bullets do to vehicles, props, entities etc[/quote] Same here, sounds cool. [QUOTE=legendofrobbo;43201705]distant firing sounds - I've actually added this to the mad cows base myself but i never finished the code properly so i could probably help you out if you wanted to add it to your base. Basically firing unsilenced weapons makes that rat-tat-tat sound of distant gunfire that can be heard everywhere on the map. This would need to be togglable by convar because i can imagine some people would find it annoying/unnecessary[/quote] I had trouble figuring out how to do this and I was really looking forward to implementing this. Sadly, I couldn't. If you could help with that, I would be grateful. [QUOTE=legendofrobbo;43201705]trails - a bullet trail effect so if you say had a large and ridiculously powerful sniper rifle you could give it trails so it gave away the shooters position when fired. Trails can be set up with custom thickness and colour/alpha[/quote] I don't see why this couldn't be added. I need to add scopes to my gun, so I'll take a gander at this when I'm coding scoping. [quote]suppression - basically weapons can have a suppression value, this means that bullets passing close to players will 'suppress' them based on the weapons suppression multiplier. Having the suppression effect slightly blurs and shakes your vision and slows your movespeed for a couple of seconds. This is probably not necessary for faster paced gamemodes like ttt and deathmatch but it would make a nice touch for RP[/QUOTE] This is an odd proposal, I think. I don't think this is very realistic or very fun, so I don't think I would add this.
[QUOTE]I had trouble figuring out how to do this and I was really looking forward to implementing this. Sadly, I couldn't. If you could help with that, I would be grateful.[/QUOTE] Its actually ridiculously simple, in the weapons fire code you put self.Weapon:EmitSound("distantfiresound", 0, 100), having the sound level as 0 makes it a global sound and everybody can hear it. It would probably be easier to define a weapons sound type in its settings file and play the correct sound rather than manually define it in every single weapon but eh i never got that far edit: leave the regular fire sound there too of course Anyway here's some custom sounds that I made for the system, there's smg/assault rifle sounds as well as a few deep rolling booms that pair very well with sniper rifles: [url]http://www.sendspace.com/file/nizt8a[/url]
[url]http://dotbsp.com/anathema[/url] Anathema has found it's home on one of my websites. -removed, this is still being worked on though!- ^ This is a work in progress. The goal is to have my brother, who's never mucked with Lua or the Source Engine much, create his own weapon using my documentation, gamemode (just so he has a gamemode to stick the file in), and script. The things I'm looking to implement in the next version include: - [b]Distant sounds[/b] (I'll be taking a gander at different methods for this.) - [b]Damage to props/world variable[/b] (It'd be easier to just have the user define how much damage he wants done to the world. It'll go off of the same range.) - [b]Armor penetration[/b] (I'm not sure how to do this, but I don't think it would be crazy hard.) - [b]EmitSound distance variable[/b] (I'm stupid and forgot to implement this.) - [b]Scopes[/b] (This is going to be the most difficult, because I want to implement two different methods for scoping. I want to see if I can't get a scope to work off of the prop itself and I want to see if I can't get the classic Counter-Strike style scope in the script as well.)
This looks great. Been meaning to create some custom guns myself. Just double checking, Is it alright to publish any weapons made using this base on the workshop. (With credit to you ofcourse :P)
Of course. Even if you didn't post credit, it's not like I'd really chase you down or anything.
Maybe you could add it to github to let people add to it themselves? Theres a few bits and bobs I have on my weapon base which I wouldn't mind seeing everywhere else, failing that should I just post them here?
I've never used GitHub before, but I'll take a look when I get home. For now, you can totally post it in this thread and I'll totally love you for it.
Does this have idle animations?
No, but I can't think of a way to make an idle animation with the default CSS hands wrapped around the pistol. :P Perhaps I could make some subtle movements and stuff.
[QUOTE=wauterboi;43225268]No, but I can't think of a way to make an idle animation with the default CSS hands wrapped around the pistol. :P Perhaps I could make some subtle movements and stuff.[/QUOTE] Can you not just use ACT_VM_IDLE?
But then what wauterboi was thinking was like, an idle animation for weapons that don't have a proper/good-looking ACT_VM_IDLE Calc view "animation" would be nice actually
Oh, doesn't that happen automatically? If not, I'll just stick that in my SetMode function when you release right-click and Shift.
-snip, i'll do something better-
That's actually... Pretty useful. [editline]18th December 2013[/editline] What do we have to do to get that feature working? [editline]18th December 2013[/editline] Also, I just realized that the acronym for your addon is the same one used to refer to the Assault Weapons Ban Coincidence? I THINK NOT Sorry, but the Assault Weapons Ban runs [I]anathema[/I] to my ideals and I have no choice but to boycott your base. [sp]not really lol[/sp] [editline]18th December 2013[/editline] Also, not sure if this helps: Valve Wiki: [quote]Texture Scale Adjusts the size of the texture. A value of “1” maps one texture pixel onto one unit. Negative numbers mirror the texture.[/quote][U][/U]
That feature isn't released yet, haha. It'll be in the next version. And I'll look into texture scaling!
[code][ERROR] addons/anathema_test/lua/weapons/weapon_anathema_base/shared.lua:329: attempt to perform arithmetic on upvalue 'recoilTime' (a nil value) 1. ShootEffects - addons/anathema_test/lua/weapons/weapon_anathema_base/shared.lua:329 2. ShootBullet - addons/anathema_test/lua/weapons/weapon_anathema_base/shared.lua:306 3. unknown - addons/anathema_test/lua/weapons/weapon_anathema_base/shared.lua:263 Timer Failed! [burstFire][@addons/anathema_test/lua/weapons/weapon_anathema_base/shared.lua (line 259)] G[/code] All I did was set the Burst to true and the Burst amount to 4. Also, timers on burst :yuck: The Runspeed/Walkspeed mechanics, as well as the ammo limits, are interfering with other weapons, too IMO ammo limits should be something handled by the gamemode and not the SWEP base, but that's just me Overall though, this base is very good! I wish you had assembled a whole slew of example weapons, but I might just take that task upon myself. I like the base a LOT so far. [editline]19th December 2013[/editline] I just got killed by some NPCs and I noticed that you use timers for the reload too! May I suggest that you at least externalize them from the SWEP so that they don't error and scare people?
Today, I fixed the timer issue on the Burst Fire function (Really stupidly simple mistake, haha), changed a few little things, and I added a new variable: SWEP.Primary.ReloadEachShot. This variable will place the weapon out of ironsight mode each time, and Reload based on SWEP.Primary.Delay. This is great if your weapon has no reload animation and is a Shotgun or Sniper. I've also turned the spread/recoil variables into table values like so: SWEP.Primary.Spread.Normal. I've removed the ClipMax function from the SWEP because it was stupid in the first place and I completely forgot a better way of doing it. For now, the variable still exists but your gamemode/addon must make use of the variable. I've completely scrapped the texture-replacement style of scoping because of two reasons: 1. It sucks. 2. I think I can do better. In response to the Runspeed/Walkspeed mechanics problem, I can't think of a logical way to resolve the issue without obliterating the ability to change player speeds. I'll add a variable to turn off the Player Movement Speed changing altogether, but I don't know of a way to reset the player speed when the player switches to another, non-AWB weapon. [b]EDIT:[/b] Just added that variable: self.SpeedChangingEnabled What's wrong with timers? What would be the better way to do it? How do you externalize a timer?
Timers error if they are in the SWEP itself and the SWEP is removed (e.g. on death) The way I deal with it is I make a function like, GenericTimerFunctionName(arg1, arg2, arg3) and just call it from the SWEP. Since it's a Global it's a bit messy but it should be acceptable because you're using it in a base.
[QUOTE=BFG9000;43241543]Timers error if they are in the SWEP itself and the SWEP is removed (e.g. on death) The way I deal with it is I make a function like, GenericTimerFunctionName(arg1, arg2, arg3) and just call it from the SWEP. Since it's a Global it's a bit messy but it should be acceptable because you're using it in a base.[/QUOTE] Fixed with the power of if IsValid( self ) then!
[QUOTE=wauterboi;43241643]Fixed with the power of if IsValid( self ) then![/QUOTE] I've tried that before; it didn't work Hmmm, but maybe it was because I was using self:IsValid() instead of IsValid(self) fuck
Can't wait to use this for my upcoming fallout sweps, I hope the update will be out before I finish making the view/world models!
[url]http://dotbsp.com/lua/awb/awb1.1.zip[/url] This doesn't have the promised scopes, but I felt the bugfixes were extremely important to release as soon as possible. [quote]Changelog v.1.1 – 12.16.13: Added variable SWEP.Primary.ReloadEach Shot Players cannot attack when transitioning into and from aiming Removed MaxAmmo function SWEP.Primary.Spread and SWEP.Primary.Recoil are now tables containing their respective variables (Normal and WhenAiming) [/quote] [editline]19th December 2013[/editline] Oh, add to the list: Fixed Burst-Fire Spawn Error
Does IsValid(self) seem to work as opposed to self:IsValid()?
Obviously it does, lua can't index nil value, and calling A:B(...) is just like calling A.B(A, ...). So if A is nil, or in this case the weapon when it gets removed and timer continues to run, it will try to index the nil weapon.
So I noticed some bugs with the burst code and took it upon myself to fix them. -There is a slight delay before you actually start the burst due to the first shot being on a timer -Timers ruin bullet spread, causing the bullets to go slightly downward and to the right of where they should -If you initiate a burst before sprinting, the bullets will still fire after sprinting I've managed to fix all three of these issues with the following modifications to the primary func, as well as the addition of a specialized ShootBullet function: [url]http://pastebin.com/jLTvsJw9[/url] Hope this helps.
I'm definitely going to take a gander tomorrow after work, and I'm really happy with people's interest in contributing code, sounds, and all that. I was afraid I was going to get bludgeoned for bad code or something.
[QUOTE=wauterboi;43247952]was afraid I was going to get bludgeoned for bad code or something.[/QUOTE] Nah, the base is still under construction so I don't think anyone will judge you quite yet EDIT: Except for the usage of timers :P
You can't set a reload sound ? Also deploy sounds? Also holster sounds ? [editline]20th December 2013[/editline] Also, I'm guessing this is a glitch if you sprint and switch weapons and switch back you are stuck in the sprint position until you hit shift...
Sorry, you need to Log In to post a reply to this thread.