Trying to spawn an item from another game. Created 1 year ago2023-12-17 02:30:30 UTC by SirCobalt SirCobalt

Created 1 year ago2023-12-17 02:30:30 UTC by SirCobalt SirCobalt

Posted 1 year ago2023-12-17 02:30:30 UTC Post #348250
I'm using an edited FGD file that allows me to add guard helmets and armour vests to my maps. The problem is, is that they won't spawn. Even putting them in an empty room totally unobstructed will not yield the desired result. I'm not an expert but what I did basically was add the lines at the bottom of the blue shift FGD to my own FGD which itself is copied from the original half life FGD. Is there something I'm missing? Please for the love of god don't tell me I have to go into the main game files, the ones labelled dll and stuff. Thanks in advance for any help you can provide, my mod depends on this feature being available and fully functioning.
Posted 1 year ago2023-12-17 04:48:09 UTC Post #348251
FGDs are just the restaurant menus. If you use BK's menu's at a Wendy's the cooks at Wendy's wouldn't know what a Triple Whopper is nor how to make them.

You need to add code for the actual entities themselves into your mod's codebase for your mod to start recognizing a Triple Whopper order.
Posted 1 year ago2023-12-17 12:36:53 UTC Post #348253
Okay that makes sense. But how? And what code do I add? If I end up doing something mega stupid please don't be harsh because I'm not a programmer. If it helps I have access to the means to do it, I think. I followed a tutorial a while back but I'm still clueless.
Posted 1 year ago2023-12-17 13:24:56 UTC Post #348254
The process of adding new entities requires editing the game code, we have guide for it here.

It's a bit more complicated process than adding them to the FGD, and you will need to compile those changes into the DLLs your mod will use (the guide does a great job at walking you through this).
In your case it'd be mostly be copying or inheriting from the CItemBattery class in items.cpp.

You can also check out Solokiller's Unified SDK which has Blue Shift (which has those entities in it) merged in with it. Just be aware it's still a work-in-progress project.
Posted 1 year ago2023-12-17 15:51:37 UTC Post #348255
Oh ok. I downloaded one of those projects ages ago for my mod, I can't remember which. I followed that tutorial to make it print hello world into the console. I'll try and figure it out and come back later with the result.
Posted 1 year ago2023-12-17 16:52:46 UTC Post #348256
So I tried removing the line that prints hello world into the console every time I load a map that I added ages ago so I can test if this whole endeavour will even work at all. For some reason, even after building it and replacing the old files in my mod folder, it still prints hello world, supposedly using some invisible code that I clearly don't know about. I decided to ignore it and download the unified SDK you recommended and I found some code that pertains to a "helmet" in the items.cpp file of that SDK, it's structured similarly to the code that adds the suit battery into the game but missing a few things and it could be unfinished. I'm wondering if all I have to do is just copy that code into the items.cpp of the project I'm using and that will be it, but I sincerely doubt that.

There's also something else, I went back to that tutorial and there's a part there that I don't really remember doing. It tells you to change the platform toolset to another version. The projects I had downloaded were using a different version to what was mentioned in the tutorial so when I tried changing it for each project, a lot of the code was made non functional and there were red and yellow blocks on each line which I assume is bad. Building the whole thing printed errors into the console so I decided to switch back to the platform toolset I was using before. It would really help if I could get some extra clarification on all this.
Posted 1 year ago2023-12-17 20:29:46 UTC Post #348257
For the toolset read this section. The project is in a different version, hence the need to follow that section to set the correct version.
Note that you have to use Visual Studio 2019 or 2022 and use the Visual Studio Installer to install the required components.
Posted 1 year ago2023-12-18 00:02:43 UTC Post #348258
Okay so I got the most recent version of half life updated which should hopefully work. All I'm asking for is some more clarification. Please can you tell me the code I need to write or copy into items.cpp like you mentioned so I can get this to work? I don't plan on doing any more programming after this than is necessary. I know how to build a project and I know how to write lines of code I just need to know what to write.
Posted 1 year ago2023-12-18 07:44:08 UTC Post #348261
The Unified SDK already has item_helmet and item_armorvest in it, in src/game/server/entities/items/items.cpp.
Posted 1 year ago2023-12-18 19:01:35 UTC Post #348268
So shall I just copy those over to the SDK I've decided to use? You'll have to excuse me, I'm very sceptical of the solution being that simple. I'll try that now.
Posted 1 year ago2023-12-18 19:08:00 UTC Post #348269
Yeah visual studio doesn't like it. It's thrown up an error complaining about being unable to format ClangFormat or something I don't understand. Almost all of the code has red lines underneath it. I knew it wasn't that easy, I was right.
Posted 1 year ago2023-12-18 20:16:23 UTC Post #348272
Everyone in this forum seems very keen on suggesting modifying game code, the hardest modding task there is, at the first opportunity. If it's not a very specific problem, I can guarantee you that somebody's already done the hard work.

You said you wanted guard vest and helmet from Blue Shift? The Half-Life Featureful mod already has that: https://github.com/FreeSlave/halflife-featureful
Here's the list of items added by the mod and you can see the ones you specifically needed is there: https://github.com/FreeSlave/halflife-featureful/wiki/Items
Here's how to base your mod off of it: https://github.com/FreeSlave/halflife-featureful/wiki/Base-the-mod-on-Featureful-SDK
For further help on using the featureful mod you'd have to turn to its main dev. He's usually reachable on TWHL's Discord.
Posted 1 year ago2023-12-18 23:00:44 UTC Post #348274
Okay so it works perfectly now, the helmet now spawns and I can pick it up finally. Thanks for linking this to me I never would have known it existed otherwise, it's actually really good with the amount of features it provides. Thanks for all the help, I got a bit frustrated earlier but I still greatly appreciate it.
You must be logged in to post a response.