Editing Entity Definition Files (.def)


(digibob) #1

Right, here’s my first (of many i hope :wink:) “tutorial”.

Let’s take a look at an existing .def entry first.

/*QUAKED func_button (0 .5 .:cool: ? x x x TOUCH x x STAYOPEN
When a button is touched, it moves some distance in the direction of it’s angle, triggers all of it’s targets, waits some time, then returns to it’s original position where it can be triggered again.

“model2” .md3 model to also draw
“angle” determines the opening direction
“target” all entities with a matching targetname will be used
“speed” override the default 40 speed
“wait” override the default 1 second wait (-1 = never return)
“lip” override the default 4 pixel lip remaining at end of move
“health” if set, the button must be killed instead of touched
“color” constantLight color
“light” constantLight radius
*/

/* and */ are comments, i.e. bits which are used to make notes inside code, but which arent part of the actual source, this is a legacy thing from older versions of radiant which tended to just read thru the source files to gather teh entity information, so the programmers could just write the things as they went along, without having to go near radiant :smile: You can just ignore these, but they are NEEDED, so dont remove them. (Basically they enclose the entire entity definition.)

next, QUAKED, means we are defining a new entity type.

The next part is (R G B), i.e. a colour definition for the entity, in this case 50% green, and 80% blue. This creats a kind of cyan like colour.

the Next part defines the size of the entity, which in this case is “?”, which means it is a brush based entity. Otherwise it would be “(-16 -16 -16) (16 16 16)” or somesuch, which would make it a box of length 32 on each edge.

The final section on this line defines the spawnflags, “x” representing an unused one. The first flag is weighted at 1, the next 2, then 4, 8 etc, this MUST be synchronized with code, or it is useless, hence why it was “padded” with unused values in this case.

The rest of the text is just the text that will go in the big text box in the entity inspector, put whatever you feel like in here, a description of what the entity does and it’s many possible key/value pairs is the norm.

Good luck :smile: