-
Notifications
You must be signed in to change notification settings - Fork 0
KAI_EventHandler
KAI_EventHandler is the basic event handler of the KAI library. Currently, it's only purpose is keeping track of all projectiles currently flying around in the map and vehicles.
Type: Dynamic actor array
Stores pointers to every projectile currently in the map that hasn't vanished or died/exploded yet. The array can be iterated through to check every projectile in the map as easily as this:
ForEach (Proj : KAIHandler.ProjectileList)
{
//Run code here. Proj can be whatever pointer name you want to give to the currently iterated projectile.
}
Type: Dynamic KAI_BaseVehicle array
Stores pointers to every KAI vehicle in the map, vehicles are only removed from the array once destroyed, so dead vehicles still stay in.
Type: Associative map with <Int,KAI_NPCGroup> pairs.
An associative map that stores references to all NPC groups in the level. The event handler also runs a "janitor" operation once every few seconds, to remove any groups still in the map, but that have no members in them.
- What: What actor to add to the ProjectileList array ?
Used to add projectiles to the projectile list. The actor in question must be a +MISSILE and do more than 0 damage. There shouldn't really be any reason to use this function, since it's already automatically handled every time an actor spawns.
- What: What actor to remove from the ProjectileList array ?
Removes the specified actor from the projectile list if it was present there.
- Who: What vehicle to remove from the AllVehicles array ?
Removes a vehicle from the AllVehicles array. Must be a descendant of KAI_BaseVehicle. Again, no reason to use this directly.
- Group: The KAI_NPCGroup instance to add.
Handles adding NPC group classes into the NPCGroups map, primarily assigning them a random integer ID to be put in.
THIS FUNCTION SHOULD NOT HAVE TO BE CALLED MANUALLY, AS IT SHOULD BE HANDLED BY CREATEGROUP() ALREADY. IT WILL NOT CHECK WHETHER THE SAME GROUP IS IN THE MAP ALREADY !
- The ID to search for in NPCGroups
Finds an NPC group, if any, based on it's ID (Key pair in NPCGroups). Basically a wrapper for GetIfExists()
Returns a pointer to the NPC group.
- GroupName: The cosmetic name to check if any groups have.
- CaseSensitive: Should the string check be case sensitive ? For example, if it's not, both "Meal Team Six" and "meal team six" will be returned.
- Groups: The KAI_NPCGroup array that must be passed by reference. All groups the function finds with the specified GroupName will be added to the array pointer passed here.
Finds all NPC groups in the level that have the specified cosmetic group name.
Returns true if any groups with that name were found. The actual return is the Groups array that must be passed by reference.
- EventType: The type of event to emit to all the relevant groups. A list of possible group event types can be seen here. (TODO: Add link to the group events enum once I write the KAI_NPCGroup page)
- Affected: The actor that was affected by the specified EventType.
Handles the generic WorldThingDestroyed/Revived/Died events built into ZScript, by alerting the groups Affected is in of them, like if Affected is revived. All groups they're in will receive GRPEVNT_REVIVAL.
THERE IS LITTLE REASON TO CALL THIS FUNCTION ON YOUR OWN.
- Home
- Features
- Classes
- Functions
- Guides