Forum posts

Posted 1 week ago2024-04-17 18:31:19 UTC
in Game crashes when using impulse 101 Post #348722
Or remove the line that gives the MP5 grenades to the player.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 months ago2024-02-06 17:40:23 UTC
in Assertion Error in jack editor Post #348563
Could you provide a screenshot of the error?
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 months ago2024-02-06 14:14:49 UTC
in Wiki enhancment thread Post #348561
TrenchBroom stuff is in my plans. Hammertime will be interesting to see.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 months ago2024-02-04 15:52:54 UTC
in Issue with modding particular sequences Post #348547
That's quite odd. I don't suppose there are any cue points or anything in there, GoldSRC tends to be very picky about those.
This will need some testing in an isolated map t.b.h.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 months ago2024-02-03 20:29:32 UTC
in Issue with modding particular sequences Post #348540
If I recall correctly, voicelines should be up to 11 kHz, mono, unsigned 8-bit PCM, so that the engine can perform crude lip sync.
Other sounds (ambience, gunshots etc.) can be up to 22 kHz, mono, unsigned 16-bit PCM.

Oh by the way, for future reference, technical questions go here:
https://twhl.info/forum/view/goldsource
The "Maps and Mods" category is more for showing off map/mod projects... not that it has been enforced much lately x3
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 months ago2024-02-02 13:32:07 UTC
in Forum dead? Post #348521
Upload to the TWHL Vault and then everybody can rip it apart!
Admer456 Admer456If it ain't broken, don't fox it!
Posted 3 months ago2024-01-16 22:17:31 UTC
in Programming video tutorials Post #348451
It's that time of the year again.
Hitscan weapons
Admer456 Admer456If it ain't broken, don't fox it!
Probably means flickering.
Admer456 Admer456If it ain't broken, don't fox it!
New tutorials are always appreciated, so much so we have a special place for them: the TWHL wiki
Admer456 Admer456If it ain't broken, don't fox it!
Hello!
You should definitely look into CGameRules and the code around it.

The class: https://github.com/SamVanheer/halflife-updated/blob/master/dlls/gamerules.h#L61
HL deathmatch gamemode: https://github.com/SamVanheer/halflife-updated/blob/master/dlls/gamerules.h#L260
Gamemode factory: https://github.com/SamVanheer/halflife-updated/blob/master/dlls/gamerules.cpp#L371

You can basically select your different scenarios in InstallGameRules (assuming they'd be implemented as gamerules) instead of mangling with different DLLs. The latter could be pretty messy.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 5 months ago2023-11-15 00:55:56 UTC
in Wiki enhancment thread Post #348042
I'm down for writing a number of beginner tutorials. I could allocate some time to write them all by New Year, just need a bit of a plan first.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 5 months ago2023-11-09 22:02:08 UTC
in trigger_changelevel @ c1a1d Post #348010
You get to the next map via an elevator I think? This is just before Office Complex yeah.

What ends up happening is you're going between 2 maps that depict basically the same area, you just kinda do a "U-turn" in terms of levelchanges to get to the other side of the (destroyed) bridge in map 1.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 5 months ago2023-11-09 22:00:10 UTC
in Draw numbers in HUD Post #348009
You mention a new ammo counter for a specific weapon. That'd require keeping track of a tertiary ammo source, which would require changes to some of the prediction code too.

Can you show your code? I just realised this thread is 2 months old, I've no idea how I managed to miss it...
Admer456 Admer456If it ain't broken, don't fox it!
Yeah, I would advise against using ChatGPT for GoldSRC-related stuff, because there isn't much information about it. It has worked okay for doing my brother's Bosnian homework (writing little poems etc.), but I'd definitely not use it for this.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 6 months ago2023-10-09 16:59:33 UTC
in How to define gravity in source code? Post #347932
You can just use CVAR_SET_FLOAT:
// Gravity will vary +/- 400
#define GRAVITY_VARIATION 400

int myRandomGravity = 800 + rand() % GRAVITY_VARIATION;

CVAR_SET_FLOAT( "sv_gravity", myRandomGravity );
But of course, there are ways to convert numbers into strings (the values in quotation marks are called "strings").
Admer456 Admer456If it ain't broken, don't fox it!
Posted 6 months ago2023-10-09 16:53:56 UTC
in Changing HUD element positioning? Post #347931
Files like health.cpp, battery.cpp etc. implement their own HUD elements with exact coordinates in them.

I'll give you a bit of a detailed explanation so you mechanically know what's going on, if that makes sense.
For example, battery.cpp starts with:
//
// battery.cpp
//
// implementation of CHudBattery class
//
Implementation of CHudBattery huh... what's that?
It is defined in hud.h:
class CHudBattery : public CHudBase
{
public:
    bool Init() override;
    bool VidInit() override;
    bool Draw(float flTime) override;
    bool MsgFunc_Battery(const char* pszName, int iSize, void* pbuf);

private:
    HSPRITE m_hSprite1;
    HSPRITE m_hSprite2;
    Rect* m_prc1;
    Rect* m_prc2;
    int m_iBat;
    int m_iBatMax;
    float m_fFade;
    int m_iHeight; // width of the battery innards
};
Each of these HUD elements are C++ classes, which inherit from CHudBase. The HUD system contains a collection of these CHudBase based objects.

Now, here's the thing. When the HUD wants to actually draw itself onto the screen, it visits each of these elements and asks them to render themselves. This is what the Draw functions are for. If you want to find what coordinates are used, you would simply find, for instance, CHudBattery::Draw, like so:
bool CHudBattery::Draw(float flTime)
{
    if ((gHUD.m_iHideHUDDisplay & HIDEHUD_HEALTH) != 0)
        return true;

    int r, g, b, x, y, a;
    Rect rc;

    rc = *m_prc2;
    rc.top += m_iHeight * ((float)(100 - (V_min(100, m_iBat))) * 0.01); // battery can go from 0 to 100 so * 0.01 goes from 0 to 1
    UnpackRGB(r, g, b, RGB_YELLOWISH);

    if (!gHUD.HasSuit())
        return true;
... // rest of the code
Scrolling down in the same function, we see this code:
y = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2;
x = ScreenWidth / 4;

// make sure we have the right sprite handles
if (0 == m_hSprite1)
    m_hSprite1 = gHUD.GetSprite(gHUD.GetSpriteIndex("suit_empty"));
if (0 == m_hSprite2)
    m_hSprite2 = gHUD.GetSprite(gHUD.GetSpriteIndex("suit_full"));


SPR_Set(m_hSprite1, r, g, b);
SPR_DrawAdditive(0, x, y - iOffset, m_prc1);

if (rc.bottom > rc.top)
{
    SPR_Set(m_hSprite2, r, g, b);
    SPR_DrawAdditive(0, x, y - iOffset + (rc.top - m_prc2->top), &rc);
}
This says "Hey GoldSRC, please render a sprite at these coordinates here". SPR_Set tells the engine to use a certain sprite, and SPR_DrawAdditive tells the engine to draw it. So, now you might be wondering what's up with these x and y variable things. You can declare your own temporary variables to essentially "chain" HUD elements one after another, so you don't have to manually specify every single coordinate yourself. You can use it to say "the next one will be 5 pixels more" etc.

Now if you actually know C++ and stuff, woops! I tend to assume people don't know, and this may be useful to people in the future anyway, so yeah.

So, generally, it boils down to maths. You just gotta read the code really well to see where the coordinates are defined, and you'll be fine. You can change it to whatever you want, whether it's moving something from the bottom-left corner into a top-right corner, or make them bounce up'n'down through time and anything you can imagine.
Admer456 Admer456If it ain't broken, don't fox it!
It teaches you about programming map entities, weapons and such. It will help you if you know C++ programming fairly well from the start.
You can also check out programming tutorials here on TWHL.

Also hi, I made that :walter:
Admer456 Admer456If it ain't broken, don't fox it!
Posted 6 months ago2023-10-03 18:14:14 UTC
in How to define gravity in source code? Post #347913
In the latest HL Updated SDK, some places in the game code use the gravity CVar for certain things:
User posted image
Other than that:
  • HUD_TempEntUpdate has a cl_gravity parameter,
  • pmove_t has a gravity member,
  • CWorld::Spawn sets the value of sv_gravity
Definitely do a keyword search for "gravity" across the entire codebase, you'll find all possible references to it there. For a randomiser, I believe it may be the best to do it in CWorld::Spawn if each level is essentially randomised.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 6 months ago2023-09-30 19:11:18 UTC
in Is it possible to decrease player's width? Post #347897
Even then, the player hull is kinda hardcoded in the engine's physics code.
Admer456 Admer456If it ain't broken, don't fox it!
Oh I remember ya from the ModDB article about making realistic, atmospheric scenes. This is lookin' pretty good!
Admer456 Admer456If it ain't broken, don't fox it!
Posted 7 months ago2023-08-31 11:05:13 UTC
in HL1 MMod - Adding Weapons / Monsters - SDK Post #347813
Oh, thank MrFloyd for that, I was just doing some programming there x)
Admer456 Admer456If it ain't broken, don't fox it!
Posted 7 months ago2023-08-30 22:02:31 UTC
in HL1 MMod - Adding Weapons / Monsters - SDK Post #347809
If you want to add new weapons & monsters, you absolutely need code access. If HL1 MMod isn't source-available, you are out of luck. Base HL SDK / HL Updated SDK doesn't have any of the additions MMod has.

BTW Half-Life SDK, not exactly Source SDK~
Admer456 Admer456If it ain't broken, don't fox it!
Posted 7 months ago2023-08-29 11:37:42 UTC
in Post Your Desktops Post #347803
You mean:
Use le img tagUse le img tag
Also yeah that is quite unusual.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 7 months ago2023-08-28 13:33:51 UTC
in Train with doors and windows Post #347800
You can do it only with a custom mod that has a veeery proper implementation of movewith / parenting (not Spirit of HL). I wrote a couple entities that specialise in that for HL:WAR. If not a programmer, consider the above solution.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 8 months ago2023-08-13 16:30:02 UTC
in Programming video tutorials Post #347770
After what felt like thirty years, here it finally is:
Creating new weapons
A bit rushed, and has a little audio bug somewhere around the 10th minute... d'oh well, mistakes are made. I'll have to see if new versions of DaVinci Resolve have this audio problem.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 8 months ago2023-08-03 23:08:21 UTC
in ACT_ definitions in the source code Post #347754
I'm not sure if it can actually move by itself, I'll have to take a look at the code tomorrow.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 8 months ago2023-08-03 12:44:24 UTC
in ACT_ definitions in the source code Post #347752
Well, that depends entirely on the animations themselves. You can inspect them in Blender and roughly see how far they go, I think.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 8 months ago2023-08-02 12:23:11 UTC
in Limited Save System?? Post #347746
You may begin by editing the VGUI resource files to e.g. remove the save button. You may also unbind the keys for that stuff.
But ultimately players could just type save into the console and work around it, it's an engine-side console command. I'm not sure how to work around that, probably some very ugly hack.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 8 months ago2023-08-02 11:48:25 UTC
in ACT_ definitions in the source code Post #347745
You can do a file search for ACT_ in HL SDK.
Firstly in dlls/activity.h you have all the activity IDs defined:
User posted image
Further, elsewhere you will find given situations or events where animations are looked up by activity:
User posted image
So for example, when the grunt does a "victory dance" i.e. enemy is dead, it looks for an animation with the ACT_CROUCH activity. And then more of them later.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 9 months ago2023-07-23 22:32:45 UTC
in verticalx3 Post #347725
It looks nice, you should upload it to our very own Map Vault!
https://twhl.info/vault
Admer456 Admer456If it ain't broken, don't fox it!
Posted 9 months ago2023-07-18 21:44:40 UTC
in Source code of GameUi.dll Post #347720
You cannot get that in GoldSRC. The main menu is not customisable in regards to functionality. I think the best you can do is edit one of the resource files and add a button that executes your desired console command.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 9 months ago2023-07-17 10:16:45 UTC
in HOW THE HECK do I link a CPP file to an FGD file? Post #347715
I'd also discourage using all uppercase in forum posts. People will be less likely to help you if you're perceived as an angry screaming person.
I'd also recommend you to not google when it comes to HL1. It's just useless.

LINK_ENTITY_TO_CLASS( Cus_Char, charizard ); would link it to a "Cus_Char" in the FGD, whilst expecting a "charizard" C++ class.
You want it to be LINK_ENTITY_TO_CLASS( monster_charizard, Charizard ); as Erty said.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 9 months ago2023-07-03 09:59:51 UTC
in Is GoldSource still cool Post #347682
I'd argue GoldSRC is cooler than ever now, with modern community-made tools and people doing super cool things with it. So no, definitely not late.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 11 months ago2023-05-20 21:39:36 UTC
in I need help finding dlls Post #347528
Do you have the Half-Life SDK code? (not the tools from the SDK, but rather the C++ source code, as well as an installation of Visual Studio)

https://github.com/SamVanheer/halflife-updated
Admer456 Admer456If it ain't broken, don't fox it!
Posted 11 months ago2023-05-14 21:26:09 UTC
in HUD position Post #347514
hl_cdll, yeah.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 11 months ago2023-05-14 18:36:43 UTC
in HUD position Post #347512
Which ones would you like to change? Generally you would go to an appropriate HUD element's .cpp file and change the coordinates, e.g. health.cpp for the health display.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 11 months ago2023-05-10 17:50:43 UTC
in func_tracktrain sound Post #347506
The game code overrides sounds of func_train (and similar moving entities like doors) when they spawn. In case you leave the sound keyvalues empty, it'll just default to sound/common/null.wav. So, ambient_generic is your only option.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 11 months ago2023-05-02 22:27:01 UTC
in Programming video tutorials Post #347495
Weapons, at last.
Weapons
Admer456 Admer456If it ain't broken, don't fox it!
Posted 11 months ago2023-04-30 11:33:37 UTC
in Ambient_generic Post #347489
That's a pretty cool map, you should also upload it to TWHL's own Map Vault!
Admer456 Admer456If it ain't broken, don't fox it!
If the "platform war" idea was true, they wouldn't have pulled anything off of GoG while EGS simultaneously hosts GoG Galaxy.
From what I've been told, old Unreal games got pulled because of a lawsuit against Epic, about in-game child protection because Fortnite was 1) designed to get kids hooked on spending money on the game 2) no (or not enough) parental controls. Someone big sued them over that and they kinda had to comply.

This affected all of Epic's games. Unreal and others, not having any parental controls whatsoever, had to get delisted cuz' Epic just didn't wanna bother adding those to their ancient games. Unreal is gone from GoG, I cannot find it there any more. Seriously.

This likely won't happen to Half-Life, because of the nature of the lawsuit against Epic (it was ultimately about children being encouraged to gamble), and Epic being cheap. Now I know Valve is cheap too, and they've had their fair share of lawsuits before, but something of this kind just ain't happening any time soon.

If it does happen though, we might see Xash being used a lot more, and that's going to be very damn interesting.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 1 year ago2023-04-17 19:49:32 UTC
in Ambient_generic Post #347458
If light_surface has no name (cannot be triggered) and doesn't have an Appearance/Custom Appearance, it should not take up any edicts whatsoever.

I think you can check entities in-game with the entities command. It'll report like this:
User posted image
Here you can see there's 452 entities in c2a1.bsp.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 1 year ago2023-04-15 21:24:01 UTC
in Ambient_generic Post #347456
Yes. Each monster is an edict of its own.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 1 year ago2023-04-15 19:54:54 UTC
in Ambient_generic Post #347454
Decals, sparks, shells, muzzle flashes etc. are separate from edicts. They're a clientside concept literally called "temporary entities" (tempents), and they have their own limitation, I'm not sure what, but you can safely assume at least 512.

env_spark emits sparks, and is itself an entity. But the sparks it emits are tempents, so those don't count.
env_explosion indeed creates an explosion which consists of multiple things (explosion sprite, explosion smoke, sparks, decals etc.), but only that one env_explosion counts, cuz' the rest are on the client.

The only exception I think is the gib shooter entity, because gibs it throws are indeed serverside entities, weirdly enough. If you launch 100 gibs, you're wasting 100 edicts. Gibs thrown by func_breakable and others though, don't count, they're tempents.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 1 year ago2023-04-15 12:55:14 UTC
in Ambient_generic Post #347452
The game has to be launched with -num_edicts 2048 regardless of Steam or WON, so yeah, the server has to do it. Otherwise you're limited to a total of 900 entities, regardless of if they're brush or point entities.

However, I'd rather say it's a little lower than that. Worldspawn is 1 entity, there's up to 16 players (so 16 entities), there may potentially be weapon drops by the players (count another 20 entities potentially), so you're left with about 850 in a practical scenario.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 1 year ago2023-04-15 10:48:21 UTC
in Wiki enhancment thread Post #347450
Oh snap, it's been a while. This month I'm planning to write a couple articles regarding TrenchBroom:
  • Setting up TrenchBroom
  • TrenchBroom Half-Life support report
One is to address the problem newcomers face when trying to set up Half-Life with TrenchBroom. J.A.C.K. provides an automatic game configuration for Half-Life when you give it the HL executable path, with various built-in compile configs too.

In the other, I'll be defining what it exactly means to "support Half-Life", i.e. what features or mechanisms an editor needs to have. I've also been thinking of alternatives for this one: "Transitioning from J.A.C.K. to TrenchBroom", "Differences between J.A.C.K. and TrenchBroom", "Hammer vs. J.A.C.K. vs. TrenchBroom". Some may want a unified list of all relevant map editors to be compared, I'd like to focus on just two-three main players in the community.

Next month, I'd be looking to take care of some "review required" pages (or maybe even this month) and renew some guides. I'd like to rewrite "In the beginning" in a modern context, using J.A.C.K. and VHLT,
Admer456 Admer456If it ain't broken, don't fox it!
Posted 1 year ago2023-04-15 09:51:15 UTC
in Ambient_generic Post #347449
The maximum number of all entities together depends on the number of edicts, which is 900 by default in Half-Life. However with the -num_edicts parameter you can bump it up to 2048.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 1 year ago2023-03-15 02:14:06 UTC
in Any coders out there? Post #347394
The latest Visual Studio works just fine, no need for 2015.

That being said, it is very rare to catch programmers in the wild for HL1 these days, most either have a project of their own, or they're in some team, working on some project. You may have to look around a lot, or learn to do some things yourself.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 1 year ago2023-03-14 18:30:48 UTC
in Any coders out there? Post #347389
Ooh, now we're talking!

Just for the record, you can't "edit" DLL files, they are compiled binary blobs just like MDL and BSP. You gotta obtain the source code that these DLLs result in compiling.

You can use Solokiller's HL OpFor SDK: https://github.com/SamVanheer/halflife-op4-updated

Hostile Barneys can be a copy-pasted Barney with a single line of code changed, or you can add a map property to monster_barney (or to all NPCs) to make them change their classification (friend vs. foe).

DMC/Quake-style ammo is really just looking at the Tau cannon or gluon gun code, they have no reloading just like in Quake. Identify which parts of the code are responsible for that, and apply them to your weapon(s).

Red HUD colour is easy, simply change the hex colour value here: https://github.com/SamVanheer/halflife-op4-updated/blob/236e77682f1a2c147eab794b47880329e50b5011/dlls/cdll_dll.h#L204
Here are some example values: https://github.com/SamVanheer/halflife-op4-updated/blob/236e77682f1a2c147eab794b47880329e50b5011/cl_dll/hud.h#L25-L27
0x00FF0000 is pure red (255,0,0) and so on.

As for scientists that cower away from you, I think it is possible to alter their classification table so that they're always afraid of the player, i.e. treat the player as an alien. There's a whole classification mechanism in Half-Life's AI system where some NPCs see other NPCs as predators, or prey, or they mean nothing to them, and so on.

I'm not sure about boss fights, because that can mean literally anything. For all I know, I could be fighting a worm in a goldfish container (reference to sc_toonrun). You can set those up as a combination of a sequence of triggers and stuff, plus a special entity that sends fireballs at you (doesn't even have to be an NPC depending on what kinda boss it is), but of course, that will require knowing entity programming.

If you have questions (which you probably certainly do), feel free to ask. Are you looking for a programmer to do this for you, or do you wanna try and learn how to?
Admer456 Admer456If it ain't broken, don't fox it!
Posted 1 year ago2023-03-14 10:54:36 UTC
in Any coders out there? Post #347385
Can you provide (a lot) more info? Nobody's gonna help if they don't know what the problem is.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 1 year ago2023-03-11 16:07:32 UTC
in Checkerboard overlay on textures in Hammer Post #347382
From my limited experience with Source, this appears to be normal. I don't know of any fixes or workarounds.
Admer456 Admer456If it ain't broken, don't fox it!