Jump to content

New AI tool for Modders -- almost complete, need quick advice


Recommended Posts

Updated 2013-08-01


Solved -- used the below methodology, but tied a Fear spell to the Enemy Trigger instead of trying to force the execution of an AI Package or other pathed behavior. Will post scripts and videos soon.




Hi all!


I'm working on a mod that's mainly for modders -- that is, I want to make a new toolset that will help the modding community create more sophisticated enemy AI a little easier. Less work, more payoff.

While I love Skyrim, I noticed that most humanoid NPC's have some very basic, predictable behaviors -- melee folks rush, and archers / mages all hang around the exact same distance away. The game does some nice basic stuff with cover, but there's very little variance unless the modder goes in and makes extensive, explicit changes to behavior using a whole bunch of Packages with conditionals, etc.. That is very time consuming.


I want to change that.


Super quick synopsis of my tool: I've built a logging system that automatically clusters where all player and enemy hits take place in a dungeon -- i.e. when the player is within region A, s/he tends to deal a lot of damage to enemies in regions B, C, and D, etc.. The size and coordinates of each region are automatically calculated, honed down from hundreds or thousands of data points.


The final outcome I want is: When the player enters Region A, the NPC's know to FleeFrom Regions B, C, and D. This will force the player to move around more, as the NPC's won't be "suckers" and all sit and die in the same spot. Ideally, I want to make my system translate the clustered region information into scripts automatically, so there is absolutely minimal work on the part of the developer.


I would very much appreciate advice that would lead to the most efficient means of achieving the above goal. I tried the following methodology, but it doesn't work thus far, and I believe it's not optimal:


  • I've made a dungeon with Triggers for each Player and Enemy Region -- I tried to set it up so when the player enters Region A, it would change a value in a Script attached to Trigger Regions B, C, and D, etc..
  • Each NPC would also have a new Script attached, which would just create two new Properties -- a Boolean for "ShouldFlee", and an ObjectReference for the Object to FleeFrom(). Default Boolean value is False.
  • If an NPC entered Region B, C, or D while the player is in Region A, a Script attached to the Trigger in Regions B, C, and D would do three things:

1. Set the NPC Script's Boolean Property to True.

2. Set the NPC Script's ObjectReference Property to itself (the Trigger Box).

3. Force a re-evaluation of the NPC's Package Stack. There would be a single conditional in the Package Stack to check the Script Boolean Property,

and then flee from the ObjectReference if the Boolean is True.


Again, I'm not quite sure if this is the most efficient means of executing what I'd like. It depends a lot on Triggered Events (which is good...), but I haven't been able to get the code to work thus far. The Package Conditional fails to allow me to try and GetScriptVariable from my NPC, even when it has an explicit name / ID.


The only other alternative which I can think of at the moment is making a HUGE series of Package Conditionals that emulate these Trigger Boxes -- that is, they would constantly check the Player and NPC positions. However, I believe that would be a HUGE hindrance to performance, since GetPos would likely be checked every "tick" of the engine.


Again, I want to make my system translate the clustered region information into scripts automatically, so there is absolutely minimal work on the part of the developer -- so, if there's a way to get most of this behavior out of some Scripts with minimal use of the GUI, all the better!

Your sage advice much appreciated!

Edited by EtherealCoder
Link to comment
Share on other sites

  • Recently Browsing   0 members

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