Script for AI to use bonus

Modders can post their questions on scripting and more.

Moderators: Slitherine Core, BA Moderators

Post Reply
rf900
Staff Sergeant - Kavallerie
Staff Sergeant - Kavallerie
Posts: 339
Joined: Fri May 04, 2012 6:59 am

Script for AI to use bonus

Post 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
rf900
Staff Sergeant - Kavallerie
Staff Sergeant - Kavallerie
Posts: 339
Joined: Fri May 04, 2012 6:59 am

Re: Script for AI to use bonus

Post 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.
Old_Warrior
Major - Jagdpanther
Major - Jagdpanther
Posts: 1019
Joined: Fri Apr 30, 2010 3:13 am

Re: Script for AI to use bonus

Post by Old_Warrior »

I would like to hear if this works. Thanks for updating the thread.
rf900
Staff Sergeant - Kavallerie
Staff Sergeant - Kavallerie
Posts: 339
Joined: Fri May 04, 2012 6:59 am

Re: Script for AI to use bonus

Post 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.
Old_Warrior
Major - Jagdpanther
Major - Jagdpanther
Posts: 1019
Joined: Fri Apr 30, 2010 3:13 am

Re: Script for AI to use bonus

Post 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.
Post Reply

Return to “Battle Academy : Modders Corner ”