Jump to content

AI Packages: Finding multiple objects


ub3rman123

Recommended Posts

I'm trying to rig up an AI package on an enemy so when they enter combat, they'll flee to the nearest object of a type. There's around 7 different object types I want them to flee to. However, the AI section only has one selection box for finding it. How can I get them to flee to the nearest object (I tried the dummy cell thing used in scripting, naming a base AObject, then the targets AObject1, etc, didn't work)?
Link to comment
Share on other sites

I'm trying to rig up an AI package on an enemy so when they enter combat, they'll flee to the nearest object of a type. There's around 7 different object types I want them to flee to. However, the AI section only has one selection box for finding it. How can I get them to flee to the nearest object (I tried the dummy cell thing used in scripting, naming a base AObject, then the targets AObject1, etc, didn't work)?

 

How about multiple AI packages - one for each of the objects, with a within distance condition? Add all of the packages and the actor should go down the list and choose the first one that works. I'd probably have the one at the end of the list not have a within distance condition so that it would be the default fallback if the actor is not within proper range of any of them.

Link to comment
Share on other sites

Just a thought: could you create, not add, 7 packages, check for proximity of objects by script, then add the appropriate package?
Link to comment
Share on other sites

Is there an OR for packages? Seems like that could be a viable solution.

 

How do I get it to make sure that it picks the closest one? If the distance for each is set to 512, and it finds 5 objects within 512, it'll always go for the one on top of the list.

Link to comment
Share on other sites

Is there an OR for packages? Seems like that could be a viable solution.

 

How do I get it to make sure that it picks the closest one? If the distance for each is set to 512, and it finds 5 objects within 512, it'll always go for the one on top of the list.

 

No, there's not really an OR for packages as you mean (I think) or'ing whole packages together. In order for it to work you'd have to experiment (or map out and calculate) placement of your objects and distances for thresholds, but even then if you have overlap - it will choose the first in the list. You could add a bit of randomness to it with a quest variable value to dynamically change your overlap resolution - maybe have activators that change the value of the variable; then use the variable value as a part of your AI conditions.

Link to comment
Share on other sites

GetRandompercent instead of GetDistance, maybe?

 

Is there a way to prevent the particular find package of one object from running if said object isn't present in the room? I'd hate to have to include several copies of the same object to safeguard against multiple enemies trying to take the same object.

 

Edit; Figured that out. I can include both the GetRandomPercent thing and GetDistance. GetDistance to be sure that the thing is available, and GetRandomPercent to select one of the available.

Link to comment
Share on other sites

I just tried it, and there's no way to call GetDistance on an EditorID, only on specific references. So is there a way to check if the thing is near the object otherwise?

 

If there's no way to do this, I could just simplify the whole thing by just setting an enable parent on each object for each enemy, so they'll always go find the exact object I point out for them. Although that might lead to problems later trying to disable the object and replace it with another.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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