Skip to content

KAI_DataToken

inkoalawetrust edited this page Jul 4, 2024 · 4 revisions

KAI_DataToken

Parent class: Inventory

Description

KAI_DataToken is a special class in the library. It's an inventory item that can be given to non-KAI actors (And actors that don't inherit from KAI_actor) to give them certain bits of KAI-related information, this allows KAI NPCs to interact with said actors better. For example, you could make a KAI compatibility patch for a mod, that uses an event handler to give hardcoded threat levels to monsters from that mod.

However the biggest use for this token, and the purpose it was originally made for. Is to add completely optional partial KAI support to non-KAI mods, without those mods creating startup errors due to nonexistent classes or methods when the KAI library isn't loaded. Similar to Corruption Cards' CCARDS file.

For a guide on adding optional KAI support to your mod, check the See also section.

Variables

ThreatLevel

The threat level of the tokens' owner. This is the alternate way to giving an actor a threat level, as opposed to using the KAI_Actor property.

VelocityMonster

The owner of the token only moves by thrusting themselves around, like how players move. This is used to mark non-KAI actors so that they are handled by the target prediction code properly.

Groups

A dynamic array with pointers to all the NPC groups the actor is in. Used to allow non-KAI NPCs to keep track of what groups they're in. When a non-KAI NPCs is added to a group, the group they're part of is either added to this variable, or if they don't have the token already, it is given to them to allow for tracking this info.

Note: I'm not actually sure how well this info can even be used by non-KAI mods for OPTIONAL compatibility. Chances are, trying to do anything with this data would create a hard dependency to the library. Since ACS can't be used to get and read this group info, unlike threat levels.

See also

Clone this wiki locally