PlaceObjects

Category: Objects / Creation
Since engine version: 4.9.5.0 CE

Description

Creates the specified number of objects in the specified target rectangle and target material (optional). Returns the number of iterations or -1 if creation has failed.

Syntax

int PlaceObjects (C4ID id, int iAmount, string Mat, int iX, int iY, int iWdt, int iHgt, bool fOnSurface, bool fNoStuck);

Parameters

id:
ID of the object to be created
iAmount:
Count of objects to be created
Mat:
Material in which the objects are to be created. This can be a material number or a string as follows:
iMat Create in
"GBackSolid" Objects are created in solid material. Also see GBackSolid().
"GBackSemiSolid" Objects are created in solid or liquid material. Also see GBackSemiSolid().
"GBackLiquid" Objects are created in liquid material. Also see GBackLiquid().
"GBackSky" Objects are created in mid-air. Also see GBackSky().
iX:
[opt] Left boundary coordinate of the target rectangle (x coordinate).
iY:
[opt] Top boundary coordinate of the target rectangle (y coordinate).
iWdt:
[opt] Width of the target rectangle. If not specified, the right landscape boundary
iHgt:
[opt] Height of the target rectangle. If not specified, the bottom landscape boundary
fOnSurface:
[opt] If true, all objects will be created above the upper surface of the specified material (this might be outside the target rectangle).
fNoStuck:
[opt] If true, placement will not ensure that objects are in solid material. This is needed e.g. when placing objects in liquids.

Remark

If there is only very little of the target material present in the landscape, placement calculation will take longer.
However, endless retry loops are avoided.

Examples

PlaceObjects(LOAM,20,Material("Earth"),100,0,200)
Create 20 chunks of loam in earth within the coordinates 100,0 and 200,LandscapeHeight().
PlaceObjects(FISH,10,"GBackLiquid",0,0,0,LandscapeHeight()/2,0,1);
Creates a total of 10 fishes in all liquids found in the upper half of the landscape
See also: CreateObject, PlaceInMaterial
Tyron, August 2004