sysGetNearestTown( WorldX, WorldY )
returns buildingID num for the nearest town to the specified world coord
sysTownGetRelationship( townIDNum1, townIDNum2 )
returns the current 'political' relationship between the two towns. Exactly how much of the town relationship system is presently viable is somewhat unknown..
Format | sysTownGetNumBuildingsOfType( TownBuildingID, BuildingType ) |
---|---|
Description | Returns the number of buildings of this type currently exist within the specified town. Useful for when you want to script a system that limits the number of a particular type of building per town |
Returns | Number of this type of building in the town |
Example:
Event( "PlaceAnyBuilding", "" ) { $nBuildingType = $gParam[1] $nearestTownID = sysGetNearestTown( $gPlayerWorldX, $gPlayerWorldY ) $numInTown = sysTownGetNumBuildingsOfType( $nearestTownID, $nBuildingType ) if ( $numInTown >= 3 ) { *msg %PLAYER% There can only be 3 of each type of building in each town CancelTransaction() } else { $valid = sysIsBuildingPositionValid( $nBuildingType ) if ( $valid = 1 ) { $buildingName = sysGetTextEntry() $constrAmount = -1 $didAdd = sysAddBuildingWorld( $nBuildingType,$gPlayerID,$gPlayerWorldX,$gPlayerWorldY,$buildingName,$constrAmount ) } } }