Table of Contents
Building Construction Functions
System functions that allow you to construct buildings in the world and set/query construction parameters
sysIsBuildingPositionValid
Format | sysIsBuildingPositionValid( Building_Type ) |
---|---|
Description | Checks whether the player's current position is a valid place to add a building of the specified type |
Returns | 1 if the position is valid, 0 if not |
Example:
Event( "PlaceAnyBuilding", "" ) { $buildingType = $gParam[1] $isValid = sysIsBuildingPositionValid( $buildingType ) if ( $isValid == 1 ) { $buildingName = sysGetTextEntry() $constrAmount = -1 $didAdd = sysAddBuildingWorld( $buildingType,$gPlayerID,$gPlayerWorldX,$gPlayerWorldY,$buildingName,$constrAmount ) } }
sysConstructBuilding
Format | sysConstructBuilding ( Building_Type, WorldX, WorldY, [Building_Name] ) ) |
---|---|
Description | Used to construct a new building to your world. The server handles all the standard construction processes (like deducting building tax or construction materials) according to the current settings applied on your world. If you just want to add a building directly, without applying the usual construction rules, use sysAddBuilding |
Returns | 1 if the building was added to the world, 0 if not |
Example:
Event( "PlaceAnyBuilding", "" ) { $nBuildingType = $gParam[1] $valid = sysIsBuildingPositionValid( $nBuildingType ) if ( $valid = 1 ) { $buildingName = sysGetTextEntry() $didAdd = sysConstructBuilding( nBuildingType, $gPlayerWorldX,$gPlayerWorldY,$buildingName ) } }
sysAddBuilding
Format | sysAddBuilding ( Building_Type, OwnerID, MapX, MapY, [Building_Name], [Construction Amount 1], [Construction Amount 2] ) ) |
---|---|
Description | Used to add a new building to your world |
Returns | The building number created if the building was added to the world, 0 if not |
Example:
Event( "PlaceAnyBuilding", "" ) { $nBuildingType = $gParam[1] $valid = sysIsBuildingPositionValid( $nBuildingType ) if ( $valid = 1 ) { $buildingName = sysGetTextEntry() $didAdd = sysAddBuilding( nBuildingType,$gPlayerID,$gPlayerX,$gPlayerY,$buildingName ) } }
sysAddBuildingWorld
Format for this is same as the 'sysAddBuilding' function described above but World coordinates are used instead of Map coordinates. (Map coordinates are essentially the coordinates of the 'tiles' that make up the land, world coordinates are in cm).
sysGetBuildingTypeName
sysGetBuildingTypeName( TypeNum )
returns text name
sysGetConstructionMaterialsAmount
sysGetConstructionMaterialsAmount( TypeNum )
returns amount of primary construction material required - set in the buildings editor tool
sysGetBuildingTypeBasePrice
sysGetBuildingTypeBasePrice( TypeNum )
returns the base price for construction of this building type, determined by buildings editor setup and economy settings. Actual price can vary depending on where it is placed on the world (e.g. town construction taxes can apply) if you have those settings enabled too.
sysGetSecondaryConstructionPrice
sysGetSecondaryConstructionPrice ( TypeNum )
returns amount of secondary construction material required - set in the buildings editor tool.
sysIsInBuildZone
sysIsInBuildZone( MapX, MapY, ZoneIDNum )
checks if the specified map location is within the specified build zone.
sysIsInNoBuildZone
sysIsInBuildZone( MapX, MapY, ZoneIDNum )
checks if the specified map location is within the specified no-build zone.