Jump to content

differentiating complex enemies from simple ones'


Recommended Posts

so i am designing an ai for my follower mod, and she has to recognize enemies. an easier way to accomplish this is if i were to be able to easily separate complex enemies from simple ones. complex enemies are basically the humanoids: can have different armors, spells, weapons, etc. simple enemies are beasts, dragons, animals, etc, that all are pretty much the same and only differ by level.

here's my current strategy, but i am hoping there are improvements you can think of:

every enemy in combat is hit by a spell with three magic effects, but only one goes through depending on the conditions that help differentiate them. the first checks to see if the enemy is labeled unique, the second is intended to check for all complex enemies, and the third everything else (basic enemies). While checking for unique is a single condition function, checking for complex enemies is far more robust, and i'd rather the game not have to plow through all these conditions for every enemy in combat:

conditions for complex enemy (current iteration)


HasMagicEffect(_a2_INTLidentifyFFunique) = false AND
GetIsPlayableRace = true OR
GetIsRace(DraugrRace) = true OR
GetIsRace(DraugrMagicRace) = true OR
GetIsRace(ElderRace) OR = true OR
GetIsRace(ElderRaceVampire) = true OR
GetIsRace(FalmerRace) = true OR
GetIsRace(ArgonianRaceVampire) = true OR
GetIsRace(BretonRaceVampire) = true OR
GetIsRace(DarkElfRaceVampire) = true OR
GetIsRace(HighElfRaceVampire) = true OR
GetIsRace(ImperialRaceVampire) = true OR
GetIsRace(KhajitRaceVampire) = true OR
GetIsRace(NordRaceVampire) = true OR
GetIsRace(OrcRaceVampire) = true OR
GetIsRace(RedguardRaceVampire) = true OR
GetIsRace(WoodElfRaceVampire) = true OR
GetIsRace(FalmerRace) = true OR

 

A couple things to note about this list:

  • Things might be unintentionally omitted. I don't know if children need to be accounted for as complex enemies, though I'm guessing people may have modded them in such a way that they become hostile (do they even have animations for combat?); I may have forgotten a few enemy types that can be complex (I'm pretty sure the hags are basic enemies)
  • I don't think there's any other way to account for all types of vampires, but I'm all ears. This kind of depends on the extend to which objects I can check keywords, because I believe the magic effect is run on the actor, and the actors that are of the vampire races do not comprehensively have the vampire keyword. If there is a way to check the keywords on the race in a way that's less demanding than all these races, please let me know.

I'll go into more detail about how I'm identifying enemies beyond this in a bit, but I have to run off for now.

I very much appreciate any insight you can provide.

Link to comment
Share on other sites

If I recall correctly playable races (and a few others) have the keyword ActorTypeNPC, could have the spell check for that keyword. Might not be as specific as you'd like, but it would reduce the number of conditions you have to include.

 

Other races have different keywords that you could check for, not at home, so I can't check right now, but they include stuff like ActorTypeCreature, ActorTypeUndead, and so on.

Link to comment
Share on other sites

Alan's right - it's not intuitive or straightforward AT ALL, but yes indeed, keywords are the way to go here.

 

You may think that keywords are unreliable because the vast majority of actors don't have the correct keywords, UNTIL you look at their race and you find that the race itself has keywords... and those are very reliable.

 

Pull down the source code for NPC Knockout Overhaul and take a look at NKOMainQuestScript. Here's a sample:

 

 

 

; Returns true if the actor belongs to one of the following humanoid races:

; Breton, Imperial, Nord, Redguard, Altmer, Bosmer, Dunmer, Orsimer, Argonian, Khajiit, Dremora.

bool Function IsHumanoid(Actor actorRef)

return actorRef.GetRace().HasKeyword(ActorTypeNPC)

EndFunction

 

; Returns true if the actor is a Vampire.

bool Function IsVampire(Actor actorRef)

return actorRef.GetRace().HasKeyword(Vampire)

EndFunction

 

; Returns true if the actor is a Werewolf or Werebear (a Lycanthrope).

bool Function IsLycanthrope(Actor actorRef)

return actorRef.GetRace() == WerewolfBeastRace || actorRef.GetRace() == DLC2WerebearBeastRace

EndFunction

 

 

 

Also, just a suggestion, but you might consider using just one magic effect with a variety of different 'states' - one to cover each of your three scenarios.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...