Anathema Weapon Base

'cause no project is official without a logo

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 here. Thanks everyone.

EDIT: Hey you! Don’t download anything from that page. Download the new beta 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

Thanks. That guy actually helped me a little bit with little bits of the code. Oh, and Kilburn too!

That’s a neat idea, I’ll have to look into this for my next update.

Same here, sounds cool.

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.

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.

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.

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:

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:

  • Distant sounds (I’ll be taking a gander at different methods for this.)
  • Damage to props/world variable (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.)
  • Armor penetration (I’m not sure how to do this, but I don’t think it would be crazy hard.)
  • EmitSound distance variable (I’m stupid and forgot to implement this.)
  • Scopes (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. :stuck_out_tongue:

Perhaps I could make some subtle movements and stuff.

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 anathema 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:

That feature isn’t released yet, haha. It’ll be in the next version. And I’ll look into texture scaling!

[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)]

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.

EDIT: 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.