TrenchBroom / TrenchBroom

Cross-Platform Level Editor
kristianduske.com/trenchbroom
GNU General Public License v3.0
1.88k stars 224 forks source link

Hexen II .fgd isn't processing properly #2601

Closed DelusionalBear closed 5 years ago

DelusionalBear commented 5 years ago

So I'm trying to edit Hexen II .fgd file and add a drop down list for "puzzle_piece" entities that will let mappers just choose puzzle piece they need from a list, instead of remembering that "keep3" is actually a "Mill key". According to FGD file format specs here https://developer.valvesoftware.com/wiki/FGD I can do drop down lists for integers, floats and strings. So I'm editing puzzle_piece like this:

@PointClass base(Appearflags, Targetname, Target) size(-8 -8 -32, 8 8 32) = puzzle_piece : "Puzzle piece"
[
    spawnflags(Flags) =
    [
        1 : "Spawn" : 0
        2 : "Floating" : 2
        4 : "Auto get" : 0
    ]
    puzzle_id(choices) : "Puzzle id" : "keep3" = 
        [
            "keep3" : "Mill key"
            "cskey" : "Castle key"
            "scrol" : "Disrupt Magic Scroll"
        ]
    message(string) : "Message"
    netname(string) : "Puzzle piece name" //Name of piece, displayed when picked up
    style(integer) : "Light Style"
]

the problem area here is "puzzle_id(choices)". If I do something like this:

puzzle_id(choices) : "Puzzle id" : 0 = 
        [
            0 : "Mill key"
            1 : "Castle key"
            2 : "Disrupt Magic Scroll"
        ]

then its working, but I need strings, not numbers. And if I try strings, .fgd file just doesn't seem to load at all.

System Information

TrenchBroom 2019.3 on Windows 7

kduske commented 5 years ago

Same goes for floats.

eGax commented 5 years ago

This works for me:

@PointClass base(Appearflags, Targetname, Target) size(-8 -8 -32, 8 8 32) = puzzle_piece : "Puzzle piece" [ spawnflags(Flags) = [ 1 : "Spawn" : 0 2 : "Floating" : 2 4 : "Auto get" : 0 ] puzzle_id(choices) : "Puzzle id" : : "keep3" = [ "keep3" : "Mill key" "cskey" : "Castle key" "scrol" : "Disrupt Magic Scroll" ] message(string) : "Message" netname(string) : "Puzzle piece name" //Name of piece, displayed when picked up style(integer) : "Light Style" ]

No idea how or why but when using strings with (choices) the double : : is required to make it work.

DelusionalBear commented 5 years ago

@eGax its working fine with only one ':' for integers tho, so this is definitely some kind of error.

eGax commented 5 years ago

Also, you can create default string value hints/comments for keys as well inside the : : like this modified line from your puzzle_piece entity setup above like:

message(string) : "Message" : "Hello World ! ! !" : "..a message to the player"

image

DelusionalBear commented 5 years ago

I know about default values, but here is an interesting idea - what if that ": :" is being treated as an empty default value?

eGax commented 5 years ago

...umm it is as far as I know. You can use then in integers. So this line from obj_ballista by default is:

cnt(integer) : "Degrees of pitch off start" : 30

Changing to this make it's default value blank:

cnt(integer) : "Degrees of pitch off start" : : "def=30"

DelusionalBear commented 5 years ago

Integers are working fine, 30 is being read as default value and long description is just skipped. But with strings and floats its actually expecting long description to be present, otherwise it doesn't load FGD at all.

edited to remove offensive (it seems) bits.