SetPortrait

Category: Objects / Display
Since engine version: 4.9.5.0 CE

Description

Changes the portrait of a crew member at runtime.

Syntax

bool SetPortrait (string szPortrait, object pTarget, id idSrcDef, bool fPermanent, bool fCopyGfx);

Parameters

szPortrait:
Name of the portrait to be set. This will load the image file "PortraitX.png" (X being replaced with the specified name). This parameter can handle the following special values:
Value Meaning
"none" Portrait will be removed.
"random" A random portrait will be selected from all available portraits.
"custom" The portrait will be set to the object's individually stored portrait, if available.
pTarget:
[opt] Object the portrait of which you want to change. Can be 0 in local calls.
idSrcDef:
[opt] Definition from which you want to load the portrait. If not specified, the portrait will be loaded from the definition of the object.
fPermanent:
[opt] If 'true' the new portrait setting will be stored in the player file and used in future rounds. Otherwise the portrait setting will be discarded at the end of the round.
fCopyGfx:
[opt] Copies the image of the new portrait to the player file and sets the portrait to "custom". In this way, the portrait will still be available even if the definition from which it was originally loaded is not available in a given round. On the other hand, with this setting it is impossible to determine from which source the portrait was originally loaded.

Examples

SetPortrait("random", FindObject(0, 0,0,0,0, OCF_CrewMember) );
Assings a random portrait.
SetPortrait(GetPortrait(0, 0, 1), 0, GetPortrait(0, 1, 1) );
Restores the default portrait of a clonk in case it was changed by a SetPortrait call.
See also: GetPortrait
Clonk-Karl, Dezember 2005