Docked ship - SobGroup


I need to know if we have function to know how many ships is docked to one ship.

I have sobgroup, this sobgroup need to dock to a large ship.

But, player need to fill all hangar with this fighter. So i need to count the number of ship is docked. Any function to have this number ?

Or to have the number of ship is not docked … Actually, the function fill, add ship in hyperspace and docked.

Any idea ? :slight_smile:

SobGroup_IsDockedSobGroup(sSobGroupName, sSobGroupNameDockedWith)


Returns true if sSobGroupName is docked with sSobGroupNameDockedWith.


SobGroup_IsDockedSobGroup(“Dreadnaught”, “Shipyard”)==0 then … code … end


sSobGroupName: name of the sobgroup containing docking squadrons (quoted string)
sSobGroupNameDockedWith: name of the sobgroup where the other sobgroup can dock (quoted string)

Maybe something could be done with that. It’d be hacky, but it might be doable.

Yes, we have this … But not return a value represent the number of ships docked to sobgroup amiral.

My ship can transport 15 squadron … and i need to docked 15 squadron of dart, and we have more of 30 darts in the maps …

The problem is, Player_FillShipByType place to sobgroup all ship (docked and hyperspace is accepted !), so i can’t count the ship is currently docked :confused: (If you have function can return true if the dock is full, why not …)

@BitVenom Any idea ?

This is what I would do:

  1. Track all dockable squadrons the player owns by giving each one a SobGroup of it’s own. Give the SobGroups a name with a number at the end, e.g. “dockable_1”.

  2. When you need to know how many ships are docked in a particular ship, use something like:

    number_of_docked = 0
    for i = 1, number_dockable_sqns do
    if (SobGroup_IsDockedSobGroup(“dockable_”…i, “carrier_or_mothership”)==1) then
    number_of_docked = number_of_docked + 1

Yes, but i found other way :

I use this function :

Return all ship is NOT dock or in hyperspace. I know the number of ship in the level, and i know the number of docking bay (the number of squadron can be docked).
I made rule with this function,

g_numbership = 0
function Check_valueship()
  g_numbership  = Player_NumberOfAwakeShip(0)
  -- number max is 147 and i need 15×5 ship dock (75)
  if ( g_numbership == 147 - 75) then 
    print("player dock ship")

In my mind, it’s work … i test it when i can (not now, i go bed ^^) .

Note : The player don’t have this ship by .level, so i can’t made one sobgroup for one squadron … Yeah, it’s not easy if we use startingplayerfleet.lua :wink: (or persist file in this case.). [ I need to post a new ‘post’ in Story of persist for this part… ^^]

If this function and @Dom2 function works, probably add this to tips in the wiki :stuck_out_tongue:

We are being fools. There is a built-in function that does this already! I found this in the Gehenna mission file:

SobGroup_GetSobGroupDockedWithGroup("Gehenna", "ShipsDockedWithGehenna")

Yeah …
The name of the function is not precise.

So after this i need to make SobGroup_Count to have the number of ship docked…

Dream : One function return true if the ship is full of the ship type (hangar) of this type … :slight_smile:

Did you solve your problem already?
I think the SobGroup_GetSobGroupDockedWithGroup function will take all your hangars into account.
They should be splitted into individual ships, I might have a splitter-function that can solve your problem.

I have use other way to make my mission. So the problem is actually solved.