entity - graphitemaster/gmqcc GitHub Wiki

An entity represents an object in the game.

entity type

In QC the entity type represents such an object. Usually implemented as an integer containing an entity ID. A variable of this type can be accessed similarly to structs in C: members can be accessed via the dot-operator.

Members

Members are declared by prefixing a global variable declaration with a dot, thus writing

.float health;

in a QC source file at the global scope causes all entities to have a member of type float named health.

Snippet:

.float health;
.entity last_attacker;
.string name;

void(entity attacker, entity target, float dmg) damage = {
    target.last_attacker = attacker;
    target.health -= dmg;
    if (target.health <= 0) {
        print("Player ", target.name, " was killed by ", attacker.name);
        die(target);
    }
}