Forum posts

The source code of TFC is not available to the public and I heavily doubt Valve would agree to release it as they made crystal clear that they would stop doing so in response to the various leaks in the past years.

There are some TFC elements in the HL source code like the player and class selection panels and minor things but the rest such as weapons, game modes, player classes themselves and many more will have to be re-programmed by yourself.

As for Metamod, AFAIK, you will only be able to change existing stuff so forget about adding new stuff like classes.
Do I need access to the Source Code of Tfc (Which there is none available I think) To add something like New Classes though? Or is it where some Code is visible & you can edit?

How I was going to do it where the player would press "R" or something to change the Classes instead of adding new numbers, as that part could be locked? Idk. For "0" instead of a Random Class I was going to make it a Commander Class.

I was going to make the Keycard part where any class could pick it up & use it, I was going to add new colors as well.

Do you know of someone else who knows about Metamod I could ask this to? Could the Valve Modding Community Discord Server give me answers too?
New classes and weapons sounds like code territory. As far as I know we only have HL1, Op4 and BS code SDKs but none for TFC and I'm unsure what options we have there.
Perhaps something like Metamod could be used? I've never messed around with that sort of stuff myself so can't really tell how much it could help you here.

Doors and keycards (regardless of class) is vanilla goldsrc so that's definitely doable.
Making it class-specific, on the other hand, iirc the TFC entities only had logic for team-specificity so might need code work to get that.
PigFactory2003b by VooDooPig (http://web.archive.org/web/20031112152953/http://cariad.netfirms.com/twhl/mapvault_map.php?id=4)

Second after cs_canbunk, seems to of been in testing during that archived post.
I wanted to add new Classes to my Tfc Mod, Could I do that? Same goes with Weapons, and this idea where any class could pick up a Keycard to unlock a door.
As for Valve's approval, don't worry about that. I don't think they even acknowledge TFC anymore, and even if they did they'd just be positive about it as they've always been about mods*.

(*except for HDTF, but you can't really call that a mod, and besides we don't talk about that dumpster fire anyway)
TFC is still being played. It's not as popular as it used to be, but there's at least a couple communities still around with regular players.

I'm not sure if there's any game code available, and engine code is definitely off the table, but if all you want to do is add new maps then all that isn't needed. If you're not changing anything code-wise you can just use TFC as the base game (iirc you can put "fallback_dir" "tfc" in liblist.gam), but if custom maps is all you're planning on making you don't even need to make a mod for that. Just publish those maps on their own and anyone already owning TFC can play those without getting a separate game/mod for it!

The making of and publishing of custom TFC maps is over two decades old and I'm sure the remaining players (including me) would be very grateful to try out new maps 😊
But wait, would Valve not approve of me making a Tfc mod though? Or is it okay as long as I don't steal any of their code & make the game free to play? But am I required to "steal" code to make my mod work? Or could I just write my own Code but it does the same thing? Or should I just make my mod unique in general? I was going to add different maps to it.
Are people still even playing Team Fortress Classic? Because I might actually make a Tf2 mod instead if no one is going to even play the Mod, or are there people out there who would be interested?

ChatGPT was also telling me to look somewhere else for help after I started asking it more advanced Goldsrc questions, so I came here :glad:
Posted 1 year ago2023-10-09 23:00:02 UTC
in How to define gravity in source code? Post #347936
Thanks Admer! This worked!
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!
LLMs such as ChatGPT should only be used as entertaining novelties, not as actual sources of information.

They don't know anything, they don't provide any guaranteed correct information. All they're good for is making convincingly enough human-like text.
Strangely, ChatGPT was telling me that the Goldsrc Engine was written on a Programming Language called "Squirrel" so I accidentally assumed that you needed to know it instead of C++. Thanks for clarifying the confusion.
Posted 1 year 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 1 year 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!
Posted 1 year ago2023-10-09 11:54:54 UTC
in Half-Life Featureful SDK Post #347930
New release

Changelog

Configurable features

  • Wall puff sprites (cl_weapon_wallpuff) can be configured via featureful_server.cfg. Up to 4 sprites can defined (wall_puff1 - wall_puff4) which allows to set sprites from Counter Strike. By default sprites/stmbal1.spr is used as a sole wall puff sprite.

BugFixes

  • Fixed opfor ropes physics on high framerates.
  • Fixed spore launcher not playing a pet sound.
  • Fixed some HUD issues when player has both flashlight and NVG.
  • Fixed FG_CURE sentence group (a resource change)
  • Replaced fgrunt/checkin (a missing sound) with fgrunt/check in sentences.txt (a resource change).

Entities

  • Each global variable has one integer number associated with them, in addition to the state value. The number can be changed via game_counter_set targeting env_global with Modify/Set value triggermode. Also, triggering such env_global with 'On' or 'Toggle' use-type increments the global variable number by 1. Triggering it with 'Off' use-type decrements the number by 1.
  • New parameter Obey Use-type for env_global which allows to change the global variable state accordingly to the input use-type.
  • New spawnflag Act as Master for env_global which allows to use the global variable state as a master.
  • New entity trigger_compare for comparing constant numbers and numbers associated with entities (so called Locus Ratio) and triggering different targets depending on the result of comparison.
  • New entity calc_state to evaluate the state from boolean operation where the 'On' state corresponds to True and 'Off' state corresponds to False. Can be used as a master.
  • Copy Input and Reverse Input trigger modes for trigger_relay.
  • New entity calc_eval_number to evaluate the math expression based on constant numbers and calc ratios of entities.
  • New entity game_number for storing floating point numbers (you can still use game_counter to store and retrieve integer values). Can be used as a storage or parameter of calc_eval_number.
  • New entity trigger_check_state to check the master entity state and trigger the target depending on the check result.
  • Customizable smoke sprite for env_explosion.
  • monster_human_assassin_dead.
  • Barnacles can't grab victims possessed by non-interruptible scripts anymore.

Server commands

  • set_global_state - set the state of global variable. Available only when sv_cheats is enabled.
  • set_global_value - set the number value associated with global variables. Available only when sv_cheats is enabled.
  • ReportAIState (impulse 103) now reports the name of the scripted sequence entity if monster is currently possessed by a script. The command also draws the current monster route and the nearest node using temporary beams.
  • calc_ratio - calculate a ratio values associated with entity and report the result to developer console.
  • calc_state - calculate/get the entity state and report the result to developer console.

Other

  • Support for snow texture material.
  • Added item_sodacan to FGD.
New pages on wiki: Math and Master entities.
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!
Would this help me Mod Tfc? It's a Playlist of how to program in the Half Life SDK.
Posted 1 year ago2023-10-08 10:44:08 UTC
in Changing HUD element positioning? Post #347927
Hey all. I've been trying to change the X and Y coordinates of various parts of the HUD for a bit, both the numbers and icons, but I'm a bit lost on where exactly I could find the code for this, as I'm not seeing it anywhere in hud.cpp or battery.cpp.
I've modified the height and width of the icons via the hud.txt file, but I'm looking to change the position of which they actually show up on screen.
Posted 1 year ago2023-10-08 09:26:43 UTC
in How to define gravity in source code? Post #347926
Hey thank you for the detailed response, and sorry for coming back to you so late!

I've tried a number of things but somehow can't get it to work. I have to add that I am not a professional (c++) programmer, my understanding is quite basic.
I think you are correct in that the best way is to do it in CWorld::Spawn as that is where the global sv_gravity value is assigned. However I am unsure how to, so to speak, change this value with an rng if it's in quotation marks (as it will literally paste my code as text as the value for sv_gravity). What would be the logical approach to do this?
Posted 1 year ago2023-10-05 14:44:49 UTC
in Problem with zombie soldier Post #347925
Oh

seems like I missed game.cpp

Thanks for telling me

ill check if it works

Edit: it works , thank you everyone that helped and you guys are best
Scientistbeta ScientistbetaIt lives!
Posted 1 year ago2023-10-05 14:36:23 UTC
in Problem with zombie soldier Post #347924
Posted 1 year ago2023-10-05 13:14:21 UTC
in Problem with zombie soldier Post #347923
Tried using code blocks

says that "may not be greater than 10000"

But i set link to "anyone with the link"

so check the link works

link

If it does not work please tell me again
Scientistbeta ScientistbetaIt lives!
Posted 1 year ago2023-10-05 13:04:51 UTC
in Problem with zombie soldier Post #347922
The link is inaccessible because you need to share access.

Just post the code directly using code blocks.
Posted 1 year ago2023-10-05 11:37:30 UTC
in Problem with zombie soldier Post #347921
link

if the link does not work please tell me.
Scientistbeta ScientistbetaIt lives!
Posted 1 year ago2023-10-05 07:27:29 UTC
in Problem with zombie soldier Post #347920
Show all of the code you've written and modified to implement this NPC.
Posted 1 year ago2023-10-05 04:29:32 UTC
in Problem with zombie soldier Post #347919
The values are not zero at all

/ Zombie Soldier
sk_zombie_soldier_health1 "60"
sk_zombie_soldier_health2 "60"
sk_zombie_soldier_health3 "120"

sk_zombie_soldier_dmg_one_slash1 "10"
sk_zombie_soldier_dmg_one_slash2 "20"
sk_zombie_soldier_dmg_one_slash3 "20"

sk_zombie_soldier_dmg_both_slash1 "25"
sk_zombie_soldier_dmg_both_slash2 "40"
sk_zombie_soldier_dmg_both_slash3 "40"
Scientistbeta ScientistbetaIt lives!
Posted 1 year ago2023-10-04 21:51:07 UTC
in Problem with zombie soldier Post #347918
Do your cvars have a valid value? Like
sk_zombie_soldier_dmg_both_slash1 "30"
It will not work if the value is 0.
Posted 1 year ago2023-10-04 16:37:24 UTC
in Problem with zombie soldier Post #347917
Oh ok

Thanks for the help

and also sorry for the broken image code (since am new to this)
thank you for fixing it again
Scientistbeta ScientistbetaIt lives!
Posted 1 year ago2023-10-04 15:01:31 UTC
in Problem with zombie soldier Post #347916
I'm afraid I don't know in that case. This is beyond my skill set.
monster_urby monster_urbyGoldsourcerer
在3D游戏世界里,在短期时间内,你可以通过移动你的视角来获取更多信息。如果不使用特定摄像机的话,如何让玩家接收到一个完整的故事?编剧和关卡设计师的工作应当如何分配?
In the 3D game world, in the short term, you can get more information by moving your point of view. How can the player receive a full story without using a specific camera? How should the work of writers and level designers be divided?
Lei Shi Lei ShiFRS石磊
Posted 1 year ago2023-10-04 03:53:53 UTC
in Problem with zombie soldier Post #347914
I modify the skill.cfg then i got this console message
User posted image
And still didn't work

Fixed image code again... - Urby
Scientistbeta ScientistbetaIt lives!
Posted 1 year 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 1 year ago2023-10-03 18:00:09 UTC
in Problem with zombie soldier Post #347912
I would assume you've modded the zombie soldier into the base Half-Life game, so I would expect you would need to add those zombie soldier values to your skill.cfg file
monster_urby monster_urbyGoldsourcerer
Posted 1 year ago2023-10-03 17:20:07 UTC
in How to define gravity in source code? Post #347911
Hi!

I'm working on a randomizer for Half-Life 1, and I was wondering where in the source code the gravity is defined? I know it's ultimately defined with a console command (sv_gravity), but is it possible to overwrite this in the source code with my own value instead? I already know how to do the randomizing part.

(Simply said, I am looking to replace something like Gravity = sv_gravity's value with Gravity = myvalue

Hope that makes sense. Thanks in advance!
Posted 1 year ago2023-10-03 03:24:25 UTC
in Problem with zombie soldier Post #347908
i have both skill.cfg and skillopfor.cfg

should i have only one?

or modify skill.cfg to have it
Scientistbeta ScientistbetaIt lives!
Posted 1 year ago2023-10-02 19:36:32 UTC
in Getting xen_plantlight's sprite to appear Post #347907
Ah, so it was a bug after all! Maybe it's time I tried using the Updated SDK... I just found out about this issue, if the problem is related to that then Updated should have fixed it. I'll try to finish my map(s) first though.

EDIT: For the record, I revisited the c4a1 portal room, and there they are - I remember now that I did these sprites in game before, I even looked for them in the map source, and thought it was weird when I couldn't find them...
About 5 plantlight sprites crowded in the same spotAbout 5 plantlight sprites crowded in the same spot
And, as it turns out, the spot they appear in is the world origin, or next to it.
scientist/asexpected.wavscientist/asexpected.wav
The oddest thing is how this bug seems to not place the sprites exactly at the origin. In my map the plantlight sprite isn't there (probably at a random out-of-bounds location next to it instead), but random sparks do appear at the exact spot sometimes. Well, at least it's fixed in Updated.
That entity in the skybox block was nicely spotted, I guess I'm not eagle-eyed enough yet. I deleted it, and switched to J.A.C.K., which more verbosely claimed that there's a headcrab way off the grid... I deleted the original map, copy-pasting the actual stuff inside the grid into a new one, and now J.A.C.K. doesn't complain at all. This must be what you get when the software you use is old enough to marry and drink alcohol in most jurisdictions. Thanks for the advice, Mota!
Your skybox is TOO THICC! Sky IS actually water for the engine, with special (no) drawing properties. So, don't use more than 16u thick.
PS: Always use grid! Avoid "carve" and "make hollow" tools.
PS2: get other people's map sources and you'll learn a lot faster.
Posted 1 year ago2023-10-02 18:44:40 UTC
in Getting xen_plantlight's sprite to appear Post #347904
What a coincidence! I was trying to fix this bug in XDM for hours, only to realize it was a HL bug!
You may notice that inside the portal room one of the plant's glow shows up near the butterfly cage and toggles on/off accordingly. I tried lots of tricks, traced the s2c code, tried fixing client code, but nothing worked! Mainly due to lack of time I had to abandon that. So, in conclusion, it's not a trivial fix. IMHO.
Oh, another thing - see if there's a .pts file in your compile directory. Maybe Hammer did generate the pointfile, but didn't load it automatically. You can load it manually through the Map menu.
Right hereRight here
I should mention I used the J.A.C.K. editor instead of Hammer. I don't think it makes a difference in this case, but still...
Posted 1 year ago2023-10-02 18:15:03 UTC
in Problem with zombie soldier Post #347902
Have you checked if you added the zs to your skill.cfg?
These linesThese lines
I think I found the culprit:
This entity is out of bounds!This entity is out of bounds!
Another thing: don't surround your map with a box, this will make it much more expensive to compile and run. The parts of the map outside the playable area are supposed to be culled by the compile process, and that won't happen if you put it in a box. The right way to solve leaks is to find them and fix them locally, so only put the sky brushes (or any sealing brushes, really) where they are needed.
Like this, for exampleLike this, for example
So, my map is leaking, and I don't know why. I have a skybox (not hollow, but that didn't work either) with nothing intersecting it, and for some reason the game treats it as water. (Quite the "leak"!) Brushes with other textures work normally after I place them. Maybe I've just missed something, or maybe the version of Hammer that I'm using for Half-Life 1 is just bad. (Version 3.4, build 1983) I'd be grateful if anyone finds the reason for the leak!

Edit: I forgot to give full downloading permission to everyone who views the Drive document, it's now fixed. I also forgot to mention that Hammer doesn't compile the pointfile.
Posted 1 year ago2023-10-02 15:06:46 UTC
in Problem with zombie soldier Post #347899
I coded the zombie soldier. But for some reason It does not damage me and the other npcs , but the ai works fine.
ZS.gifZS.gif
and the npcs ignore the zombie soldier

Fixed image code - Urby
Scientistbeta ScientistbetaIt lives!
Posted 1 year ago2023-10-01 22:24:58 UTC
in Getting xen_plantlight's sprite to appear Post #347898
You know that little glow sprite at the end of a xen light stalk? From what I gather, it's supposed to appear when you set its tranparency and color in a xen_plantlight's FX Amount and FX Color render attributes. So I did that, but the sprite didn't show up.
I looked into the map sources for the Xen chapters and couldn't find any difference between valve's plantlights and mine. Then I visited the stalks in-game and found something odd - most of the stalks have their sprites as expected but some do not.
*c4a1* - The nearest one on the ceiling is missing its spritec4a1 - The nearest one on the ceiling is missing its sprite
*c4a1* - Same plants, reverse anglec4a1 - Same plants, reverse angle
*c4a1b* - All stalks in this map have sprites except for the ones near the exit teleporterc4a1b - All stalks in this map have sprites except for the ones near the exit teleporter
I made a test map to see what could cause the sprite to disappear (apart from setting FX amount to 0) but came up empty. Neither rotation nor distance from map origin seem to affect it. What am I missing? Is this a known bug?
Posted 1 year 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!
Posted 1 year ago2023-09-30 18:10:49 UTC
in Is it possible to decrease player's width? Post #347896
That's bounding boxes that you're thinking of, not hulls.
Posted 1 year ago2023-09-30 15:39:25 UTC
in Using AI to create textures Post #347895
Hey. Nice method. Thanks for sharing. :biggrin:
Posted 1 year ago2023-09-30 14:20:34 UTC
in Is GoldSource still cool Post #347894
goldsrc is forever. i'm looking for people to help me rebuild some duke nukem 3d maps