Function; Player_FillShipsByType - HWRM/KarosGraveyard GitHub Wiki

Player_FillShipsByType(<sSobGroupNameOut>, <iPlayerIndex>, <sShipType>)

Description

Fills <sSobGroupNameOut> with only those ships of type <sShipType> that are active and belong to <iPlayerIndex>.
Note: inactive ships (e.g., ships that are in hyperspace or docked) are ignored by this function. Use Player_GetNumberOfSquadronsOfTypeAwakeOrSleeping to count the number of ships, regardless of whether they are active or inactive.
Note: the sobgroup is cleared each time the function is called: i.e., the sobgroup is emptied before being filled again with all ships of <sShipType>.
Note: <sSobGroupNameOut> must be created before the function is called.

Example

(from the HW Classic Mod)

Player_FillShipsByType("CrateMothership", 0, "Vgr_Mothership")

Arguments

<sSobGroupNameOut>: the name of the sobgroup to place ships into.
<iPlayerIndex>: the index number of the player.
<sShipType>: the type of ship.

Related Pages

Function Reference

Player_GetNumberOfSquadronsOfTypeAwakeOrSleeping

SCAR (SCripting at Relic) Reference

Comments

Clarified the description and added that docked ships are ignored by the function.

--SunTzu (2006-01-14 06:23:06)

I'm guessing that inactive ships includes ships that are in hyperspace.

--Mikali (2006-01-15 07:28:07)

Docked ships seem to be ignored by many functions. I sure do wish there was a command just like this that filled a SobGroup with inactive(docked) ships.

--GreyGhost (2006-06-11 06:54:51)

There is such a function: sobgroup_getsobgroupdockedwithgroup

--SunTzu (2006-06-16 14:42:53)

That isn't like this command. I was mainly referring to the <iPlayerIndex> use.

--GreyGhost (2006-06-17 12:25:48)

Well, just do this: SobGroup_GetSobGroupDockedWithGroup(<SobgroupOut>, "Player_Ships"..iIndexPlayer)<br />
AFAIK many Player_ functions are the same as SobGroup_ functions used with Player_Ships..iPlayerIndex

--SunTzu (2006-06-19 04:17:46)

Sure, but who cares when you want to get the ships docked with Player_Ships? :P

--SunTzu (2006-06-19 07:18:47)

Heh, I read that backwards. 8P Your right, but unfortunately it still doesn't do what I want. I specifically want the ability to get the sleeping ships of <iPlayerIndex> in <sSobGroupName> into <sSobGroupNameOut>.

--GreyGhost (2006-06-19 08:16:40)

I don't know what you want to do exactly, but you can emulate the function above for docked ships this way: SobGroup_GetSobGroupDockedWithGroup("Player_Ships"..<iPlayerIndex>, "tempGroup"); SobGroup_FillShipsByType("SobGroupOut", "tempGroup", <sShipType>)

--SunTzu (2006-06-19 10:52:24)

I want to fill a SobGroup from the SobGroup made with SobGroup_GetSobGroupDockedWithGroup, with ships belonging to a different <iPlayerIndex>. I don't think it's possible though, I know of no function that just puts sleeping or all (awake & sleeping) ships belonging to a player in a SobGroup. If there was I could run SobGroup_FillCompare or whatever.

--GreyGhost (2006-06-19 12:16:54)

Actually what would really be ideal is a way to count inactive squadrons(not ships) inside a specific SobGroup.

--GreyGhost (2006-06-22 08:13:06)

Since "Player_Ships"..iPlayerIndex only contains active ships, you could use something like the following:<br />
SobGroup_FillSubstract(sSobGroupNameOut, sSobGroupName, "Player_Ships"..iPlayerIndex)

--Mikali (2006-06-22 23:26:53)

Er.. wouldn't all the ships in sSobGroupName would fill sSobGroupNameOut regardless of which "Player_Ships"..iPlayerIndex I used, because none of them are in any "Player_Ships"..iPlayerIndex's.

--GreyGhost (2006-06-23 09:46:06)

Try using English grammar.

--Mikali (2006-07-03 01:19:12)

Are you referring to that extra would? Geez...

--GreyGhost (2006-07-07 11:57:16)

'Will' is an important verb.

--Mikali (2006-07-18 01:31:39)

Page Status

Updated Formatting? Initial
Updated for HWRM? Initial

⚠️ **GitHub.com Fallback** ⚠️