Constants for setting or retrieving categories of an object. These constants are used with
GetCategory and
SetCategory. The category of an object is a DWord bitmask composed of the following values. The first 5 categories do not allow any combination,
exactly one of the bits 0-4 may and must be set at any time.
The
C4D_All constant introduced in 4.6.5.0 CP stands for "all categories" and can be used for filter functions for example. Constants
that are not listed but are in
DefCore.txt categories can be set with the appropriate numeric value via
SetCategory.
SetCategory(C4D_StaticBack, this());
Makes the object into a background object. This is used with castle parts so after completion other objects can be built in
front.
GetPlrKnowledge(0, 0, 0, C4D_Structure);
Returns the first building type that the first player can build.
GetDefinition(0, C4D_Object);
Returns the id of the first loaded definition. Similar scripting is used in the research lab to list researchable object.
var obj;
while (obj=FindObject(0, 0, 0, 0, 0, 0, 0, 0, 0, obj))
if (GetCategory(obj) & C4D_Goal)
RemoveObject(obj);
Removing all game goals. Using bitwise AND you can check whether two objects correspond in at least one category.
if(GetCategory( 0, GetHomebaseMaterial()) & C4D_Knowledge) Message("Spieler 1 kann etwas kaufen, was er auch erforschen oder bauen könnte.");
Using bitwise AND you can check whether two objects correspond in at least one category.