Hard Light Productions Forums
Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: xenocartographer on April 03, 2015, 11:14:25 am
-
I'm trying to teach the AI how to effectively use some new weapons. Both are fairly specialist weapons, but I'm not sure how to tell the AI that! My first question is how the AI chooses what weapon to use in a given tactical situation. My intuition is that it's based on relevant damage per energy consumption, weighted somehow by flags like bomber+ and possibly some estimation of chance to hit, but that's very difficult to test! If anyone knows the actual algorithm, that would be very helpful.
Anyway, some details.
One weapon is a long-range sniper cannon with limited ammunition. The AI tries to use it for everything, probably due to its high damage numbers and nonexistent energy consumption, even when it has no ammo left. I've verified this with player-use-ai in a test mission and watching the weapon selection gauge. (Manually changing weapons, which you can apparently do even while under AI control, causes it to switch back after firing a few rounds.)
The other is a high-damage high-energy-use weapon intended to be used opportunistically, to finish off a wounded target or perform a surprise "snap shot" maneuver. It's also effective against subsystems, which the AI does well enough. It has very high DPS but is also very inefficient - DPS is 250 against both shields and armor, but damage per energy consumed is only 25. I'd thought that that would cause the AI to not use it so much - I'm actually surprised it uses it against anything besides subsystems! - but I was mistaken there.
EDIT: Since writing this, I was able to get the second weapon mostly working via a hack with an artificially lowered shield factor, a copy of the original weapon with the correct damage value, and $Substitute: . This helped a lot and the AI now has enough energy to actually kill things, but it still keeps trying to use this weapon even when its energy is depleted.
There might be something very obvious I'm missing, or maybe I'm coming at this from the wrong direction. Anyone?
-
Well, first, it would be good to know if smart primary weapon selection (http://hard-light.net/wiki/index.php/Ai_profiles.tbl#.24smart_primary_weapon_selection:) is enabled.
-
It is. I'm not actually sure why I enabled it, come to think of it - there isn't really any detail about what either setting does. Guess it was an impulse.