Author Topic: Default QB AI  (Read 1342 times)

Offline JimmyB76

  • Posts: 6423
  • Cookies: 421
Default QB AI
« on: January 16, 2009, 11:55:05 AM »
ok this was something i had always been curious about...  i think i asked this before, but i dont quite recall; it might have been in a PM or MSN convo lol

anyway, when setting up QB, there is the option to set up the AI for the non-player ship being chosen...
personally, i never have chosen Low or Medium (does anyone actually choose those?); i always choose High...

so i wanted to make that the "default" AI, so it is one less thing to click on when choosing ships...

i think that function is controlled in the Quickbattle script, but im not too sure...
this is what i did
Code: [Select]
g_iSelectedAILevel = AI_HIGH
under the section # These initial values are mirrored in Initialize().

and then
Code: [Select]
pHigh = CreateFloatButton(g_pMissionDatabase.GetString("High"), ET_SELECT_AI, AI_HIGH, g_pXO)

g_pAIMenu.AddChild(pHigh)
pHigh.SetChosen(1)
under the section def GenerateAIMenu():

but it doesnt seem to generate the effect i was looking for...  i dont think im getting it correct lol
when QB loads, and i select a ship, "High" is highlighted but it looks like it is still choosing "Low" as default...
is there something else im missing? 

i mean, its not a major task to click "High" for the ships AI when i choose ships, but it would be easier (lazier? lol) if i could just choose the ships from the QB menus for friendly/enemy and not have to assign their AIs; it would be nice just to have all the default AI levels be "High" without having to think about it...

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Default QB AI
« Reply #1 on: January 16, 2009, 12:04:14 PM »
There are 3 places where that global is set to medium, one place you already found, the other is on line 487 (InitGlobals), and yet another is on line 2451 (CreateAIMenu).

I think that would give you what you wanted. But I can't guarantee for sure.
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.

Offline JimmyB76

  • Posts: 6423
  • Cookies: 421
Re: Default QB AI
« Reply #2 on: January 16, 2009, 01:18:34 PM »
ok i think ive found them...

i am curious tho - even tho High is highlighted, but why does the vertical line indicate that "Low" is selected (before i choose anything)?  thats what always annoys me...  it makes me feel that "Low" will be selected if i dont choose anything...

also - what does g_iCurrentAILevel = -1 mean, as far as -1 goes?

it would be nice just to do away with that whole stupid AI list/menu anyway, since i never bother choosing anything other than "High" AI lol   but i imagine that wouldnt be very easy to do, if at all?

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Default QB AI
« Reply #3 on: January 16, 2009, 01:34:07 PM »
The yellow bar denotes focus, meaning if you press up or down or space it will apply it on that.

Look at the first screenshot of my "I ATE'NT DEAD" thread, you will see 3 yellow bars.

As for your questions, I have not seen an use for g_iCurrentAILevel in QuickBattle.py.
And to set it always to High regardless of what you chose:

Replace g_iSelectedAILevel with AI_HIGH on lines 2863 and 2993.
Now it (should) always be high regardless of what you have chosen.
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.