scripting:reference:system_functions:constructionfunctions
This is an old revision of the document!
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 |
Parameters | Building Type number |
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 = 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
TBD
sysGetConstructionMaterialsAmount
TBD
sysGetBuildingTypeBasePrice
TBD
sysGetSecondaryConstructionPrice
TBD
sysIsInBuildZone
TBD
sysIsInNoBuildZone
TBD
scripting/reference/system_functions/constructionfunctions.1581067382.txt.gz · Last modified: 2020/02/07 03:23 by mit