Page 1 of 1

AI Objective Questions

Posted: Fri Jan 09, 2015 5:18 pm
by Nedarb7
I have a couple questions regarding AI objectives.

First, is it possible to make the AI attack a region instead of an object? And second, can I do something like this:

Code: Select all

AIlobby = AddAIGoal(Team, "type", 100)

-- After a certain amount of time
AIlobby = AddAIGoal(Team, "type", 10)
So in other words, change the objective weight without deleting the goal?

Re: AI Objective Questions

Posted: Fri Jan 09, 2015 6:36 pm
by Maveritchell
Pretty sure all your second line there is going to do is give that AI goal a weight of 110. Since weights are all relative, that won't mean anything in isolation, but if you've got two different types set up, you'll obviously be adjusting the ratio there. (In short, no, you can't change absolute weight without clearing goals first.)

AI have two "goto"-type goals, "defend" and "destroy." Destroy is more precise, so if you want your AI to really go to a place, use that one. If you're okay with your AI hanging out in a very general area, you can use defend. Defend is very loose, though.

Re: AI Objective Questions

Posted: Fri Jan 09, 2015 7:17 pm
by Nedarb7
Maveritchell wrote:Pretty sure all your second line there is going to do is give that AI goal a weight of 110. Since weights are all relative, that won't mean anything in isolation, but if you've got two different types set up, you'll obviously be adjusting the ratio there. (In short, no, you can't change absolute weight without clearing goals first.)

AI have two "goto"-type goals, "defend" and "destroy." Destroy is more precise, so if you want your AI to really go to a place, use that one. If you're okay with your AI hanging out in a very general area, you can use defend. Defend is very loose, though.
So in theory, this would make the weight lower?

Code: Select all

AIlobby = AddAIGoal(Team, "type", -90)
But I guess that leaves the question of whether or not it's filling up the objective cap.

Also, how loose? I kind of want the AI to swarm near or at the area directed... say the area of one and a half Utapau hangars.

Re: AI Objective Questions

Posted: Fri Jan 09, 2015 7:28 pm
by Maveritchell
You're going to have to see if it'll use negative numbers. It appears to work additively, and I see your logic, but I can't tell you if that works. I've never tried. There's no reason you can't simply store your weights as variables and clear and reset them if it doesn't work, though.

"Defend" is probably fine for that large an area. Again, test it and see if it does exactly what you want. If it works, great (because it's a lot more logical behavior once the AI is there). If not, use "Destroy."

Re: AI Objective Questions

Posted: Sun Jan 11, 2015 1:37 pm
by [RDH]Zerted
change the objective weight without deleting the goal
Not possible.
Pretty sure all your second line there is going to do is give that AI goal a weight of 110
No, it will add a second goal with a weight of 10. Since both goals are the same, it's similar to one goal with a weight of 110, but it's taking up an extra goal slot. Remember, only a limited number of AI goals are allowed.
So in theory, this would make the weight lower?
No, I'm fairly certain negative weights will crash the game. At the very least it won't do what you want it to do.

Notice how you're not using AIlobby? If you were tweaking a goal you'd be doing something with the variable AIlobby.

Reread the AI goal documentation and play around with Defend/Destroy/Follow goals. See which gives you the results you want. I've never tried attacking a region. It might be easier to try them out using the Fake Console. If you do, make sure to kill all the bots after resetting the goals. Only when an AI dies or completes its goal does it get a new one.

Re: AI Objective Questions

Posted: Sun Jan 11, 2015 2:13 pm
by Maveritchell
[RDH]Zerted wrote:If you do, make sure to kill all the bots after resetting the goals. Only when an AI dies or completes its goal does it get a new one.
I believe you're off-the-mark here. I've cleared and swapped AI goals midstream based on player action, and the AI has responded to the new goal accordingly (without killing the AI).