Hard Light Productions Forums

Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: yomi on October 31, 2011, 12:31:55 pm

Title: AI weapon selection
Post by: yomi on October 31, 2011, 12:31:55 pm
I gave AI player 2 primary weapons. First is very weak but have 2000 range. Second is strong but its range is only 300. Now AI player will always try get to close range to fire with stronger weapon, and will never use first one.

Is it possible for AI to chose which primary weapon basing on range?
For example, it would use long range weapon  while approaching to target, and than stronger, while in range.
I tried using "smart primary weapon selection", but apparently it doesn't work that way(i really dunno, what it does).
Title: Re: AI weapon selection
Post by: Kobrar44 on October 31, 2011, 12:41:01 pm
It is possible to set AI wepons via sexps at certain range, but I duuno if it is doable other way.
Title: Re: AI weapon selection
Post by: Fury on October 31, 2011, 12:46:11 pm
AFAIK AI will try to pick the weapon that potentially does most damage to current target. If target has shields, it picks up the weapon with most shield damage. If no shields, it uses the weapon with most hull damage. I believe AI won't take into account weapon's range and velocity, just pure damage. I'm not even entirely sure if AI takes rate of fire into account when determining weapon damage.

In addition what Kobrar44 said, there is a sexp called good-secondary-time which instructs AI to use specific secondary weapon, I don't know if there is one for primaries yet. Can't check either as I don't have FSO installed.