HOW THE HECK do I link a CPP file to an FGD file? Created 1 year ago2023-07-17 04:12:17 UTC by Xenpanther420 Xenpanther420

Created 1 year ago2023-07-17 04:12:17 UTC by Xenpanther420 Xenpanther420

Posted 1 year ago2023-07-17 04:12:17 UTC Post #347713
I have this basic FGD file (which I have yet to test BTW)

`
@include "base.fgd"

@PointClass base(Monster) size(-32 -32 0, 32 32 64) = monster_Charizard : "Charizard"
[
skin(Choices):"colors":0
[
0:"default"
1:"blue"
2:"green"
3:"red"
]
]
`
and here's the CPP (known as Char.cpp)

`
#include "extdll.h
#include "util.h"
#include "cbase.h"
#include "monsters.h"
#include "schedule.h"
#include "decals.h"

//======================
//--Monster's Animal Events--
//======================
#define idle ( 0 )
#define idle2 ( 1 )
#define firebreath ( 2 )

class Charizard : public Chase monster
{
Public
void Spawn( void );
void Precache( void );
int Classify ( void );
void SetYawSpeed( void );
};

LINK_ENTITY_TO_CLASS( Cus_Char, charizard );

//============
// Spawn
//============
void Cus_Char :: Spawn()
{
pev->solid SOLID_SLIDEBOX;
pev->movetype MOVETYPE_STEP;
m_bloodcolor. BLOOD_COLOR_GREEN;
[Other template jargon]
`
All I want to know is HOW DO I TELL THE FGD TO READ THIS FILE? If its hard coded to read a directory for CPP files what directory, If it needs to be specified, how do I do that?? Its currently 12:08am, and I pulled an unnecessary all nighter the night before, and Google just Provides weird legal jargon, Could somebody PLEASE HELP ME OUT!!!
Posted 1 year ago2023-07-17 05:27:13 UTC Post #347714
I'd discourage using uppercase in the classname. Instead of monster_Charizard you should use monster_charizard.

There are other issues with the code in your post, but let's ignore that for now and focus on what actually registers the class as an entity for use in the .fgd file:
The LINK_ENTITY_TO_CLASS(mapClassName, DLLClassName) function.
First argument is the .fgd name you want to give your entity, and the second argument is the name of the code class for your entity.

In your case it should be:
LINK_ENTITY_TO_CLASS(monster_charizard, Charizard)
Posted 1 year ago2023-07-17 10:16:45 UTC 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 1 year ago2023-07-17 15:26:39 UTC Post #347716

Sorry for the long comment.

@Admer456 thanks I'll change the link entity to class
But I would also like to know where the c++ file should be located

It should also be noted that I'm not concerned about any functionality (the ability to move, monster speech, or combat). I just want these things:
  • to see the entity be listed in hammer,
  • have the skin options,
  • and the correct model when map is compiled.
That being said is there anything I can/need to cut out? Additionally I want to replace this with the corresponding Monster_Generic entity that fires 3 linked aiscripted_generic when a button is pressed.

It should finally be noted That I'm using Xash3D (I already have a fully fledged mod with a custom menu screens, maps, modified Sentences.txt, models, and at least 3 Custom wad files (about as disorganized as any users download folder), and I'm too lazy to make a port for Steam's version).
Posted 1 year ago2023-07-17 18:19:41 UTC Post #347717
Where you should place the file, and many other questions you have, is already answered in the tutorial Penguinboy shared with you in the Shoutbox.

Further, I'd suggest looking at other monster classes in the SDK. There's a lot to be learned looking at the code that's already there.
Posted 1 year ago2023-07-17 19:01:58 UTC Post #347718
@Erty thanks
You must be logged in to post a response.