Capt Andrew Posted August 19, 2006 Share Posted August 19, 2006 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 ] 0 Quote Link to comment Share on other sites More sharing options...
Retributar Posted August 19, 2006 Share Posted August 19, 2006 Capt Andrew ...Who immediately comes to mind for this type of specialty [scripting] is...Edwin P._Blashy_Honch & Seamonkey . Im sure that some other's are good at it too!, but i just can't think of them at this moment!. [ August 19, 2006, 08:46 AM: Message edited by: Retributar ] 0 Quote Link to comment Share on other sites More sharing options...
Capt Andrew Posted August 23, 2006 Author Share Posted August 23, 2006 Edwin? Seamonkey? Feel like helping take a stab at this while waiting for next patch??? If the coding accepted CASE or IF statements, I could write it... but this is beyond me. 0 Quote Link to comment Share on other sites More sharing options...
SeaMonkey Posted August 23, 2006 Share Posted August 23, 2006 Sorry Capt. I haven't really got into the scripting yet. My mods will come along in a year or two after the platform has stabilized. Having to much fun playing and not enough time for mods, although I have fooled around a little with the map maker. 0 Quote Link to comment Share on other sites More sharing options...
Honch Posted August 23, 2006 Share Posted August 23, 2006 With just a quick glance I would think that you would have to write a separate script for each condition poistion. Just remove the popup text or you may have it popping up several times a turn. 0 Quote Link to comment Share on other sites More sharing options...
Hubert Cater Posted August 23, 2006 Share Posted August 23, 2006 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. 0 Quote Link to comment Share on other sites More sharing options...
Retributar Posted August 24, 2006 Share Posted August 24, 2006 Capt Andrew: SUGGESTION:---Put your Scripting effort up here in this discussion topic, then whom-ever, can take a look at it and make suggestion's, correction's or whatever!. NOTE: Please include in a brief description what you want to be able to do or to accomplish with it!. 0 Quote Link to comment Share on other sites More sharing options...
Capt Andrew Posted August 24, 2006 Author Share Posted August 24, 2006 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 0 Quote Link to comment Share on other sites More sharing options...
Edwin P. Posted August 24, 2006 Share Posted August 24, 2006 Question 2: I don't know of any way to address the AND/OR Naval check as each check (Activate and Cancel) utilizes OR Logic. 0 Quote Link to comment Share on other sites More sharing options...
Capt Andrew Posted August 26, 2006 Author Share Posted August 26, 2006 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? 0 Quote Link to comment Share on other sites More sharing options...
Edwin P. Posted August 26, 2006 Share Posted August 26, 2006 I believe that you cannot add new parameters to existing scripts. Any comments HC? 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.