GetDefinition

Category: Objects
Since engine version: 1.0 OC

Description

Returns the id of the indicated definition from the list of definitions as currently loaded by the engine.

Syntax

id GetDefinition(int index);

Parameter

index:
Index of the definition.

Example

var index = 0, weapon_def, weapon_list = [];
while (weapon_def = GetDefinition(index))
{
	if (weapon_def->~IsWeapon())
		weapon_list[GetLength(weapon_list)] = weapon_def;
	index++;
}
var spawn_weapon = weapon_list[Random(GetLength(weapon_list))];
CreateObject(spawn_weapon,AbsX(Random(LandscapeWidth())),0);
Searches through all loaded definitions and all those which return true on call of the function "IsWeapon" are put into an array. After that, a random item of these defintions is selected to spawn at a random position in the landscape.
See also: C4D_Goal, C4D_Living, C4D_Object, C4D_Rule, C4D_StaticBack, C4D_Structure, C4D_Vehicle, GetBaseMaterial, GetPlrKnowledge
Günther, 2002-02