Unable to add entity to Hammer Created 4 years ago2019-10-10 16:14:36 UTC by sluggard sluggard

Created 4 years ago2019-10-10 16:14:36 UTC by sluggard sluggard

Posted 4 years ago2019-10-10 16:14:36 UTC Post #343204
I've been following along with this tutorial (Great tutorial, by the way) to get an idea of how monster entities work so I can do my own in the future, I got as far as the part where I have to add him to the map. Here's how the code looks like so far, added a new .cpp item under Source Files > dlls called pitdrone.cpp

https://pastebin.com/cfdXjMrU

I already set up an .fgd file and added it to game configuration in hammer. here's how it looks like now:
@PointClass base(Monster, Sequence) size(-16 -16 0, 16 16 72) studio("models/npcs/pit_drone.mdl") = monster_pitdrone : "monster_pitdrone" []
And I also copied the pit_drone model files to the correct folders (pit_drone under MYMOD/models/npcs and pit_drone_spike under MYMOD/models), yet when I look in the entities list I can't find it:
No monster_pitdroneNo monster_pitdrone
It works just fine ingame though if I manually type in the Class name in the object properties window, so It must be something wrong in my .fgd file, anyone knows what's wrong with it?
Works fine ingameWorks fine ingame
sluggard sluggardInsert Creative "Custom Title Text" here
Posted 4 years ago2019-10-10 19:52:58 UTC Post #343205
I figured it out (I guess) I modified the default Half-Life fgd by adding my monster to it instead of adding a separate fgd file. works fine now, It's probably not a perfect solution but it'll do for now.
sluggard sluggardInsert Creative "Custom Title Text" here
Posted 4 years ago2019-10-12 14:39:19 UTC Post #343213
LOZ98 said:I figured it out (I guess) I modified the default Half-Life fgd by adding my monster to it instead of adding a separate fgd file. works fine now, It's probably not a perfect solution but it'll do for now.
Sounds like a specified base wasn't defined in the FGD - just one of them being incomplete or if failing to be read will not show the entity in the list. In your case, it was either "Monster" or "Sequence", or even both. Quick example of how it should be:
//
// BaseClasses
//

@BaseClass = Angles
[
angles(string) : "Pitch Yaw Roll (Y Z X)" : "0 0 0"
]

@BaseClass = RenderFxChoices
[
renderfx(choices) : "Render FX" : 0 =
[
0 : "Normal"
1 : "Slow Pulse"
2 : "Fast Pulse"
3 : "Slow Wide Pulse"
4 : "Fast Wide Pulse"
9 : "Slow Strobe"
10 : "Fast Strobe"
11 : "Faster Strobe"
12 : "Slow Flicker"
13 : "Fast Flicker"
5 : "Slow Fade Away"
6 : "Fast Fade Away"
7 : "Slow Become Solid"
8 : "Fast Become Solid"
14 : "Constant Glow"
15 : "Distort"
16 : "Hologram (Distort + fade)"
]
]

@BaseClass base(RenderFxChoices) = RenderFields
[
rendermode(choices) : "Render Mode" : 0 =
[
0 : "Normal"
1 : "Color"
2 : "Texture"
3 : "Glow"
4 : "Solid"
5 : "Additive"
]
renderamt(integer) : "FX Amount (1 - 255)"
rendercolor(color255) : "FX Color (R G B)" : "0 0 0"
]

@BaseClass = Target
[
target(target_destination) : "Target"
]

@BaseClass = Targetname
[
targetname(target_source) : "Name"
]

@BaseClass base(Target, Targetname, RenderFields, Angles) color(0 200 200) = Monster
[
TriggerTarget(String) : "TriggerTarget"
TriggerCondition(Choices) : "Trigger Condition" : 0 =
[
0 : "No Trigger"
1 : "See Player, Mad at Player"
2 : "Take Damage"
3 : "50% Health Remaining"
4 : "Death"
7 : "Hear World"
8 : "Hear Player"
9 : "Hear Combat"
10 : "See Player Unconditional"
11 : "See Player, Not In Combat"
]
spawnflags(Flags) =
[
1 : "WaitTillSeen" : 0
2 : "Gag" : 0
4 : "MonsterClip" : 0
16 : "Prisoner" : 0
128 : "WaitForScript" : 0
256 : "Pre-Disaster" : 0
512 : "Fade Corpse" : 0
]
]

//
// Entities
//

@PointClass base(Monster, Sequence) size(-16 -16 0, 16 16 72) studio("models/npcs/pit_drone.mdl") = monster_pitdrone : "monster_pitdrone" []
Note how I only added the bases required for your entity, as well as the bases required by said bases themselves. In short, a base that is then used by an entity or another base must've been defined previously.
MOCOLONI MOCOLONIinfo_player_mocoloni
Posted 4 years ago2019-10-13 01:22:08 UTC Post #343215
Oh, I assumed they were already defined in the other .fgd file and that I don't need to redefine them. I guess it doesn't have a way of sharing definitions between several .fgd files. I'll keep that in mind whenever I create new .fgd files from now on. Thanks!
sluggard sluggardInsert Creative "Custom Title Text" here
Posted 4 years ago2019-10-13 13:59:03 UTC Post #343216
You can include definitions from one fgd file into another by adding the line ''@include "filename.fgd" (no quotes) as is explained here: https://developer.valvesoftware.com/wiki/FGD but I'm certain this applies to goldsource fgd files as well though I'm not 100% sure.
The Mad Carrot The Mad CarrotMad Carrot
Posted 4 years ago2019-10-13 16:07:12 UTC Post #343217
I tried doing it but it didn't work, I even tried giving it the full path to the actual base file but same result. maybe the editor I'm using doesn't support it.

I'm using Hammer 3.5.3 (for GoldSrc), it probably works only on Hammer 4.x
sluggard sluggardInsert Creative "Custom Title Text" here
Posted 4 years ago2019-10-14 21:39:14 UTC Post #343218
The Mad Carrot said:You can include definitions from one fgd file into another by adding the line ''@include "filename.fgd" (no quotes) as is explained here: https://developer.valvesoftware.com/wiki/FGD but I'm certain this applies to goldsource fgd files as well though I'm not 100% sure.
That's for Source games only. This is why mod-based GoldSrc FGDs are simple forks of the original Half-Life file, rather than just have a base file of entities shared between said mods and then dedicated ones to complete the list of entities.
MOCOLONI MOCOLONIinfo_player_mocoloni
You must be logged in to post a response.