A_GiveToSiblings

From ZDoom Wiki
Jump to navigation Jump to search

int A_GiveToSiblings (string type [, int count])

Usage

Adds count items of type type to the calling actor's siblings' inventory. This function will not add more items than can be carried.

An actor's siblings are actors which share a common master actor with said actor. These siblings are considered the children of the master. This relationship is formed when those children actors are spawned by the master actor through A_SpawnItemEx with the SXF_SETMASTER flag passed to the function, or if a child spawns another child with SXF_TRANSFERPOINTERS without the SXF_SETMASTER flag. This is needed because SXF_SETMASTER will otherwise cause the child of the child to be its child instead of a sibling, as the calling actor with that flag makes it the master instead of its own master.

If type is an item derived from Health, then the amount received is the result of multiplying count by the item's amount, e.g. if type is Medikit and count is 2, then the amount of health received would be 50 points, not 2.

Parameters

  • type: the item to give. This should be a valid inventory item.
  • count: the number of samples of this item to give. Default is 0, which is interpreted as 1.

Return value

The function returns the total number of actors which successfully received the item.

Examples

Nuvolachalk.png Note: This article lists no examples. If you make use of this feature in your own project(s) or know of any basic examples that could be shared, please add them. This will make it easier to understand for future authors seeking assistance. Your contributions are greatly appreciated.