Forum posts

Thank you Admer, I will add that too. Got to get into good habits after all!
Captain, you are an absolute legend as ever ;) Thank you mate.
This fixed the problem immediately.

Not gonna lie, this had me scratching my head for 2 hours last night so I really appreciate the help. Have tons to learn when it comes to this stuff haha :)
TLDR: Trying to get two Barney variants with two ammo variants. Ammo variant works, but I can't get the second Barney to use it.

Hey guys, just had a C++ question for the code wizards on here! It's a bit of a long one explaining my issue, but I thought I'd list everything I've tried to make the problem more obvious :)

I'm rather helpless with programming myself but I've been attempting to create a custom variant of Barney that allows for him to use a more powerful bullet in his Glock. At the same time, I want to preserve the "normal" Barney who just uses his 9mm.

The steps I've done are as follows -
  • Added a new type of ammunition called MONSTER_BULLET_BARNSPECIAL. This works fine, and is the equivalent of the player's magnum 357 in damage. No issues here - if I just simply replace it instead of Barney's 9mm ammo (MONSTER_BULLET_9MM) in the .cpp, he tears stuff up.
  • Added a new Barney monster type called "Watson". It's based off CBarney in the .cpp. I did this as per the tutorial on this site (for adding the Hazmat/Cleansuit scientist in addition to normal Scientists as a separate "monster_cleansuitscientist"). This also works fine, and I can add Watson as a separate NPC in my HL levels now (after adding it to .FGD obviously).
All good so far!
  • I then tried to replace the default "BarneyFirePistol" settings with my own unique ones for the Watson variant, to give two different attacks, one for each Barney.
Unfortunately, this doesn't want to work. As far as I know, specifying void BarneyFirePistol (void); should allow the code to use the next entry of BarneyFirePistol in lieu of the original one?

This is what happens for the "Spawn" settings in the tutorial, and I was also able to use the same technique to make select HECU grunts friendly to the player in another edit.

The code I've got is as follows:
//Watson Unique Damage Settings

class CWatson : public CBarney
    void BarneyFirePistol(void);

LINK_ENTITY_TO_CLASS (monster_watson, CWatson);

void CWatson::BarneyFirePistol(void)
    Vector vecShootOrigin;

    vecShootOrigin = pev->origin + Vector(0, 0, 55);
    Vector vecShootDir = ShootAtEnemy(vecShootOrigin);

    Vector angDir = UTIL_VecToAngles(vecShootDir);
    SetBlending(0, angDir.x);
    pev->effects = EF_MUZZLEFLASH;

    FireBullets(1, vecShootOrigin, vecShootDir, VECTOR_CONE_2DEGREES, 1024, BULLET_MONSTER_BARNSPECIAL);

    int pitchShift = RANDOM_LONG(0, -20);

    // Only shift about half the time
    if (pitchShift > -10)
        pitchShift = -20;
        pitchShift -= -15;
    EMIT_SOUND_DYN(ENT(pev), CHAN_WEAPON, "barney/ba_attack2.wav", 1, ATTN_NORM, 0, 100 + pitchShift);

    CSoundEnt::InsertSound(bits_SOUND_COMBAT, pev->origin, 384, 0.3);

    // UNDONE: Reload?
    m_cAmmoLoaded--;// take away a bullet!
For some reason it seems the problem is that the code is defaulting to using the default "BarneyFirePistol". I've even tried renaming the new attack entry "WatsonFirePistol" or something along those lines, but it makes no difference.

Am I just being code illiterate? I think the edits I've made would make most coders cry to be fair haha.

Anyone who can offer help will of course be getting a note in the credits if and when I finish this mod ;)
Thank you everyone.
Thanks folks. I look forward to checking out the new TWHL tower btw, was just looking at the screenies. Omg <3
I thought it'd be nice to do a little animated short for my YouTube channel update, with Barney acting as my mouthpiece in a cosy little office. Figured I'd share it here with you guys :)

Hope everyone is holding in there during these tumultuous times.

The audio for the dialogue is a bit rubbish half-way through. Ironically I was droning on about how 8-bit wavs aren't great for audio, so...point made haha!
Happy 2021!
Great point 23-down, I think it'd actually be interesting to see the reaction of the "native" Black Mesa military units to the cleanup operation actually. It was something I was thinking of including as an idea in my current mod (albeit at a sister facility to Black Mesa).

The actual pic of the helicopter is directly from the tram ride into the base. You can see it in the tram canyon section, along with Barney waving his arms at it IIRC. In fact it seems all the pics bar the Dam are there are from the tram ride, so clearly they made the texture during the early part of developing the cinematic intro or something.

Also, I think it's clear the military would travel to and from Black Mesa regularly anyway. You'd get military chiefs and so on wanting to see black projects being researched there. In fact, IIRC the HECU was actually a unit assigned to Black Mesa specifically from a nearby base. I would imagine they were initially on hand to provide extra security until their purpose got twisted.

Adds quite a grim undertone to their mission, actually, when you consider some of them may have actually been somewhat familiar with areas of the base and the staff.
Posted 6 months ago2020-06-30 11:49:46 UTC
in Recreated a scene from the Matrix in Goldsrc. Post #344486
I look forward to hearing more about this mini-mod. More GoldSRC! Yum yum!
I've always liked GoldSRC more for some strange reason. Maybe it's due to the glut of Source related content in recent years? I am tempted to dip my toes in Source though, maybe after this project is done.
I shall provide minor programming assistance if needed.
Thanks Admer! Programming is one area I really suck on atm so I appreciate that :)
Posted 6 months ago2020-06-28 17:06:24 UTC
in Recreated a scene from the Matrix in Goldsrc. Post #344480
Looks great! By the way, is the next mod you are talking about "Black Mesa Research Outpost" ?
Thanks guys. Yeah the animations I've been making recently are going to be part of a mini-mod with that title, hopefully.
So far it's only a couple of maps but I have quite a few ideas :)
Posted 7 months ago2020-06-26 18:54:40 UTC
in Recreated a scene from the Matrix in Goldsrc. Post #344470
An idea I had this evening. Might include a less Matrix-y version in my next mod, since I was quite pleased with it ;)
I always did like Trinity
Posted 7 months ago2020-06-09 14:03:29 UTC
in Competition 39: The Buddy System Post #344384
Thanks guys, really pleased you enjoyed the maps! :)

The first ever project I have managed to finish, it was actually good having the time deadline because it made me take it to completion rather than having ideas and leaving them hanging. Learned a ton too.

My brushwork was definitely a little rough and basic because I was rushing so damn much towards the end, haha! I almost had to cut the warehouse showdown, but I'm really glad I managed to finish it instead. There are a lot of rather flat ceilings and walls to be sure ;)

I really liked the creativity of Captain P's entry and I was rather impressed by Burnerman's brushwork. The scene where you herd the Engineer into the rail lift and it carries him through the canyon was neat in particular.

Learned things from playing through both those entries too. Bravo to everyone who took part.
Posted 7 months ago2020-06-07 14:58:45 UTC
in How do you "connect" .fgd code to model skins? Post #344377
Took a few hours but I figured out how to add my custom "corpse" animations into the game :)
Custom Barney skins and monster_barney_dead animations
Quite happy with this. Hopefully future goldsrc mods I make will be considerably easier to customise regarding things like this now.
Posted 7 months ago2020-06-07 10:03:58 UTC
in How do you "connect" .fgd code to model skins? Post #344376
Awesome help Captain P, thank you! Saved me many hours of faffing with it. Super helpful :)

Also thank you for linking the barney.cpp. I was looking for this file too and had no luck.

The code in the end was as follows.

For adding the skins to Barney, you edit barney.qc with the following:
$texturegroup "skinfamilies"
{ "barney_body.bmp" "barney_legs.bmp" "barney_chrome.bmp" "w_beretta.bmp" }
{ "barney_body2.bmp" "barney_legs2.bmp" "barney_chrome2.bmp" "w_beretta2.bmp" }
This is added after the "body" entries for the gun and the "studio" body model. It is essential that there is a space between the {} brackets and the "model.bmp" entries on each side - otherwise compile fails.

The first line of the array specifies the default bitmaps used for the skin, the second line specifies the custom ones for the second skin and so on.

After adding the model to the mod subfolder, you edit your custom FGD for the mod as follows:
@PointClass base(Monster,TalkMonster, Sequence) size(-16 -16 0, 16 16 72) studio("models/barney.mdl") = monster_barney : "Barney"
skin(Choices) : "Skin" : 0 =
0 : "Barney"
1 : "Watson"
The labels can be whatever you want obviously, here they are used to specify either Default Barney or the custom character "Watson".

This same addition can be performed to "monster_barney_dead" in order to allow you to use the custom skin for Barney corpses in Hammer as well.

Result in game:
Barney SkinsBarney Skins
Dead Barney SkinsDead Barney Skins
The only thing I'm trying to work out now is how the "monster_barney_dead" entity specifies the model sequence for the corpse. "lying_on_back" sequence is tied to the "Lying on back" FGD parameter for "pose". Because it's not specified in the model .qc. Perhaps it's in the entity .CPP code.

Actually scratch that, turns out these values are specified in barney.cpp. So duplicating that .cpp for a custom NPC with the names of new animations would theoretically work. Sweet :)

Right now I use a non-solid monster_generic set to a scripted idle "dead" animation for custom dead animations, which is more clumsy.

Technically you could actually get around this in Hammer just by having a func_breakable over the corpse that triggers a gibshooter and killtarget on the monster_generic, but as far as I know func_breakables cannot be non-solid, so this might get in the way of gameplay.
Posted 7 months ago2020-06-06 21:07:47 UTC
in How do you "connect" .fgd code to model skins? Post #344372
Apologies if this has been answered before, I have been searching for tutorials for a few hours now and can't find what I'm looking for.

I've made a custom skin for Barney. However, I wanted to use this in my maps in addition to the original Barney skin, rather than just replacing the Barney model entirely with my new skin. Basically I want to emulate how you can have 4 different heads for the scientists even though it's one model.

To this end I edited the barney.qc of the decompiled model and added a new "body type" + additional lines referencing the new skins for this body type.

This seems to work fine, as Jed's HLMV is now showing me default Barney as body "subgroup 1", and "subgroup 2" is my custom skin. Two skins, one model...success!

I then created a custom .fgd for my mod, in which I added the option of choosing between "Default" Barney skin and my "Custom" one to the entity properties for Monster_Barney.

However, this last step doesn't work - the default skin is the only one shown, since the dialogue box has no way of knowing what it's actually referencing. I've tried looking up models with multiple skins like the Scientist but I've had no luck finding out how the .fgd actually knows what skin "Luther", "Slick" etc. refers to. do you connect your new Hammer dialogue boxes in the .fgd to your new model skins? I'm guessing I need to do a small amount of coding but I can't find which file to edit.

Any help appreciated with this - I will write a tutorial from step 1 if I can work it out with some help, I think it might help others.
I don't think that's strange to be fair. One reason that the Half-Life games are so popular is that Valve really nailed that strange sense of beauty that old abandoned industrial buildings have to them.

It's actually also one reason I fell in love with Portal originally. It wasn't the portal gun or the puzzles, it was the threatening and strange atmosphere of the Aperture Science labs.

Black Mesa evokes this sort of dated fifties decay and yet at the same time cutting edge sci-fi progress. The huge concrete silos and reactors are both impressive in their scale and use of technology and also starkly cold and run-down.

HL2's City 17 is a combination of classical European architecture and industrial decay, mixed with brutalistic alien tech. Again, neat.

Seeing these locales in real life to me evokes the same kind of feelings I had playing through those great games and it's kinda cool.
Posted 7 months ago2020-06-02 10:20:26 UTC
in Competition 39: The Buddy System Post #344353
Wow, I liked the other two entries. Played them this morning :)

Really nice brush work in your main room there Captain P, I almost thought it was Source when I went back into the maintenance halls. Kind of like the vibe you get in Stanley Parable and Portal. Though I got minor PTSD imagining the potential leaks and grid issues when doing the curved propeller wall and the curved line on the floor, lol.

Also liked the outdoor rocky levels Burnerman did. Neat cliffs and roof detailing! Bravo.
Posted 7 months ago2020-05-30 07:35:12 UTC
in Competition 39: The Buddy System Post #344327
Haha...thanks, yeah. Just triple checking. You know what the mind is like late in the evening... ;)
Posted 7 months ago2020-05-29 21:36:41 UTC
in Competition 39: The Buddy System Post #344320
Hey fellas, just to confirm, the close date is 23:59 on 1st June? As, the end of the 1st, not the beginning?

Busting my rump on this little project at the moment and I think it's going to be right down to the wire. I think it's going to be 3 maps in the end and right now I'm bashing through map 2 as fast as humanly possible without making it rubbish lol ;)

Obviously thought I'd check whether I have that "extra" day or not since it makes a big difference. If anything I think I may have to cut some ideas haha!

Cheers all. Hope your entries are going well, I look forward to playing them (while simultaneously praying my mini-mod format works).
Solved this! Couldn't delete the thread, so just posting the solution here in case it's helpful to anyone in the future.

Basically the issue was with massive amplification of minute amounts of background noise. This was fixed by altering my mic sensitivity (the drivers were missing, so this option wasn't there before).

Also there were problems with Audacity that were fixed with another update. On top of all that, it turns out that HL supports 22k Hz audio, whereas I previously thought it was only 11k. This made a big difference again and reduced the noise.

Finally I made liberal use of Noise Reduction inside Audacity to fix any remaining issues. Audio isn't perfect but it isn't bad.

Thanks all.
HL uses 8-bit PCM Mono tracks for dialogue. To this end I wanted to record some lines, but my God the distortion and noise I'm getting is nothing short of horrendous.

I can record a 16 bit Wav and there's no distortion at all, even at high volume. Then I use Audacity to convert it to 8 bit and it sounds like the microphone is being run over by a truck, you literally can't even hear my voice over distortion.

Then I tried directly recording an 8 bit file with a patched old version of Windows XP Sound Recorder. You can literally see the massive distortion spikes as I'm talking and the result is the same.

Any idea what is causing this? I can talk all day on modern VOIP or record 16 bit sound and it's crystal clear, but then 8 bit is just...awful :(

Any help appreciated, thank you guys.
Posted 8 months ago2020-05-25 18:55:24 UTC
in Competition 39: The Buddy System Post #344297
Think I've got everything sorted so it works with no overwriting. Pleased with this! Thanks for the help guys.

Also great that I now know how to package mods, exciting stuff :)
Posted 8 months ago2020-05-22 17:17:47 UTC
in Competition 39: The Buddy System Post #344275
Really excited for this. I only saw the competition was up yesterday so my entry might feel a bit rushed :(

Quick question regarding the rules; one of them was that no vanilla content must be overwritten.

If I submit as a mini-mod with some custom animations for certain stock HL characters and enemies, is that acceptable? Technically nothing is altered about the vanilla models on one's hard drive if it's done that way, as far as I know.

Posted 9 months ago2020-04-25 14:15:08 UTC
in Goldsrc Custom Animation Bug? Post #344142
Thank you for all the help! The animation is now finished and I'm pleased with the result :D

Finished animation

I'm going to stick with HD models, just need to re-do the Scientist animation, but I'm super happy I've got it to work.

Ty Solokiller!
Posted 9 months ago2020-04-25 06:43:45 UTC
in Goldsrc Custom Animation Bug? Post #344140
Hey Solokiller, thanks for the reply!

Animation video

There's a link to the animation in question, back when it was working fine with two monster_generic entities. I haven't changed anything with the animation names etc, and I pasted the names from the .qc into the Hammer box, so I know for sure I didn't type them out wrong.

EDIT - Okay, I found the problem! For some stupid reason I didn't think about HD and old models, and animated the old one thinking the bones would be the same as the HD model. They are not, so the game was screwing things up when importing the HD hgrunt model.

Is there a way of porting animations between the HD and low-res models? Or should mods just stick to one (the HD, presumably) when animating? It literally doubles workload to have to animate both HD and non-HD models for the mod.

Thanks again.
Posted 9 months ago2020-04-24 18:06:49 UTC
in Goldsrc Custom Animation Bug? Post #344138
Hey guys! I was a member of this site maybe 10 years ago and first of all, very happy to see it's still alive and active :)

I still map for HL1 and 2 and recently I've moved into animating with Blender. I'm working on a big map pack for HL 1 at the moment with lots of custom animations, but I'm running into some issues. Any help at all would be super appreciated!


Well, I made some new animations for the Scientist and HGrunt models. The Scientist ones work flawlessly and I've been very happy with them - to test them before replacing the original models, I used a monster_generic and linked to a Scientist model I renamed "MyScientist.mdl".

This all worked great. I then made some grunt animations. This worked great too, using monster_generic "MyGrunt.mdl".

Next I made the step of just renaming my model "hgrunt" and replacing the original hgrunt01, 02, etc. etc.

Well, this seems to have really messed things up. In Jed's Model Viewer, the new model is showing all the new animations as available and fine. However, trying to use a scripted_sequence with a hgrunt in Hammer just gives me "unknown scripted sequence" over and over.

In addition to this, the weirdest thing is that I can type "83" in the "Hammer Animation Sequence" field, the same number as for my custom animation, and *it plays completely fine*. WTF?

So my animation works great in Hammer, works great in Jed's Model Viewer, but Half-Life doesn't recognise it at all. Any clue what on Earth is causing this?

Cheers all :)