Page 1 of 1

Script for AI to use bonus

Posted: Tue Sep 04, 2012 6:05 am
by rf900
Sorry to ask this, but I am stuck. I have followed the code from other missions that where the AI uses artillery but I cannot get it to work.

In the StartTurn function I use:

SetBonusBaseValue("GermanArtHitWait", 1, 0) ;
CallBonusFunction("BONUS_GERMAN_BATTERY", 1, 20, 35, 0) ;

Tried different combinations of values (leaving only the second line also), but not artillery fire is occurring, anything else I need for it to happen? Thanks

Re: Script for AI to use bonus

Posted: Mon Sep 10, 2012 7:49 am
by rf900
I think I was missing the bonus defined in the BAM file:

BONUS1 GERMANBATTERY.BSF

I willl test it this afternoon, added directly to the file but probably it can be done in the editor selecting the AI side first.

Re: Script for AI to use bonus

Posted: Mon Sep 10, 2012 3:22 pm
by Old_Warrior
I would like to hear if this works. Thanks for updating the thread.

Re: Script for AI to use bonus

Posted: Tue Sep 11, 2012 8:05 am
by rf900
Yes, it works, also in the editor when selecting the bonus icon below it says bonus for side0 if you click the icon again it says bonus for side1. So you can add it that way also.

Re: Script for AI to use bonus

Posted: Sun Jan 20, 2013 11:50 pm
by Old_Warrior
Ok - just an update - the key to using the Bonus battery for AI side is to add in the script AND add in the Bonus in the Editor too. Just for anyone else that is trying to build a mission with a pre-plotted arty mission.

Just had to go over this again and it does work if you do BOTH.