Collect

Category: Objects/Content
Since engine version: 4.9.1.0 GWE

Description

Collects an object. This function performs the same events as they occur if the object is collected in the game through the Collection area (there will be a RejectCollect call, flag collection checks, hit calls e.g. OCF_HitSpeed2, etc.). The only difference is that there will be no comparison of collection position and the collected item is not checked for the OCF_Collectible flag.
Using this function you can for example collect objects directly from a container. If the function fails (e.g. through a RejectCollect or a full target container) the function returns 0, otherwise 1.

Syntax

bool Collect (object pItem, object pTarget);

Parameters

pItem:
Object to be collected
pTarget:
[optional] Object which is to collect. Can be 0 in local calls.

Example

protected func ControlDig (pClonk)
{
	var obj; if (!(obj = Contents())) return(1);
	if (!Collect(obj, pClonk)) Message("Herausnehmen nicht möglich", pClonk);
	return(1);
}
With keyboard command Dig the first inventory object is passed to the selected clonk.
See also: Enter
Sven2, May 2002