Helping the AI ... FUNCTION AI_EndTurn()

Modders can post their questions on scripting and more.

Moderators: Slitherine Core, BA Moderators

Post Reply
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Helping the AI ... FUNCTION AI_EndTurn()

Post by Merr »

Pip and Ian,

I'm proposing a new function for the AI .... FUNCTION AI_EndTurn(side, team, me, target).

The script would allow the AI to make a "last minute check" on unit facings before the turn ends.

I think this would help the AI .... I really hate it when the AI leaves his Tiger's butt facing me at the end of it's turn.

The facing direction can be based on which target(player) will hurt me(ai) the most.

Winner?
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

or ... better yet ... make it a wildcard function after EndTurn_???? ...

This way, if you add a trigger to look for "EndTurn" functions, it can run any scripts.

Examples ....

FUNCTION AI_EndTurn_Facing(side, team, me, target) ..... checks facings before ending turn.
FUNCTION AI_EndTurn_Rally(me) .... rallies units before ending turn (if AI has bonus).
FUNCTION AI_EndTurn_Ammo(me) .... recharges units before ending turn (if AI has bonus).

Winner, winner, chicken dinner?

EDIT .... BTW, the above functions are what I do before I end the turn ... lets get the AI to think like me, or rather the player? :wink:
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

Hmm ... I just figured out how to do this ... using reverse logic.

We have the StartTurn function ... Normally we use IF side (1), then perform script for side(1). But, using reverse logic, IF side(0) turn, then perform side(1) script.

Basically, the EndTurn for the AI is the StartTurn for the human ....

Anyway ... I like my EndTurn idea .... but since it can be flip-flopped(logically) .... then disregard (maybe?).

:wink:
pipfromslitherine
Site Admin
Site Admin
Posts: 9937
Joined: Wed Mar 23, 2005 10:35 pm

Post by pipfromslitherine »

Great suggestion - adding to the tasklist right now!

Cheers

Pip
adherbal
The Artistocrats
The Artistocrats
Posts: 3900
Joined: Fri Jun 24, 2005 6:42 pm
Location: Belgium

Post by adherbal »

IIRC there's a function called StartTurnPost which is executed after everything else - that might work for such AI additions?
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

adherbal wrote:IIRC there's a function called StartTurnPost which is executed after everything else - that might work for such AI additions?
Hmmm .... I wonder if adding an AI call in front would be recognized? ... eg FUNCTION AI_StartTurnPost() ...

If so .... then the potential for that function has been staring me in the face all this time! :?:
junk2drive
BA Moderator
BA Moderator
Posts: 1478
Joined: Sun May 23, 2010 4:47 pm
Location: Arizona USA -7GMT

Post by junk2drive »

Merr you have great ideas. Sometimes the trees get in the way of the forest. Glad you bounce them around here. Ideas, not trees.

Edit to add: Another game has option buttons. Armour Facing Rules on/off is one of them since the AI can't use the logic. I makes tanks have the same armour value (frontal) for each angle.
You can call me junk - and type that with one hand.
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

junk2drive wrote: Edit to add: Another game has option buttons. Armour Facing Rules on/off is one of them since the AI can't use the logic. I makes tanks have the same armour value (frontal) for each angle.
I know what game you're thinking off ... I run it the same as you ... for that reason. All those updates and they never touched the AI's logic, which disappointed me.

You know Junk ... you gave me an idea that I'm going to toss in my TrackHit! mod ....

We've all experienced it .... when that Tiger is facing it's rear at me, you can pop it and cross your fingers ... Well, what's the Tiger going to do if he reacts? He'll spin his turret around but leave his butt facing you. So, here's the plan .... I'm going to add a random chance (say 50%) that if the unit reacts it will turn the entire unit (not just the turret) at you. So, you still have a chance to slap him on the butt, but now you have to pray to the "Ream-domizer" and hope the tank won't spin to face you!

The whole point of my TrackHit! mod is to immobilize the tank ... if he can't spin around because he's broken, he's a sitting duck!

You'll see Paul ... you'll see :wink:
junk2drive
BA Moderator
BA Moderator
Posts: 1478
Joined: Sun May 23, 2010 4:47 pm
Location: Arizona USA -7GMT

Post by junk2drive »

I've been playing plenty as US with Shermans that can't seem to get anything but an orange text. I might be happy to see a yellow or white for track hit. Wait till you face a Souma or Char B with a PZIII.
You can call me junk - and type that with one hand.
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

junk2drive wrote:I've been playing plenty as US with Shermans that can't seem to get anything but an orange text. I might be happy to see a yellow or white for track hit. Wait till you face a Souma or Char B with a PZIII.
I didn't add text to show chance to hit or destroy a track ... The text is still based on the units hull facing and armor value.

So, even if the Sherman shows orange text with 0% chance to kill, you might still hit the track/suspension, even more so if you use the AimLow command, which focuses the shot on the lower hull and track.

Yeah, I can't wait for BAF ... thanks for testing it for us!
junk2drive
BA Moderator
BA Moderator
Posts: 1478
Joined: Sun May 23, 2010 4:47 pm
Location: Arizona USA -7GMT

Post by junk2drive »

Teaser for Pip

Image
You can call me junk - and type that with one hand.
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

junk2drive wrote:Teaser for Pip
Junk,

You know .... When you have a moment, I need another button please ... Repair Button ... If you can take the image used for the PLUGIN (from the editor, you know the "tools" looking thing) and shrink it up and make a button, that would be great!

Then my engineer's (and tank crews) can repair track/suspension/engine damage.
I'm going to make the bailed out crews have another purpose besides being cannon fodder :wink:

Thank you sir! PM me when you get a chance ... appreciate ya!

BTW, you know when you move a tank and it "breaks down" ... "We've thrown a track!" .... well, they actually do now ... If you throw it twice you are immobilized ... :shock: ... that is, until you get someone to fix it. Throwing one track aint too bad, max AP will be 8, slows you down a bit .... but annoying ... The definition of "track" can mean any part of the suspension, eg wheel, bolt, screw, etc.
junk2drive
BA Moderator
BA Moderator
Posts: 1478
Joined: Sun May 23, 2010 4:47 pm
Location: Arizona USA -7GMT

Post by junk2drive »

Done
You can call me junk - and type that with one hand.
pipfromslitherine
Site Admin
Site Admin
Posts: 9937
Joined: Wed Mar 23, 2005 10:35 pm

Post by pipfromslitherine »

I can't wait to see the campaign from you guys with all this cool stuff in :).

Cheers

Pip
Merr
Captain - Heavy Cruiser
Captain - Heavy Cruiser
Posts: 903
Joined: Mon Aug 16, 2010 2:00 pm

Post by Merr »

Junk?

Can you move this thread over to Modder's Corner?

I've come up with a plan to make this happen and it should be a modding subject anyway.

Thanks.
Post Reply

Return to “Battle Academy : Modders Corner ”