DoEnergy

Category: Objects / Status
Since engine version: 4.6.5.0 CP (extended in 4.9.6.0 CR)

Description

Adjusts the energy value of an object. Energy signifies electrical energy in buildings and life energy in living beings.

Syntax

bool DoEnergy (int iChange, object pObj, bool fExakt, int iEngType, int iCausedBy);

Parameters

iChange:
Change of the energy value (positive or negative) in percent of the maximum value. 100% correspond to the maximum physical value of 100,000.
pObj:
[opt] Object of which to change the energy value. Can be 0 in local calls.
fExakt:
[opt] If true, iChange is applied to the exact energy value (0 to value of Physical "Energy").
iEngType:
[opt] Damage cause specification which is to be passed to Fx*Damage callbacks of effects (see effect documentation). Default is FX_Call_EngScript.
iCausedBy:
[opt] Number of the player who has caused the damage, plus one.

Example

DoEnergy(GetPhysical("Energy", 0, GetCursor(0))*50/100000, GetCursor(0));
Gives 50% more energy to the selected clonk.
See also: EnergyCheck, GetEnergy
Sven2, November 2001
Clonkonaut, April 2008