Simple question, hoping for simple answer...

G

Grofit

Guest
Hello there,

Ive recently started trying to do some work with the Source Engine, however i realised it didnt like VS 2005 much and now have got it up and running in VS 2003 nicely.

I messed around a bit tinkering with things in the "modify HL2 MP" mod, followed what tutorials i could. However i then thought i would make a weapon, just something simple, as i thought the current build was too cluttered i just wanted base objects and a couple of pre made items to base mine off i went with the "Start Mod From Scratch" option.

Looked cool, kinda copied the MP5 example, i decided to just get a shell of a weapon running from the base SDK weapon class. Set it all up, it builds fine. I've set it up within the base class ENUM object as "Weapon_Test", as well as assigning it a name.

However when i try to create the weapon in game it wont come up, the code is pretty much identical to the MP5 code although it all has slight numerical differences in bullet spread and reload speed etc. I have also made a script file to go with it which is a copy of the existing MP5 weapon script with the name changes.

Anyway basically it still isnt working, and ive been looking all day for a SOLID tutorial on how to build a simple weapon from A->B, without much luck.

So my question is basically what do i NEED to make sure ive done to get a weapon from my head into the game, below is what steps ive done.

- Made CWeaponTest Class, Derived from cBaseSDKWeapon (or similar name)
- Added entries into cBaseSDKWeapon class for the new weapon
- Added weapon script file within the relevent area in my steamapps

Is there anything im missing, sorry if i appear to be asking a stupid question but to someone whos not to familiar with this engine its quite a problem.

Thanks for anyones help/advice
 
Still no updates,

As this is one of the CORE things most coders working with Source Engine will be doing i would have thought there would be more resources on it, has anyone got a link to any tutorials on SIMPLE weapon creation?

Or even the basic steps to creating a weapon and adding it into the game?
 
Yeah, ive already checked out the Source Wiki... its all full of GOOD info, but unfortunatly it all seems like little chunks of random code that may be cool to add, but there seems to be very little on the ground work of the Source Engine.

I dont really expect to be spoonfed information, although i would like to see a few resources aimed at the beginners. The closest thing i found to what i wanted was creating a really complex weapon on VERC.

Im also using the "Create Mod From Scratch" example so im using the SDK base objects to derive from... not sure if thats the best way, or if i should be deriving from different objects, although the MP5 normal weapon works this way.

Anyway thanks for your help chief, will keep sniffing later...
 
Well did some more sniffing and im still unsure of the "standard" method of doing this, as all articles seem to have diffrent ways depending on how you created the mod.

Any of you guys know some good sites to check out for the coding side of HL2 modifications?

Only good ones i seemed to find is VERC, although it was a nightmare trying to find any useful information there, and HL2coding although it didnt have much content... anyone else got any good links?
 
One of the things (and since you didn't specify if you did this or not) would be to make sure the buckets are all setup in the .txt file for the weapon.

You can't have 2 weapons occupying the same bucket at the same time...

I don't have my code on this machine, but I'll give you a quick example of what I've found tomorrow.
 
You also didn't tell EXACTLY where you put the script .txt file.

It should be in SteamApps\SourceMods\YOURMOD\scripts\.

There was a good tutorial on making a weapon from a copy of an existing one but I don't remember the page it was on. My friend who gave me the link isn't responding. I'll post it later.
 
As promised in the .txt file there are these entries:

"bucket" "3"
"bucket_position" "0"

Bucket is weapon slot
and the bucket position is the weapons position within that slot.

So bucket = 0 and bucket_position = 0 is the first weapon slot and first position.
And bucket = 0 and bucket_position = 1 is the first weapon slot and second position. (so pressing 1 twice in game will select the second weapon in the first slot.)

I made the mistake of mangling my buckets early on so that's why I mention it, the code would compile and I'd have just the first default weapon because all the others would be stuck in the same bucket and bucket_position.

Hope that helps.
 
Back
Top