Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //WIP code for the also very WIP KAI library https://github.com/inkoalawetrust/KAI
- //TODO: Virtualize this. Also add a vehicle flag that allows a vehicles' threat level to be passed down to its' turrets.
- //Try heuristically determining how dangerous the other actor is. This is pretty hard to do universally. Since stuff like attacks can't be checked.
- Int AssessThreatLevel (Actor Other)
- {
- If (!Other || IsDead (Other)) Return THREAT_NONE;
- //KAI NPCs can have specific threat levels set, in which case, just return whatever the NPCs' threat level is.
- If (Other Is "KAI_Actor" && KAI_Actor(Other).ThreatLevel != THREAT_ASSESS)
- Return KAI_Actor(Other).ThreatLevel;
- //It's not even a player or NPC.
- If (IsInanimateObject (Other))
- Return THREAT_NONE;
- //If indestructible. Then the other actor is unstoppable (Obviously)
- If (HasGodMode (Other) || HasBuddha (Other) || IsIndestructible (Other) ||
- //Also unstoppable if, more esoterically, it has NONSHOOTABLE (Hitscans go through), NOBLOCKMAP (Projectiles go through), and NORADIUSDMG (No splash damage)
- //NOTE: If you have any FORCERADIUSDMG attacks, you might want to remove these 3 flag checks. Since your actor can harm an enemy with these properties.
- Other.bNonShootable && Other.bNoBlockmap && Other.bNoRadiusDmg)
- Return THREAT_UNSTOPPABLE;
- //If the actor has 2500+ health.
- If ((Other.SpawnHealth() >= 2500 || Other.Health >= 2500) ||
- //Or it's enormous (3.4m tall and 4.5m wide or bigger, larger than the Challenger 2 tank, which is huge).
- (Other.Height >= 110 && Other.Radius >= 72))
- Return THREAT_VERYDANGEROUS;
- //Alternatively, if the actor has as much health as a THREAT_DANGEROUS actor, but can reflect projectiles back at enemies, it's also very dangerous.
- Else If ((Other.SpawnHealth() >= 1000 || Other.Health >= 1000) && Other.bReflective && Other.bAimReflect)
- Return THREAT_VERYDANGEROUS;
- //If the actor has 1000+ health. Or 500+ health and deflects projectiles, then it's dangerous.
- If ((Other.SpawnHealth() >= 1000 || Other.Health >= 1000) || (Other.SpawnHealth() >= 500 || Other.Health >= 500) && Other.bReflective)
- Return THREAT_DANGEROUS;
- //If the actor has 500+ health.
- If ((Other.SpawnHealth() >= 500 || Other.Health >= 500) ||
- //Or has 100+ health and flies or is fast.
- (Other.SpawnHealth() >= 100 || Other.Health >= 100) && (IsFlying (Other) || Other.Speed >= 15) ||
- //Or is weak, but flies around fast.
- (Other.SpawnHealth() >= 50 || Other.Health >= 50) && IsFlying (Other) && Other.Speed >= 15)
- Return THREAT_ABOVENORMAL;
- //If the actor has 100+ health. Or is weak, but fast.
- If ((Other.SpawnHealth() >= 100 || Other.Health >= 100) || (Other.SpawnHealth() >= 20 || Other.Health >= 20) && Other.Speed >= 15)
- Return THREAT_NORMAL;
- //If the actor has 50+ health (About as much as an Imp or Chaingunner)
- If ((Other.SpawnHealth() >= 50 || Other.Health >= 50))
- Return THREAT_MILD;
- //If the actor has 20+ health. AKA is about as strong as a Shotgunner or Zombieman.
- If ((Other.SpawnHealth() >= 20 || Other.Health >= 20))
- Return THREAT_LOW;
- //If the actor has 10 health OR LESS. Or dies on contact with anything, then it's super weak.
- If ((Other.SpawnHealth() <= 10 || Other.Health <= 10) || Other.bTouchy)
- Return THREAT_VERYLOW;
- Return THREAT_NONE; //If it's none of the above, then it's probably not a problem, probably.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement