Jump to content

Suggestions for Script Enhancements


Recommended Posts

A compliation of suggestions for improving the scripts in SC2.

-------------------------------------

1. Plan: Garrison

Add parameter for unit type, as one may want an armor unit or army to garrison a city if one is available. The default would be zero, 0, any type.

#GOAL_POSITION= 124,56[0]

-------------------------------------

2. Research Plan

Add parameters for maximum number of chits to have in a research area. Program will not purchase additional chits in an area if the chits researching a tech is equal to or greater than the Max_Chits in Research area value. And it will only purchase enough additional chits to reach the Max_Chits in Research area value if a number is in the Max_Chits to Purchase parameter.

Format: % chance assigned to this purchase [max_chits to purchase][Max_chits in research area]

---------------------------------------

3. Diplomacy Plan

Add parameter for purchasing more than one chit at a time and settings for maximum number of chits to be invested in diplomacy for a country.

; #DIPLOMATIC_ID= Country ID targeted in the diplomatic event[Max Chits to Purchase at One Time] [Max_chits invested in influencing a county]

-----------------------------------------------

4. Plan: Offensive or Amphibious

Add parameter for minumum number of HQ units to accompany offensive or amphibious force of Size= . The plan would not trigger until the number of HQ units is available.

Example: For USA invasion of France or North Africa

HQ= 1

Example: For Raid on Brest which Axis left unguarded or Transport Plan

HQ= 0

Why: AI currently invades France without sending in an accompanying HQ unit. The unsupplied units are eliminated by the Axis forces.

--------------------------------------

[ April 26, 2006, 09:10 AM: Message edited by: Edwin P. ]

Link to comment
Share on other sites

5. Global Plan Variables for each side/nation so that script activation can be coordinated.

Step 1: Set Global Variable

Implementation Idea 01:

Format: #Global= %chance[plan_ID]

Example:

Global= 20[1]

Global= 20[2]

Global= 50[3]

Global= 80[4]

Implementation Idea 02:

Format: #Global= Plan Id[percent low, percent high] where the range for all plans must not overlap and cover from 1 to 100

#Global= 1[1,20]

#Global= 2[21,75]

#Global= 3[76,100]

Thus if the randomly generated number is 56 the AI will set the Global Variable to 2.

Of the two options I prefer the second one as it is easier to understand the chance of each strategy being selected.

Step 2: Add this variable to the AI scripts

Essentially, each AI script will have a command line for #GLOBAL= XX; which is the global plan variable. If the #GLOBAL= matches the Global Variable the script will activate.

Thoughts - Should the Global Variable be for Each Side or For Each Nation? There are many implications to this decision.

If for each nation you can easily program a specific strategy for Russia for example, if for each side it becomes a bit more complex.

Or perhaps Global Variables for Each Major Nation and for Each Side - 8 Global Variables in all, which can be activated or triggered based on specific events.

[ April 26, 2006, 09:48 PM: Message edited by: Edwin P. ]

Link to comment
Share on other sites

6. Convoy Plan - Adjusting MPPs Sent via Convoy

Format: #Convoy= CountryID [%][% damage at which convoy stops, number of consecutive turns during which damage is incurred][stop convoy for min, max turns]

#Convoy= 3[40][50,2][1,3]

For USA send 40% of MPPs, if convoy loses are 50% or more for 2 turns then stop sending MPPs for 1 to 3 turns.

This would allow the AI to adjust the amount of MPPs sent via convoy and respond to Axis submarine activity.

Link to comment
Share on other sites

7. Operational Movement Plans

Why? To send air units to Egypt or Malta or evacuate Air Units from Egypt to UK.

Unit_Type= XX[quantity]

Goal_Position=

8. Naval_Transport via Loop

Add a command to allow naval transports to use the loop as a waypoint to their destination.

Format: #LOOP= 1[XX,YY]; where 1 is for use loop, 0 is for do not use loop around the Horn of Africa & xx,yy is the location of the loop tile.

Examples:

#LOOP= 0[0,0]

#LOOP= 1[50,16]

Link to comment
Share on other sites

9. Plan Priority

As noted by another poster the AI will sometimes abandon the defense of a key city; Berlin, to respond to a threat in Romania.

Plans should be assigned a priority that the AU can use to weigh what to defend.

In the example below if both sites; Berlin and Bucharest are threatened then the AI will give priority to Berlin.

Format= #Priority= XX ; where the priority is a number from 0 to 99 and a higher number reflects a higher priority.

Example:

Berlin Garrison Script

#Priority= 99

Bucharest Garrison Script

#Priority= 80

Link to comment
Share on other sites

11. Diplomacy Bonus for AI

Script to Give AI a bonus number of diplomacy chits in a specified country, this may vary according to AI level.

#Level=3 (Intemediate AI)

#Diplomacy_Bonus= 20[5][1][3] (20% German AI receives 1 bonus chit in USA

#Diplomacy_Bonus= 10[5][1][4] (10% German AI receives 1 bonus chit in USSR

12. Tech Bonus for AI

Script to Give AI a bonus number of tech chits in a specified tech area, this may vary according to AI level.

[ May 02, 2006, 04:35 PM: Message edited by: Edwin P. ]

Link to comment
Share on other sites

#9 I would say the current system is set up already to essentially do this. The key is scripting when to activate and cancel these scripts. If there is a script to garrison Romania, it should be cancelled if city x and y are currently occupied by the enemy, or if both should be garrisoned at the same time the cancel effects shouldn't overlap each other (which I think is happening now, causing it to ping pong).

Link to comment
Share on other sites

You are correct, if Berlin or Munich is threatened the other garrison scripts should cancel. Which means, I should probably go in and adjust the cancel conditions for all Allied and Russian Scripts.

Question - a number of scripts check for an Axis unit at a specified range 3,3. Shouldn't they be checking for Axis units within a range 1,3?

Link to comment
Share on other sites

Yeah the Russian ones espeically! They're basically set to 'loop' and turn on/off depending on the conditions, which can cause units to move back and forth constantly if two different cities are threatened/become unthreatened at the same time.

For the question I've seen that too Edwin, and I think you might be right. What I've been assuming is that it's impossible to get 2 or more units within a 'range' at the same time so that it would overshoot the min/max. If you were checking for 2,2 units within 1 tile of Moscow, it's impossible to move three units next to Moscow at the same time as even the AI moves 1 unit at a time. But...I think I'm wrong, as the AI probably checks the script AFTER your turn, rather than during it, in which case there could be 6 units next to Moscow when it checks the script and the 2,2 condition would NOT be met. However, when I did RTS scripting, we'd always di min/maxes of 2 and 99, for example, or even 99999 to ensure you'd just need at least 2 to meet the condition and anything over is fine too.

Hubert, could you clarify why it's like that in the scripts? If the min/max is 3, and at the end of my turn have 4 units within the script range, I assume now that the condition will not be met?

Link to comment
Share on other sites

The min/max parameter is just a way to create variability for these scripts, for example with [1,3], will the current script check for 1 unit (minimum) within range of Moscow or does it at least need 3 units (minimum) within range of Moscow. In this case if you exceed the maximum (3) then this script line will always be satisfied.

Essentially each time the event is checked it looks for a new value between 1 and 3 to see if this number of units (minimum) is within range of Moscow.

Link to comment
Share on other sites

13. Trigger if MPPs in Bank > XXX

In playing several games I have come across cases where the AI has 1000+ MPPs in the bank.

It would be helpful if the AI could have a parameter that would trigger a script if the bank balance exceeded a specifed amount.

Example:

#Bank= 0 (default)

Example:

Normal Script - Builds 1 of each unit type:

#Trigger=100

#Bank= 0

#Infantry= 20 [1]

#Army= 15 [1]

Bank Script for excessive cash - build lots of units, if AI has accumulated an excessive amount of MPPs:

#Trigger= 100

#Bank= 1000

#Infantry= 100 [10]

#Army= 100[5]

Link to comment
Share on other sites

Edwin: I've found that in my recent games the AI (US and Russia) have had excessive funds as well. What I've been doing is finding the approximate month/year that either side begins accumulating this much and placing in a new production plan starting around that time. Once 1943 hits, for example, I increase the odds by 5% or so of producing Corps/Army/Tanks and also increasing the # they produce by 2. It's not perfect but it'll ensure if the AI purchases tanks, they'll buy up to 5 at a time if they have the funds.

Link to comment
Share on other sites

Timskorn: I've been doing the same thing. Essentially using a production routine that triggers once a year (by having it start at a date and having another normal production script that activate a month later.) My guess is that after HC fixes the upgrade bug that this will largely disappear as the AI will spend MPPs on upgrading its units.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...