A Fact is a persistent Event.
A Fact must be stored into a Fact database.
Many objects have their own database.
Each scenario, entity, logic, knowledge, component (...) have their own.
From the code, do the following:
<initiator>.raiseFact("fact name", duration);
<initiator>.raiseFact("fact name", { T_Ptr, pointer, duration, Scope });
|
For example, if the entity tank must store the fact Damaged to its own fact database, for 1 hour after a hit, do the following:
Vt_Entity* tank = S:findEntity("tank");
tank->sFact("Damaged", 3600); // in seconds
|
Because a fact is persistent (longer than an event), it is possible to do it from the code or from the GUI.
From the code: To check if the entity tank has been damaged, do the following:
Vt_Entity* tank = S:findEntity("tank");
if (target->hFact("Damaged")) ...
|
To update a fact from a database, by changing its duration value, do the following:
Vt_Entity* tank = S:findEntity("tank");
tank->sFact("Damaged", 1000);
|
To remove a fact from a database, do the following:
Vt_Entity* tank = S:findEntity("tank");
tank->dFact("Damaged");
|