Weapon scripting

I’ve never made a Gmod addon myself, but I’ve wanted to tweak those I’ve downloaded in the past.

Certain mods I’d like not to have people mucking around with in a game except me. Others I’d like to share. My favorite is the WWII weapons mod from Day of Defense, which, thankfully, doesn’t require Day of Defense to use. (Link) I love that mod, but it’s admin only, which made me sad. :<

Some weapons I’ve downloaded I don’t like how their damage is too low and the recoil too high. Some other times the damage is absurd and the recoil is pathetic. Therefore I’d like to know how to modify these factors as well.

Perhaps I’d like to give some of my shiny toys to some NPCs. How do I work in the additional models? What needs to be done coding-wise?

Maybe there’s some nice iron-sighting built into the weapon, but maybe I’d like my screen to zoom up just a little like the many first-person shooters I’m so used to. Can you show me how to do that too?

I appreciate any assistance that is given. Perhaps one day I can release a proper weapons mod of my own. Still a total noob here, and I refuse to allow my first download to be a stupid-ass background or an advanced dupe–considering I suck at building things anyway. XD I’m too dumb to even figure out Wiremod.

Usually you can actually use find in notepad to look for recoil or damage, after that it should be pretty self explanatory.
If it uses math.random then the first number is the minimum recoil, and the second one is the max recoil.

[editline]14th January 2011[/editline]

Also its Day of Defeat :v:

The math.random part is what I never knew. Thanks for that.

Also after some hunting on the internet (surprisingly more than I expected… you’d be amazed how much of a pain in the ass it was), I found what I needed.

This was the result.

Well, that’s good.
By the way, learn how to script your own SWEPs, it’s much more satisfying.

Exactly what I aim to do next. I should find a tutorial somewhere.

Try this: http://wiki.garrysmod.com/?title=Lua_Tutorial_Series
That should help you code in LUA.

Oh god this is going to get very confusing very quickly. @_@

But I’m determined to make a mod of my own! Thanks for the link. :slight_smile: