Still getting the same error, assert didn’t seem to help, still got a CTD.
Here is the ship file line for the subs, if I put in a starting subsystem after “Destroyable” the hardpoint works fine, so I don’t think it is in the ship file (the ship can’t build subsystems, I hope that is not a prerequisite for creating them)
StartShipHardPointConfig(NewShipType,"Cargo","Hardpoint_Cargo1","System","Generic","Destroyable","","FRT_CONT_D_BLUE","FRT_CONT_D_CLEAN","FRT_CONT_D_DIRTY","FRT_CONT_D_GRAY","FRT_CONT_D_GREEN","FRT_CONT_D_RED","FRT_CONT_D_YELLOW","FRT_CONT_E_GRAY","FRT_CONT_E_ORANGE","FRT_CONT_E_WARNING","FRT_CONT_E_WHITE")
I did get my mining ship to spawn miners automatically and keep a set number. The instant dock doesn’t work. I can’t figure out a way to keep them from ranging too far with the resourcing, it looks like it will try to resource anywhere on the map. I cannot find a function that will keep them close by if their destination is too far away, only a limit to their distance from the parent ship. The other really odd thing is that the last print statement in the create function shows zero members of the thisship… sobgroup, but when execute that in the update it now shows a population of one.
The strange thing is when I tostring(CustomGroup) it will come back with the ship type, but it doesn’t interact outside of the scope of the current ship as far as I can tell. Each ship performs its function properly and doesn’t overlap.
function Create_MiningShip(CustomGroup, playerIndex, shipID)
--debug
print("This ship is "..shipID.." get ship ID is "..GetShipId("vgr_mining_ship"))
print("Starting ships in mining group :"..SobGroup_Count(CustomGroup))
--create our group of miners for this ship and clear it
SobGroup_CreateIfNotExist("miners"..shipID)
SobGroup_Clear("miners"..shipID)
--create a special group to find all player mining ships
SobGroup_CreateIfNotExist("AllThisShips"..shipID)
SobGroup_Clear("AllThisShips"..shipID)
SobGroup_FillShipsByType("AllThisShips"..shipID, "Player_Ships"..playerIndex, "vgr_mining_ship" )
--create a sobgroup to isolate just this ship
SobGroup_CreateIfNotExist("ThisShip"..shipID)
SobGroup_Clear("ThisShip"..shipID)
--locate the custom group and add it to the ThisShip group
position = SobGroup_GetPosition(CustomGroup)
print("This Ship Created at "..tostring(position[1])..":"..tostring(position[2])..":"..tostring(position[3]))
Volume_AddSphere("findship"..shipID.."vol", position, 5)
SobGroup_FillSobGroupInVolume("ThisShip"..shipID, "AllThisShips"..shipID, "findship"..shipID.."vol")
Volume_Delete("findship"..shipID.."vol")
--add us back to the custom group
SobGroup_SobGroupAdd(CustomGroup, "ThisShip"..shipID)
print("Ships in mining group after mods :"..SobGroup_Count(CustomGroup))
--if custom group has extra crap in it then we can create CustomGroup..shipID
end
function Update_MiningShip(CustomGroup, playerIndex, shipID)
if SobGroup_Count("miners"..shipID) < 12 then
SobGroup_Create("miners"..shipID.."temp")
SobGroup_Clear("miners"..shipID.."temp")
print("ships in mining group :"..SobGroup_Count(CustomGroup).." parent; "..SobGroup_Count("miners"..shipID).." Children")
position = SobGroup_GetPosition(CustomGroup)
Volume_AddSphere("minespawn"..shipID.."vol", position, 5)
SobGroup_SpawnNewShipInSobGroup(playerIndex, "vgr_mole_miner", "miners", "miners"..shipID, "minespawn"..shipID.."vol")
SobGroup_DockSobGroupInstant("miners"..shipID.."temp", "ThisShip"..shipID)
Volume_Delete("minespawn"..shipID.."vol")
SobGroup_SobGroupAdd("miners"..shipID, "miners"..shipID.."temp")
SobGroup_ParadeSobGroup("miners"..shipID.."temp", CustomGroup, 0)
SobGroup_Resource(playerIndex,"miners"..shipID)
end
end