Drone Carrier Software 2 (DCS2) v2.07a

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

foxtrot76
Posts: 75
Joined: Fri, 12. Mar 10, 21:44

Post by foxtrot76 »

DrBullwinkle wrote: We discussed this recently.

1) Why do you want to change weapons and equipment? What changes would you make?

2) Even if you could choose weapons, that would not help you with having two sets of weapons. Under what conditions would you ever want to swap weapons on a fighter?

3) The choice of weapon doesn't matter much to fighters. SHIELDS matter; not weapons.

Theoretically, I could allow customization in the t file, as with bombers. But I have other things on the To-Do List. Which brings us back to question 1: Why do you want to do it?
To answer your question:

1) The main reason is compatibility of your script with anything that changes weapons and/or equipment in general and for the foreseeable future. This way you wouldn't have to adapt your script to any popular mods already existing or yet to come. As an additional bonus being able to choose the layout of guns+equipment let's your drones adapt to any play-style such as setting up individual carriers with drones with ion guns just to suppress shield for the sole purpose of boarding/pirating; or having slow speed high damage weapons when you have a specialized carrier just for anti-capital ship killing.

Maybe someone will adapt or write something similar to MARS which will make your drones function as missile defence (like goblins) or selective loot collection (with specific software/hardware requirements) etc. (just a few examples)

2) Well actually CODEA has a weapon swapping part where it chooses mainguns/turret before launching fighters depending on the target. So if it's sending fighters to kill fighters it will mount fast speed guns instead of slow ones for bigger targets. Also some scripts such as smart turrets, will handle maingun weapon swapping significantly increasing the effectiveness of fighters. IF you haven't tried this yet you're in for a nice surprise!

Also consider that (maybe in the future) it might become interesting spawning M6's such as from those carriers which have slots (terran carrier can't remember the name) for them or even weapon platforms. In this case choosing the weapon layout becomes even more important.

3) I can agree with you to a certain degree, it's true that functionally it doesn't really matter since your objective is automatic carrier defence yet your script is laying the groundwork already now for very popular scripts to function way better. Therefore flexibility ensures this function also for future mods without you having to "adapt" it every time. Also the beauty of X games is that there is no "right" way to play them thus many unique strategies emerge (hence one of the reasons X:R is in such poor shape).

I sincerely believe that adding this kind of flexibility to your script will ultimately reduce the amount of maintenance work you will be doing while increasing compatibility with other mods people currently use and will use in the future. Your script deserves this kind of longevity since it really is becoming a "must have" along with other very popular scripts/mods. Just my 2 cents
Last edited by foxtrot76 on Wed, 18. Dec 13, 11:29, edited 1 time in total.
User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle »

foxtrot76 wrote:Your script deserves this kind of longevity since it really is becoming a "must have" along with other very popular scripts/mods. Just my 2 cents
Thank you.

Part of the philosophy of all of my scripts, especially DCS2, is to focus on what is important and weed out stuff that does not noticeably improve the script. I do not want my scripts to be gigantic, impossible-to-maintain, monsters. "Lean and mean" is more like what we want here.

Compatibility is little or no issue. The script automatically detects whether weapons are compatible, and chooses the "best" weapon the ship can mount (based on my extensive testing).

While weapon-swapping scripts can work on a fighter, I can tell you that they make little or no difference to the success of the fighter. What *does* make a difference is the fighter's shields. Why? Because the last remaining fighter wins. It is simple if you think about it that way.

We already have the bombers for heavy assaults, and you can already change the number of bombers on carriers. I will add to my list the possibility to change the number of bombers per carrier, so that you can have light, medium, or heavy carriers. That is a good idea, thanks!

I may consider assigning weapon slots in the t file, as we now do with bombers. MAYBE. That would cover any possible weirdness from mods. But, as I said, it is unlikely that there would be fatal incompatibility with any foreseeable mod anyway. At least, not because of weapons.

Shield buster weapons for boarding ops is more interesting (although not really necessary). I have considered this as a possible future expansion, as well as other special-purpose drone operations. We shall see whether X3 endures long enough for it to matter. If it does, then we will expand the AI along with modifying the equipment list.

Thanks for your input, foxtrot.
foxtrot76
Posts: 75
Joined: Fri, 12. Mar 10, 21:44

Post by foxtrot76 »

DrBullwinkle wrote:(snip)

Compatibility is little or no issue. The script automatically detects whether weapons are compatible, and chooses the "best" weapon the ship can mount (based on my extensive testing).
Forgive me for not having explained myself correctly. What I ment was what happens when weapon stats are changed by mods or user preference? Does your script chose the weapons based on a predefined weapon list or does it look at weapon stats? If I recall correctly your script chooses from a predefined weapon list. This means that your weapon of choice might not be the best option available if the weapons have been altered.
DrBullwinkle wrote: While weapon-swapping scripts can work on a fighter, I can tell you that they make little or no difference to the success of the fighter. What *does* make a difference is the fighter's shields. Why? Because the last remaining fighter wins. It is simple if you think about it that way.
I've read many similar discussions (smart turret thread) about weapons of choice vs fighters between PPC and beams. I have never done a real test but can only speak from my personal impression. It might be interesting to actually test this just out of curiosity. When I get home I'll think about how to setup such a test. What would you suggest 100 rounds of 10 fighters with weapon swapping vs 10 fighters without? Would 100 rounds be sufficient to produce somewhat reliable results?
DrBullwinkle wrote: I may consider assigning weapon slots in the t file, as we now do with bombers. MAYBE. That would cover any possible weirdness from mods. But, as I said, it is unlikely that there would be fatal incompatibility with any foreseeable mod anyway. At least, not because of weapons.
Just out of curiosity since you obviously have good scripting and possibly programming experience. How complicated would it be to add a menu in DCS2 similar to your current drone selection menu for calling and selecting weapons/missiles etc for the drones?
I am not suggesting you do this, but rather was wondering how complex it is technically to implement.

Cheers
User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle »

Menu work is annoying in X3. Like ten times harder than straight code, and even worse when you try to maintain it.

That is one reason why my scripts are kind of minimalistic about menu options. It is much easier to make options available in the language file. However, some things need to be on the menu. The t file is fine for global options, but per-carrier options must be on a menu.

The other problem with menus is that they tend to be confusing for players, especially in other languages. Think about Lucike's scripts for example. They are terrific and frustrating at the same time.
firestorm79
Posts: 438
Joined: Mon, 22. Jul 13, 03:09
x4

Post by firestorm79 »

by the way regarding changing the 't' file ID 311 to 684, how do I implement the change? Do I have to deconstruct all my drones and build them again?

edit: don't worry. answer is yes.

p.s. I have sought to get around the lack of phantom missiles on the Norns by physically putting them in their cargo hold, however after a while they disappear from its hold! Is this supposed to happen?
Last edited by firestorm79 on Wed, 18. Dec 13, 17:18, edited 1 time in total.
Lakz
Posts: 127
Joined: Tue, 19. Feb 13, 04:20

Post by Lakz »

DrBullwinkle wrote: We already have the bombers for heavy assaults, and you can already change the number of bombers on carriers. I will add to my list the possibility to change the number of bombers per carrier, so that you can have light, medium, or heavy carriers. That is a good idea, thanks!
:thumb_up: :thumb_up: :thumb_up: :thumb_up:
foxtrot76
Posts: 75
Joined: Fri, 12. Mar 10, 21:44

Post by foxtrot76 »

DrBullwinkle wrote:Menu work is annoying in X3. Like ten times harder than straight code, and even worse when you try to maintain it.

That is one reason why my scripts are kind of minimalistic about menu options. It is much easier to make options available in the language file. However, some things need to be on the menu. The t file is fine for global options, but per-carrier options must be on a menu.

The other problem with menus is that they tend to be confusing for players, especially in other languages. Think about Lucike's scripts for example. They are terrific and frustrating at the same time.
Hehe I hear you. Lucike's scripts do actually have a jungle of menus where you can actually get lost in them (true story).

BTW if you ever want stuff translated into german, italian and french I can do that no problem. So just let me know.
User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle »

foxtrot76 wrote:if you ever want stuff translated into german, italian and french I can do that no problem. So just let me know.
Does that make you Swiss? Sure, feel free to translate any of my language files that seem interesting to you.

Language Files: How to modify for your language
User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle »

firestorm79 wrote:by the way regarding changing the 't' file ID 311 to 684, how do I implement the change? Do I have to deconstruct all my drones and build them again?
You can, although it is not necessary. If you wait ten minutes, then bombers will be recycled. This is part of the system that allows the number of bombers to expand and shrink based on the enemy targets nearby. It is also the reason that missiles you add to their cargo holds "disappears".

It sounds as though you managed to edit your t file. Just in case you are curious about details, this article includes general editing tips: Language Files: How to modify for your language.
Etyneo
Posts: 253
Joined: Fri, 25. May 12, 00:21
x4

Post by Etyneo »

Oh, so I don't have to close X3 to get t file changes implemented?

I thought I'd set my bomber percentage to 0, but it seems I did it in the wrong language file (I needed the L044 one, not the one with the long filename...). Then I saw my shiny new Aran building bombers and had a WTF moment. After examining all the t files for DCS2 (in all languages) and changing them all to match what I wanted, I closed X3 down (after saving) to implement the change.
User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle »

Etyneo wrote:Oh, so I don't have to close X3 to get t file changes implemented?
Correct. You can alt-tab out, change the t file, save, return to the game, and wait for a cycle of the script. For DCS2, that is pretty fast -- ten seconds should cover most situations.
Etyneo
Posts: 253
Joined: Fri, 25. May 12, 00:21
x4

Post by Etyneo »

Hmm, even with a peacetime bomber percent of 0 across all of the t files for DCS2, I still have 8/10 fighters and 2/10 bombers. I'm flying the Aran as the playership (for the time being, it will eventually become my mobile HQ) and have DCS2 set to use only 10 slots. Running 2.07.

I have shut down and restarted DCS2 from the combat menu, and also waited awhile, yet the bombers are still present and being built.

Edit: Now it seems to be slowly phasing those bombers out...took long enough...likely the 600 second bomber lifetime...
User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle »

No M2's nearby? I will take another look.

DCS2 always builds bombers when an M2 is nearby.
Etyneo
Posts: 253
Joined: Fri, 25. May 12, 00:21
x4

Post by Etyneo »

DrBullwinkle wrote:No M2's nearby? I will take another look.

DCS2 always builds bombers when an M2 is nearby.
There were no enemy M2s nearby, but there were friendly ones. I'm thinking it had more to do with the 600 second bomber lifetime than nearby M2s. Also remember this was switching from the default 30% peacetime bomber count to 0%.

DCS2 did eventually replace them with Interceptors.
foxtrot76
Posts: 75
Joined: Fri, 12. Mar 10, 21:44

Post by foxtrot76 »

DrBullwinkle wrote: Does that make you Swiss? Sure, feel free to translate any of my language files that seem interesting to you.

Language Files: How to modify for your language
Yep, I take you know something about switzerland =)

Will translate as soon as I have a little time. Thanks for the link, in reality I have already read your guides to adapt my ocelot to have more fighter launching bays =D it's slightly OP but hell it's fun...

Edit: BTW I took a look at your script in XStudio to adapt the preferred weapon choices. I have to say it's quite an impressive nice piece of work! I never realized how much work there was behind this script.

After reading trough the code (and actually understanding some of it thx to your comments) I have a couple of questions:
1) Is there a different way to keep drones docked without having to remove homebase settings? I ask cuz this behaviour seems to handled by ADS and CODEA. If I understand correctly the undocking with homebase settings is vanilla behaviour kicking in right? Please note I'm only asking out of curiosity and trying to learn something about scripting.

2) I noticed a large portion of the variables are about choosing and checking which weapons can be mounted on what ship type. Is there a way to call a list of compatible weapons for the chosen drone, and having a sort of priority list (based on weapon stats?) or something similar to select the weapon? I ask because I noticed that the LX drone with XRM mod doesn't get any weapon assigned due to the fact that none of the weapons in your list are compatible.
Last edited by foxtrot76 on Thu, 19. Dec 13, 03:09, edited 2 times in total.
User avatar
Tiek
Posts: 166
Joined: Sun, 15. Aug 04, 12:21
x3tc

Post by Tiek »

Hi Doc , I made ​​a small step forward on the issue of not recovered fighters during the emergency jump; therefore I'm convinced that the current function seeks only the fighters docked in the reference object, in this case the Carrier, and not in the sector. So I rewrote the piece of code using the search in sector. Now "docking computer" and "return to the base" instructions both work (I set the fighters search parameter at the distance of 99999):

Code: Select all

   RecallFighters:
  $CheckFighters.flags = [Find.Multiple]
  $sector = $ship -> get sector
  $fighters = find ship: sector=$sector class or type=Caccia race=Player flags=$CheckFighters.flags refobj=$ship maxdist=99999 maxnum=99999 refpos=null
  $f = size of array $fighters
  $sector.owned.fighters = array alloc: size=0
  
  while $f
    dec $f = 
    $fighter = $fighters[$f]
    $homebase = $fighter -> get homebase
    $env = $fighter -> get environment
    
    if $env == [SECTOR] AND $homebase == $ship
      append $fighter to array $sector.owned.fighters
      $k = size of array $sector.owned.fighters
      do if $k
        write to log file #$PageID  append=1  printf: fmt='%s is recalling fighters. k=%s', $ship, $k, null, null, null
      
      $fighter.distance.to.homebase = get distance between $fighter and $ship
      $has.docking.computer = $fighter -> get amount of ware Computer d'atterraggio in cargo bay
      if $fighter.distance.to.homebase < 10000 AND $has.docking.computer
  * Fighter is close to homebase carrier, so use Docking Computer.
        $fighter ->interrupt task 0 with script !lib.interrupt and prio 1000: arg1=null arg2=null arg3=null arg4=null
        $fighter ->put into environment $ship ->
        write to log file #$PageID  append=1  printf: fmt='Fighter %s recalled and is attempting to auto-dock at %s. Shields=%s. Hull=%s', $ship, $homebase, $shield.percent, $hull.percent, null
      else
        if $fighter.distance.to.homebase >= 10000
          $fighter ->interrupt task 0 with script !lib.interrupt and prio 1000: arg1=null arg2=null arg3=null arg4=null
          skip if $fighter -> is script !ship.cmd.returnhome.std on stack of task=0
            $fighter ->start task 0 with script !ship.cmd.returnhome.std and prio 2000: arg1=$homebase arg2=null arg3=null arg4=null arg5=null
          write to log file #$PageID  append=1  printf: fmt='Fighter %s recalled and is attempting to return (flying) to %s. Shields=%s. Hull=%s', $ship, $homebase, $shield.percent, $hull.percent, null
        end
      end
    end
  end
  endsub
[/quote]

The problem is that the Carrier does not wait for the return of far fighters; it jumps and the fighters start the trip towards the new sector. Recovery with the docking computer is practically immediate, so the problem does not arise, but for fighters over 10 km is a different matter, you need to set a wait function but I can't enter it; any additional loop locks out the script. I tried with this new sublabel called immediately after the previous one in the main script (forgive the crude system used :P ):

Code: Select all

  RecallFightersWaiting:
  $CheckFighters.flags = [Find.Multiple]
  $sector = $ship -> get sector
  $fighters = find ship: sector=$sector class or type=Caccia race=Player flags=$CheckFighters.flags refobj=$ship maxdist=99999 maxnum=99999 refpos=null
  $f = size of array $fighters
  $sector.owned.fighters = array alloc: size=0
  
  while $f
    dec $f = 
    $fighter = $fighters[$f]
    $homebase = $fighter -> get homebase
    $env = $fighter -> get environment
    
    if $env == [SECTOR] AND $homebase == $ship
      append $fighter to array $sector.owned.fighters
      $k = size of array $sector.owned.fighters
      
      if $k > 0
        if $ship -> is task 0 in use
          skip if $ship -> is script !move.idle on stack of task=0
            $ship ->interrupt task 0 with script !move.idle and prio 1000: arg1=null arg2=null arg3=null arg4=null
        else
          $ship ->start task 0 with script !move.idle and prio 1000: arg1=null arg2=null arg3=null arg4=null arg5=null
          
          do if $k == 0 OR $k == null
            goto label Continue
          
          $hull.percent = $ship -> get hull percent
          do if $hull.percent <= 80
            goto label Continue
          
@         = wait 300 ms
          
          gosub RecallFightersWaiting
        end
      end
    end
  end
  endsub

But it does not work, the script simply ignores the code and the Carrier jumps :oops:
Any suggestions? :?
User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle »

foxtrot76 wrote:Yep, I take you know something about switzerland =)
I know that Switzerland is famous for chocolate, anonymous bank accounts, and some of the world's best skiing. Oh, and that the national language is German, Italian, and French. ;)

Will translate as soon as I have a little time.
Do whatever you like whenever you like. Nobody is asking for translations, although I know that they are always appreciated.
User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle »

Tiek wrote:But it does not work, the script simply ignores the code and the Carrier jumps :oops:
*Chuckle*... yeah, that is why I have not posted an update yet!

You discovered some of the issues, yes. Another is that the carrier is "losing" whatever battle it is in, so it cannot afford to wait for fighters for long.

I am approximately where you are in the test process. My current thinking is that the carrier should emergency transport fighters in range, jump, *then* recall the rest. Possibly expand the radius for the emergency transport to 20 or 30km.



EDIT: The problem with the carrier needing to jump quickly is the reason that I never bothered to completely fix the "problem" in the first place.
Last edited by DrBullwinkle on Thu, 19. Dec 13, 03:28, edited 1 time in total.
foxtrot76
Posts: 75
Joined: Fri, 12. Mar 10, 21:44

Post by foxtrot76 »

Holy sh!t do you ever sleep? I really didn't expect an answer this fast... again lol

DrBullwinkle wrote: I know that Switzerland is famous for chocolate, anonymous bank accounts, and some of the world's best skiing. Oh, and that the national language is German, Italian, and French. ;)
Urr durr I'm afraid the anonymous bank account part is over ever since the UBS issue with the US government a couple of years back. Swiss politicians basically did a "I took an arrow to the knee" move and created a precedent by releasing information concerning american citizens. The US IRS is not messing around any more ever since the crisis hit.
User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle »

OK, well, suffice it to say that I don't know much about Switzerland, but I hope to visit someday.

I sleep when people aren't watching. ;)


foxtrot76 wrote:The US IRS is not messing around any more ever since the crisis hit.
Funny thing about that... the US was created because of over-zealous taxation.

Hmmmm...

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”