Scripting SC3

Please post here for questions and discussion about modding for Strategic Command.
Post Reply
User avatar
Gilber
Posts: 253
Joined: Wed Jun 13, 2018 10:16 am
Location: Luxembourg

Scripting SC3

Post by Gilber »

SC3 is a very good game [;)] with a huge potential but the AI remains very limited. That's why I try to master Scripting.
I started writing scripts to improve Poland's defence but I'm having trouble.
I can't get the IA to abandon a city.
Obviously the AI chosen even if no Guard script exists to defend cities
How to prohibit the IA to defend a city and have a specific unit retreat to assign it to the defense of another area or city.
I can't specifically select an army to specifically defend a hex or city. For example how to evacuate the garrisons from The Fortress of Modlin and Warsaw and replace them with Armies.
I haven't found the possibility to make a unit move that only concerns a specific type of unit such as artillery.


Gilles
User avatar
BillRunacre
Posts: 5889
Joined: Mon Jul 22, 2013 2:57 pm
Contact:

RE: Scripting SC3

Post by BillRunacre »

Hi

If there are only a few occasions where you want this to happen, then you could use a Loop script to remove the unit from its position, moving it somewhere else, and have a Unit script to deploy the unit you want there. Or leave out the latter when you just want the place to be evacuated.

Bill
Follow us on Twitter: https://twitter.com/FurySoftware

We're also on Facebook! https://www.facebook.com/FurySoftware/
User avatar
Gilber
Posts: 253
Joined: Wed Jun 13, 2018 10:16 am
Location: Luxembourg

RE: Scripting SC3

Post by Gilber »

Hello Bill,

Thank you so much for your help.
I'll use your solution.
I'm starting to understand better how Scripts work. To test the scripts I play the AI player by removing the FoW, to see the movements of the AI. At the beginning of the scenario (the AI plays the allies) the AI sends an aircraft carrier to attack the German fleet. This is not a good idea because this carrier can be very easily destroyed.
What solution to limit potentially inappropriate IA initiatives?
How are IA priorities determined?
For example, if a fleet has a Fleet mission and discovers an enemy unit on its way, it continues its path, it attacks if the balance of power is favorable, it attacks in all cases.
Anyway congratulations for the designers of this remarkable game.
Gilles

Gilles
User avatar
Gilber
Posts: 253
Joined: Wed Jun 13, 2018 10:16 am
Location: Luxembourg

RE: Scripting SC3

Post by Gilber »

Watching the AI play the Allies in the France 39-40 campaign. at one point the AI moved the English bomber group to the front line (it was suicidal). it is exactly a situation where it would be necessary to be able to manage thanks to the scripts the movements (normal movement and Operate Movement) by unit type. Loop scripts work well, but it's not really managing them by unit type and/or taking into account travel limits (cost and distance)[8|]

Gilles
Gilles
User avatar
Hubert Cater
Posts: 5875
Joined: Mon Jul 22, 2013 11:42 am
Contact:

RE: Scripting SC3

Post by Hubert Cater »

ORIGINAL: Gilber

Hello Bill,

Thank you so much for your help.
I'll use your solution.
I'm starting to understand better how Scripts work. To test the scripts I play the AI player by removing the FoW, to see the movements of the AI. At the beginning of the scenario (the AI plays the allies) the AI sends an aircraft carrier to attack the German fleet. This is not a good idea because this carrier can be very easily destroyed.
What solution to limit potentially inappropriate IA initiatives?
How are IA priorities determined?
For example, if a fleet has a Fleet mission and discovers an enemy unit on its way, it continues its path, it attacks if the balance of power is favorable, it attacks in all cases.
Anyway congratulations for the designers of this remarkable game.
Gilles


Hi Gilber,

In this case the AI will attack if it is favourable to do so, and then it should after the fact try and continue on to its original FLEET scripted mission.

Hope this helps!
Hubert
User avatar
Gilber
Posts: 253
Joined: Wed Jun 13, 2018 10:16 am
Location: Luxembourg

RE: Scripting SC3

Post by Gilber »

Hello Huber,

there may be a bug in Fleet scripts.[&:]
When you make a script with multiple #FRIENDLY_POSITION, it seems to take only the first one, but I think it takes the #GOAL_POSITION as a #FRIENDLY_POSITION.
Look at the script in the attached Flie.
It works for #RANGE= 1 and we see an error for #RANGE= 2

Gilles
Attachments
fleet.txt
(849 Bytes) Downloaded 3 times
Gilles
User avatar
Gilber
Posts: 253
Joined: Wed Jun 13, 2018 10:16 am
Location: Luxembourg

RE: Scripting SC3

Post by Gilber »

Hello,

I have a fleet script that moves a submarine, the full range for a sub is 20 tiles, the problem is that the submarine with the script moves only 10 tiles per turn.
is it normal ?,is there a way to change the speed?
and can we change the mode (silent/raider)
thanks for your help

Gilles
Gilles
User avatar
Gilber
Posts: 253
Joined: Wed Jun 13, 2018 10:16 am
Location: Luxembourg

RE: Scripting SC3

Post by Gilber »

Hi all,
Can anyone tell me how the #SKIP_FUNDS_CHECK= in Purchase Script works?
Thanks for your help

Gilles
Gilles
User avatar
Hubert Cater
Posts: 5875
Joined: Mon Jul 22, 2013 11:42 am
Contact:

RE: Scripting SC3

Post by Hubert Cater »

AI naval units do not move with naval cruise and subs will default to move at the slower Silent speed if the weather is bad, otherwise the normal full range of movement minus the extra range of naval cruise.
User avatar
Hubert Cater
Posts: 5875
Joined: Mon Jul 22, 2013 11:42 am
Contact:

RE: Scripting SC3

Post by Hubert Cater »

ORIGINAL: Gilber

Hi all,
Can anyone tell me how the #SKIP_FUNDS_CHECK= in Purchase Script works?
Thanks for your help

Gilles

This is just a way to force a particular research category to be researched by the AI, i.e. regardless of whether funds are available. It can be abused so use it carefully when scripting for the AI!
User avatar
Gilber
Posts: 253
Joined: Wed Jun 13, 2018 10:16 am
Location: Luxembourg

RE: Scripting SC3

Post by Gilber »

Hubert, Thank you very much for your answers.
I think I understand #TYPE= 0 #TYPE= 1 and #TYPE= 2
and I use #TYPE= 1 and #TYPE= 2 regularly
but I'm not sure I got it right #TYPE= 3
anyone have any examples?

Gilles
Gilles
User avatar
Gilber
Posts: 253
Joined: Wed Jun 13, 2018 10:16 am
Location: Luxembourg

RE: Scripting SC3

Post by Gilber »

Hi all,

I encountered some strange results trying to make a dummy decision script.
I have two exactly identical scripts except for the parameter #DECISION, 167 for one and 168 for the other.
In order to check the result I have 2 Popup scripts to check the AI response. The Allied player is played by AI.

Although strictly identical only the popup of decision 167 is displayed.
I know that in all cases the IA's answer is yes because the text of #AI_RESPONSE_POPUP= in decision script is displayed.
But the popup from decision 168 is not displayed.
It is displayed if I change type parameter (#TYPE= 2 to #TYPE= 1) of the decision 168 script then the popup is displayed.
If I change the 167 script that works by changing only the number to 168 or 170 the associated popup script no longer works, whereas it works if I choose 166 or 165 for the parameter #DECISION.
On the other hand if I change type parameter (#TYPE= 2 to #TYPE= 1) in decision script all popup scripts are displayed correctly.
I've been on this problem for over a week, I've tried dozens of cases without finding the explanation.

Hubert, I'd really appreciate it if you could help me.

Here are the scripts :

Decision SCRIPT

{
#NAME= DE 167
#POPUP=
#IMAGE=
#SOUND=
#FLAG= 1
#TYPE= 2
#AI= 0
#LEVEL= 0
#GV= 1[1,100]
#LINK= 0[0]
#COUNTRY_ID= 112
#TRIGGER= 100
#DISPLAY_ORDER= 0
#DECISION= 167
#MPP_UPDOWN= 0
#MPP_TURNS= 0
#MPP_TEXT=
#NOTES=
#NOTES_POSITION=
#AI_RESPONSE= 100
#AI_RESPONSE_POPUP= DE 167
#DATE= 1939/09/01
#TEXT_RGB= 0,0,0
#SHADOW_RGB= 0,0,0
#ALIGNMENT_POSITION= 144,71 [2]
; 144,71 = Leeds
#NATIONAL_MORALE_TRIGGER= 0 [0]
#VARIABLE_CONDITION= 45 [1] [100] [0]
#CONDITION_POSITION= 0,0 [0,0] [0,0] [0] [0]
}

{
#NAME= DE 168
#POPUP=
#IMAGE=
#SOUND=
#FLAG= 1
#TYPE= 2
#AI= 0
#LEVEL= 0
#GV= 1[1,100]
#LINK= 0[0]
#COUNTRY_ID= 112
#TRIGGER= 100
#DISPLAY_ORDER= 0
#DECISION= 168
#MPP_UPDOWN= 0
#MPP_TURNS= 0
#MPP_TEXT=
#NOTES=
#NOTES_POSITION=
#AI_RESPONSE= 100
#AI_RESPONSE_POPUP= DE 168
#DATE= 1939/09/01
#TEXT_RGB= 0,0,0
#SHADOW_RGB= 0,0,0
#ALIGNMENT_POSITION= 143,74 [2]
; 143,74 = Birmingham
#NATIONAL_MORALE_TRIGGER= 0 [0]
#VARIABLE_CONDITION= 45 [1] [100] [0]
#CONDITION_POSITION= 0,0 [0,0] [0,0] [0] [0]
}




POPUP Script


{
#NAME= 167
#POPUP= 167 0
#IMAGE= germanystartmessage.png
#SOUND= teletype_1.ogg, teletype_2.ogg
#FLAG= 1
#TYPE= 2
#AI= 4
#LEVEL= 0
#GV= 1[1,100]
#LINK= 167[0]
#COUNTRY_ID= 45
#TRIGGER= 100
#PRIVATE= 1
#DISPLAY_ORDER= 1
#DISPLAY_TURN= 1
#DISPLAY_STYLE= 1
#DATE= 1939/09/01
; Berlin is in Axis hands
#ALIGNMENT_POSITION= 173,74 [1]
; 1st Line - Germany politically aligned with Axis and not surrendered
#VARIABLE_CONDITION= 45 [1] [100] [0]
#CONDITION_POSITION= 0,0 [0,0] [0,0] [0] [0]
}



{
#NAME= 167
#POPUP= 167 1
#IMAGE= germanystartmessage.png
#SOUND= teletype_1.ogg, teletype_2.ogg
#FLAG= 1
#TYPE= 2
#AI= 4
#LEVEL= 0
#GV= 1[1,100]
#LINK= 167[1]
#COUNTRY_ID= 45
#TRIGGER= 100
#PRIVATE= 1
#DISPLAY_ORDER= 1
#DISPLAY_TURN= 1
#DISPLAY_STYLE= 1
#DATE= 1939/09/01
; Berlin is in Axis hands
#ALIGNMENT_POSITION= 173,74 [1]
; 1st Line - Germany politically aligned with Axis and not surrendered
#VARIABLE_CONDITION= 45 [1] [100] [0]
#CONDITION_POSITION= 0,0 [0,0] [0,0] [0] [0]
}


{
#NAME= 168
#POPUP= 168 0
#IMAGE= germanystartmessage.png
#SOUND= teletype_1.ogg, teletype_2.ogg
#FLAG= 1
#TYPE= 2
#AI= 4
#LEVEL= 0
#GV= 1[1,100]
#LINK= 168[0]
#COUNTRY_ID= 45
#TRIGGER= 100
#PRIVATE= 1
#DISPLAY_ORDER= 1
#DISPLAY_TURN= 1
#DISPLAY_STYLE= 1
#DATE= 1939/09/01
; Berlin is in Axis hands
#ALIGNMENT_POSITION= 173,74 [1]
; 1st Line - Germany politically aligned with Axis and not surrendered
#VARIABLE_CONDITION= 45 [1] [100] [0]
#CONDITION_POSITION= 0,0 [0,0] [0,0] [0] [0]
}



{
#NAME= 168
#POPUP= 1681
#IMAGE= germanystartmessage.png
#SOUND= teletype_1.ogg, teletype_2.ogg
#FLAG= 1
#TYPE= 2
#AI= 4
#LEVEL= 0
#GV= 1[1,100]
#LINK= 168[1]
#COUNTRY_ID= 45
#TRIGGER= 100
#PRIVATE= 1
#DISPLAY_ORDER= 1
#DISPLAY_TURN= 1
#DISPLAY_STYLE= 1
#DATE= 1939/09/01
; Berlin is in Axis hands
#ALIGNMENT_POSITION= 173,74 [1]
; 1st Line - Germany politically aligned with Axis and not surrendered
#VARIABLE_CONDITION= 45 [1] [100] [0]
#CONDITION_POSITION= 0,0 [0,0] [0,0] [0] [0]
}



Gilles
Gilles
User avatar
BillRunacre
Posts: 5889
Joined: Mon Jul 22, 2013 2:57 pm
Contact:

RE: Scripting SC3

Post by BillRunacre »

ORIGINAL: Gilber

Hubert, Thank you very much for your answers.
I think I understand #TYPE= 0 #TYPE= 1 and #TYPE= 2
and I use #TYPE= 1 and #TYPE= 2 regularly
but I'm not sure I got it right #TYPE= 3
anyone have any examples?

Gilles

Hi Gilles

The Afrika Korps scripts are #TYPE= 3 and this setting should only be used when you want the engine to check on a specific date for something to fire, or not.

So this means that the Afrika Korps scripts can only ever fire on the date in question, whereas #TYPE= 1 and #TYPE= 2 could fire at any time once their own date has been reached and the trigger conditions met.

Bill
Follow us on Twitter: https://twitter.com/FurySoftware

We're also on Facebook! https://www.facebook.com/FurySoftware/
User avatar
BillRunacre
Posts: 5889
Joined: Mon Jul 22, 2013 2:57 pm
Contact:

RE: Scripting SC3

Post by BillRunacre »

In terms of the dummy decisions, I noticed that the #ALIGNMENT_POSITION= are not identical.

Whether that is the answer I'm not sure though? Reasoning being that it could only be the cause if the Germans are in Britain.
Follow us on Twitter: https://twitter.com/FurySoftware

We're also on Facebook! https://www.facebook.com/FurySoftware/
User avatar
Gilber
Posts: 253
Joined: Wed Jun 13, 2018 10:16 am
Location: Luxembourg

RE: Scripting SC3

Post by Gilber »

Bill a big thank you for your answer.
you're right the scripts aren't quite identical.
let's take a completely identical case.
I did it again this morning by taking the standard version of storm over europe.
I replaced in the decision scripts the script DE 167 and added the script Popup 167 in the POPUP scripts like the scripts written below.

I run the game in campaign mode. With the Allied player playing through AI.
the Popup script works and the message appears at the end of the first round.
If now I change the Decision and Popup script from 167 to 168 and restart a campaign with exactly the same settings, the popup message is not displayed.


{
#NAME= DE 167
#POPUP=
#IMAGE=
#SOUND=
#FLAG= 1
#TYPE= 2
#AI= 0
#LEVEL= 0
#GV= 1[1,100]
#LINK= 0[0]
#COUNTRY_ID= 112
#TRIGGER= 100
#DISPLAY_ORDER= 0
#DECISION= 167
#MPP_UPDOWN= 0
#MPP_TURNS= 0
#MPP_TEXT=
#NOTES=
#NOTES_POSITION=
#AI_RESPONSE= 100
#AI_RESPONSE_POPUP= DE 167
#DATE= 1939/09/01
#TEXT_RGB= 0,0,0
#SHADOW_RGB= 0,0,0
#ALIGNMENT_POSITION= 144,71 [2]
; 144,71 = Leeds
#NATIONAL_MORALE_TRIGGER= 0 [0]
#VARIABLE_CONDITION= 45 [1] [100] [0]
#CONDITION_POSITION= 0,0 [0,0] [0,0] [0] [0]
}


{
#NAME= 167
#POPUP= 167 1
#IMAGE= germanystartmessage.png
#SOUND= teletype_1.ogg, teletype_2.ogg
#FLAG= 1
#TYPE= 2
#AI= 4
#LEVEL= 0
#GV= 1[1,100]
#LINK= 167[1]
#COUNTRY_ID= 45
#TRIGGER= 100
#PRIVATE= 1
#DISPLAY_ORDER= 1
#DISPLAY_TURN= 1
#DISPLAY_STYLE= 1
#DATE= 1939/09/01
; Berlin is in Axis hands
#ALIGNMENT_POSITION= 173,74 [1]
; 1st Line - Germany politically aligned with Axis and not surrendered
#VARIABLE_CONDITION= 45 [1] [100] [0]
#CONDITION_POSITION= 0,0 [0,0] [0,0] [0] [0]
}


Gilles
Gilles
User avatar
Gilber
Posts: 253
Joined: Wed Jun 13, 2018 10:16 am
Location: Luxembourg

RE: Scripting SC3

Post by Gilber »

hoping it might help, I uploaded a file with scripts (but I'm not sure I did the right thing)

Gilles
Attachments
Sauvegarde..mporaire.txt
(1.02 KiB) Downloaded 2 times
Gilles
Post Reply

Return to “Scenario Design and Modding”