SetPicture

Category: Objects / Display
Since engine version: 4.9.1.0 GWE

Description

Changes the representative picture of an object by setting it to a new source rectangle within the definition graphics. This picture is used e.g. in menus or the inventory. Also see the Picture entry in DefCore.txt.

Syntax

bool SetPicture (int iX, int iY, int iWdt, int iHgt, object pObj);

Parameters

iX:
X position of the top left corner of the new graphics rectangle
iY:
Y position of the top left corner of the new graphics rectangle
iWdt:
Width of the new graphics rectangle
iHgt:
Height of the new graphics rectangle
pObj:
[opt] Object the graphics of which you want to change. Can be 0 in local calls.

Example

global func SetObjectPicture(idSrcDef, pObj)
  {
  SetPicture(GetDefCoreVal("Picture", "DefCore", idSrcDef, 0),
             GetDefCoreVal("Picture", "DefCore", idSrcDef, 1),
             GetDefCoreVal("Picture", "DefCore", idSrcDef, 2),
             GetDefCoreVal("Picture", "DefCore", idSrcDef, 3), pObj);
  SetGraphics(0, pObj, idSrcDef);
  return(1);
  }
Global function: changes the picture of pObj to that of another object (Warning: this may make the game graphics or SolidMasks of the object invalid).
See also: SetGraphics
Sven2, Juni 2003