The following code is derived from the Sapiens minelayer, it changes the projectile type to a custom virtual item, and randomises the speed at which the mine is launched (to produce scatter):

<ItemType UNID="&vtStationMinelayerRogue;"
            name=                "(Station-mounted mine launcher for the Rogue Fleet traps)"
            level=                "6"
            virtual=            "true"
            >
        <MiscellaneousDevice>
        </MiscellaneousDevice>

        <Events>
            <OnUpdate>
                (switch
                    ([email protected] gSource 'abandoned)
                        Nil

                    (gr (random 1 100) 30)
                        Nil

                    (sysCreateWeaponFire &itStaticMineStation2; 
                            {
                                obj: gSource
                                namePattern: ([email protected] &itStaticMineStation2; 'namePattern)
                                }
                            gSource 
                            (random 0 359)
                            (random 20 25) 
                            nil)
                    )
            </OnUpdate>
        </Events>
    </ItemType>

In instances of the station that mounts this device being spawned through a godmod (and probably through the console, I didn't check), the code works as intended: mines will be spawned between 0.2c and 0.25c.

However, on naturally spawned stations, you get constant errors and the code doesn't work. I've attached a screenshot.

It appears that the game is loading in the type for the pre-generated stations and in doing so converting (random 20 25) to the dice-roll notation 20-25, which is invalid TransLisp code and thus breaks the script.

Thanks to Aury and AssumedPseudonym for helping out on this. It was confusing as heck to run into while testing these things.

MinelayerBug.jpg
MinelayerBug.jpg
the_shrike 22 Oct 2021:

And thanks to AP for this workaround for the problem:

<OnUpdate>
  (block ((esSpeedVar (random 15 25)))
    (switch
      ([email protected] gSource 'abandoned)
        nil
      (gr (random 1 100) 30)
        nil
      (sysCreateWeaponFire
        &itStaticMineStation2;
        {
          obj: gSource
          namePattern: ([email protected] &itStaticMineStation2; 'namePattern)
        }
        gSource
        (random 0 359)
        esSpeedVar
        nil
      )
    )
  )
</OnUpdate>