Jump to content

What is the Script Order? i.e. Which Runs First?


Recommended Posts

Question - I want to write a script so that the French invest one chit in Diplomacy to influence Iraq to activate convoys to the UK. The French will only do this if there is enough MPPs.

So which script spends the MPPs first - Diplomatic, Production, or Research?

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; ALLIED SCRIPTS - France

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;

{

#NAME= France Presses Iraq (1939 - )

; Popup so I can see if the script is activated.

#POPUP= Frances Presses Iraq

#FLAG= 1

; Repeating check until the trigger is statisfied

#TYPE= 1

#COUNTRY_ID= 2

#TRIGGER= 100

#LEVEL= 0

; Country Code for Iraq is 24

#DIPLOMATIC_ID= 24

#DATE= 1939/09/03

; Set friendly positions:

; 1st Line - London

#FRIENDLY_POSITION= 64,15

; Set variable conditions:

; 1st Line - France politically aligned with Allies and not surrendered

#VARIABLE_CONDITION= 2 [2] [100] [0]

; Set tactical conditions:

; 1st Line - Washington D.C. not tactically threatened (dummy condition)

#TACTICAL_CONDITION= 2,23 [3]

; Set dummy activate position (no units at position 0,0)

#ACTIVATE_POSITION= 0,0 [0,0] [0,0] [0]

; Set dummy cancel position (single neutral unit at position 0,0). This is not possible as no

; unit can occupy tile 0,0 so event will not be cancelled due to #CONDITION_POSITION

#CANCEL_POSITION= 0,0 [0,0] [1,1] [0]

}

Link to comment
Share on other sites

Ideally, you could set a script priority so that you could decide which script would run first based on the status of that country.

Example: USSR still neutral and war readiness less than 50%, you probably want the research script to run first, if USSR war readiness is above 50% you probably want the production script to run first.

Example:

Priority= 1[4][50] - Priority is 1 if Russian (4) war readiness is greater or equal to (50)

Priority= 2[4][0] - Priority is 2 is Russian (4) war readiness is greater than (0)

The priority assign is that of the first line encountered whose conditions are met. In the above example the priority would be 1 if Russian war readiness is >= 50.

Just another idea. ;)

Link to comment
Share on other sites

Update - Script Revision Worked!

a. UK Convinced Spain to Join Allies! while Germany was fighting Russia.

Problem: Franco's Spain defended Bilbao, not Madrid!

b. USSR reached level 4 production, 2 Industrial, 4 Armor, 2 Anti-Tank, 2 Infantry

Problem: USSR ended game with 4 chits in Armor and no tanks, and apparently only upgraded tanks throughout the game, not corps or armies.

c. USA ended game with 5 chits in Infantry and Level 3 Infantry.

How can I keep AI from investing in Tech when it has reached maximum limit?

How can I tell AI to reclaim chits when it has reached the maximum limit?

How can I tell AI to only invest in Tech X if it has units that can take advantage of it?

Possible Solutions:

1. Game automatically reclaims tech chits for AI; not humans!, when it reaches the maximum limit

2. Game does not allow AI to purchase chits in a tech area that has reached its maximum.

Other Suggestions

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

3. Parameter (for tech ) is enhanced to include a parameter for the maximum number of chits researching a tech area. This would allow for a script that would purchase chits in say, infantry until it had 3 chits. If it already had 3 chits in this area it would skip this tech research line and go to the next line.

4. Parameter (for tech and diplomacy) is enhanced to include maximum number of chits to purchase at one time. Especially useful after AI Axis conquers France.

[ April 26, 2006, 07:59 AM: Message edited by: Edwin P. ]

Link to comment
Share on other sites

Awesome, it's a good feeling when your scripts actually work...well, the intention of the script anyway. smile.gif

I would definitely like a solution to the 1st two questions you posed. It could really save a lot of much needed MPP's.

The way I do it now is simply give the AI a time-frame to do research (ie the USA between 1939-1941), and whatever they end up getting out of it is what they get. After that the majority of their MPP's will go to production. It still leaves room for waste though, but mostly just for that time frame.

Thanks for the reply HC and looking forward to more info on the AI.

Link to comment
Share on other sites

Originally posted by Jim Mason:

This whole thing is HUGE - thank you for including us in this. This effectively means we can mod the game (or use other mods) to play the way WE want to.

Thanks again.

This was the idea behind the editor, make it as flexible as possible, so that if you like, players can truly make the game their own smile.gif
Link to comment
Share on other sites

Another question on the scripts and script order. Production, for example, has % rates on whether the AI builds that particular unit. So is it entirely possible that the AI would not build ANYTHING if it happens to get a bad roll on the percentages?

In my last game I turned FoW on occassionally and saw, at one time, the US had 600 MPP's and Russia 500. It seemed like they had plenty to spend at times, but it almost looked as if they'd get bad 'rolls' on the percentages and wouldn't produce/research anything.

Link to comment
Share on other sites

I wonder if you can list an item twice, once at the top of the list and another time at the bottom of the list with 100%. This will ensure that if none of the units above it are built then the unit at the end will be, of course that may not leave anything for diplomacy or research.

Example:

#CORPS= 25[2]

.....

#CORPS= 100[5]

As for the bad rolls, I will test it with the Free French, but in a game last night I moved all French units to UK territory and none of the French naval and land units became Free French.

Link to comment
Share on other sites

Originally posted by Timskorn:

Another question on the scripts and script order. Production, for example, has % rates on whether the AI builds that particular unit. So is it entirely possible that the AI would not build ANYTHING if it happens to get a bad roll on the percentages?

In my last game I turned FoW on occassionally and saw, at one time, the US had 600 MPP's and Russia 500. It seemed like they had plenty to spend at times, but it almost looked as if they'd get bad 'rolls' on the percentages and wouldn't produce/research anything.

This is an intentional sideffect because otherwise the AI would only make purchases and never have funding for other spending items such as Research, Diplomacy and/or Upgrades. Also, by not making purchases all the time it gives the AI the chance to purchase higher priced items once in a while as it is in effect saving up. Not a perfect system mind you but effective enough for now without further complications. Also, you could force more typical behaviour with more specific scripts, i.e. 100% for certain purchases up to a certain date and so on for other areas like Research, Diplomacy etc.
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...