Jump to content

need scripting help please


Recommended Posts

Okay you script wizards, I'm officially befuddled and need help writing this script. I don't think what I'm trying to do is limited by Hubert's scripting, I think it's just a lack of know-how on my part. PLEASE HELP!

WHAT I'M TRYING TO DO: Re-write the Malta Effect script (Discussing the Tripoli/El Agheila script only here)

I want to check the number of naval and air units within 4 tiles of 84,31. Unfortunately, as the source position is a sea tile, it only checks water tiles! :eek: But I also want to check the Palermo AND Tripoli, and the immediate tiles next to them! #CONDITION POSITION is only an OR function... how would I write this with AND logic????!!!!

I'm also trying to keep this check flexible so I was hoping to check for a TOTAL number of naval AND/OR air units (IE- 4 Total Units: 3 navy, 1 air OR 2 navy, 2 air, OR 1 navy, 3 air OR 4 navy OR 4 air) I couldn't figure out how to do this. I understand that this means I'll be using #CONDITION POSITION here too, which uses the OR logic. But how in the heck do I write that, especially considering the source tile determines what will be scanned!? :confused:

Further adding to my misery, I'm trying to scale the Malta Effect trigger percentage based on the total number of Axis air/naval units in these areas. IE - 4 total units, zero percentage trigger. 3 total units, normal percentage is halved (5%). 1-2 units, normal percentage(10%). Zero units, 2 1/2 times normal percentage (25). So how in the heck do I do this? Does this mean four separate scripts?

Any/all help is very much appreciated. Here is an example of what I have so far:

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

; Malta limits Axis supply in the Mediterranean

; Script checks for the number of Axis naval or air units near Malta

; The number of units affects the percentage chance of the Malta Effect firing

{

#NAME= Malta Effect (Tripoli, El Agheila)

#POPUP= Malta Hinders Axis Supply In the Mediterranean (Tripoli, El Agheila)

#FLAG= 1

; Reoccuring check every turn

#TYPE= 2

; Supply affected is UK

#COUNTRY_ID= 1

; 5% chance per turn that Malta Effect will trigger

#TRIGGER= 5

; All seasons

#SEASON_FLAG= 0

; Set variable conditions:

; Date condition removed

; Script goes into effect when Italy politically aligned with Axis and not surrendered

#VARIABLE_CONDITION= 6 [1] [100] [0]

; Malta occupied by any UK unit

#SOURCE_POSITION= 85,30 [14]

; Tripoli port reduced by a minimum 2, maximum of 3

#DESTINATION_RESOURCE= 81,33 [2,3]

; Tripoli city

#DESTINATION_RESOURCE= 82,34 [2,3]

; El Agheila city

#DESTINATION_RESOURCE= 92,35 [2,3]

; Axis have at least 3 naval units within four tiles of 84,31

#CONDITION_POSITION= 84,31 [1,4] [3,3] [1] [0]

; OR Axis have 3 air units on Sicily near Palermo

#CONDITION_POSITION= 84,28 [1,2] [3,3] [1] [0]

; OR Axis have 3 air units in North Africa near Tripoli

#CONDITION_POSITION= 81,33 [1,2] [3,3] [1] [0]

}

[ August 19, 2006, 07:05 AM: Message edited by: Capt Andrew ]

Link to comment
Share on other sites

Capt Andrew, scripts are read in the event order they are listed so you can certainly write up more than one script and just list them in order of preference.

For example lets say you wanted to scale the % impact based on the number of units relative to a given tile... then in this case start with an event that checks for 4-5 units first and then a subsequent event for 2-3 units etc.

For the question on the script logic unfortunately only the OR logic is used for the SUPPLY script.

Link to comment
Share on other sites

Good suggestion Retributar. My effort to date is limited to the first post. I got stuck and came here for help. If I do get this to work, I'll post the entire script(s) for folks to play with. My goal is to encourage a more historical representation of the action around Malta by forcing the Axis powers to dedicate units (such as the Italian navy and Luftwaffe) to negate the Malta Effect. I think this will also help some play balance complaints about the Italian navy. Of course, if it is every up and working, someone will have to write some AI scripts on this too!

Thanks for posting on this Hubert, I know you are busy!!! I can write two separate scripts for the Malta Effect then. One for Tripoli and the other for Tobruk, each .txt script file having separate events listed in the order I want them checked - right? That helps. But I do have two questions:

Question 1: Does the #CONDITION POSITION function check in order as well? Meaning, that as soon as one of the OR conditions is true, the script will fire off? And 1a, I can mix Supply and Activation functions in the same script, right?

Question 2: Do you (or anyone else) have a suggestion for me to start with when addressing the air AND/OR naval unit check? This one has me stumped. IE- 4 Total Units comprising of 3 navy, 1 air OR 2 navy, 2 air, OR 1 navy, 3 air OR 4 navy OR 4 air

Link to comment
Share on other sites

I'll add another question, although it relates to both the new script editor as well as my questions here.

Using the 1.03 Extra SC Script Editor, how do I add a parameter not already present? Using my Malta script above, how do I add the #CONDITION POSITION parameter to a newly made "supply" script. OR adding the #SOURCE POSITION and #DESTINATION RESOURCE parameters to an "Activation 2" script?

Or is it not possible to mix/match parameters and I'm just beating my head against a wall?

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...