SetMass

Category: Objects / Status
Since engine version: 4.9.1.0 GWE

Description

Changes the mass of an object. The mass is initialised with DefCore.txt/[DefCore]/Mass. The actual weight is the deadweight plus the weight of the contained objects.

Syntax

bool SetMass (int iNewMass, object pObj);

Parameters

iNewMass:
New mass of the object
pObj:
[opt] Object the mass of which you want to change. Can be 0 in local calls.

Example

private func GetOwnMass(pClonk)
  {
  var iMass=GetMass(pClonk), i, pObj;
  while(pObj = Contents(i++, pClonk)) iMass -= GetMass(pObj);
  return(iMass);
  }

protected func Activate(pByClonk)
  {
  [Essen]
  SetMass(GetOwnMass(pByClonk) + 100, pByClonk);
  Sound("ClonkMunch", 0, pByClonk);
  return(RemoveObject());
  }
Script for a cookie: when eating this cookie the mass of the clonk will increase.
See also: GetMass
Sven2, Juni 2003