Category: Objects
/ Creation
Since engine version: 1.0 OC
CreateConstruction
Description
Should be used instead of CreateObject to create a building or construction site. In local calls the specified position will be an offset to the position of the calling object. If check_site is 1, the site is checked for suitability before creating the object. If the site is not suitable (e.g. rough ground or not enough space), a message is displayed above the calling object and the function returns
nil
.Syntax
object CreateConstruction(id object_id, int xoffset, int yoffset, int owner, int completion, bool adjust_terrain, bool check_site);
Parameters
- object_id:
- Type of object to be created.
- xoffset:
- X coordinate
- yoffset:
- Y coordinate
- owner:
- Owner of the new object (valid player number or NO_OWNER for no-owner).
- completion:
- Determines the initial completion of the object in percent (minimum 1).
- adjust_terrain:
- Determines whether the landscape at the creation site has to be adjusted to the objects basement.
- check_site:
- First checks the specified site for suitability.
Examples
CreateConstruction(WindGenerator, 150,100, 0,100,1 );
Creates a complete wind generator at position 150/100 for player 1 and adjusts the landscape to the building.
CreateConstruction(SteamEngine, 200,100, NO_OWNER, 30,1 );
Creates a steam engine construction finished by 30% site at position 200/100 with no owner, also adjusting the landscape.