Placing buildings

Forum Archive - from http://theuniversal.net
Locked
User avatar
matias
World Owner
World Owner
Posts: 46
Joined: Wed Apr 24, 2013 7:37 pm

Placing buildings

Post by matias »

The building aren't placed where the watermark shows inside world building

Code: Select all

EVENT("OSDSELECT","BuildOSD:005")

{
*buildingconstruct %PLAYER% 5 Wall
}

EVENT("PlaceBuilding","5") 
{
$didAdd = sysAddBuilding(5,$gPlayerID,$gPlayerX,$gPlayerY,Wall,0,0 ) 
} 
User avatar
Mit
Staff
Staff
Posts: 3551
Joined: Sun Sep 21, 2003 10:14 pm
Location: Unknown

Post by Mit »

'sysAddBuilding' uses map/tile coordinates, which is appropriate on some worlds but not on others.
You might want to use sysAddBuildingWorld and instead of $gPlayerX and $gPlayerY (which provide you with the player location in map/tile coordinates) you'd use $gPlayerWorldX and $gPlayerWorldY.

That do the trick?
User avatar
matias
World Owner
World Owner
Posts: 46
Joined: Wed Apr 24, 2013 7:37 pm

Post by matias »

i used that but it places the buildings in the place where the player is and i want to use the tile separation for better organization between buildings. if the building can´t fit the ghost building i ll have to change all the 0 position of all my buildings with the converter.. and i think its easier to change the parameters of the position of the building to fit the ghost one
User avatar
zaroba
World Owner
World Owner
Posts: 7257
Joined: Fri Oct 10, 2003 11:06 pm
Location: Hereford, PA
Contact:

Post by zaroba »

If you edit the models themselves and the script tries to place them where the player is standing and not where the ghost is showing, then the player will need to be in a specific spot for the building to appear where you want them or they will still be off.

Also, if the building models are off center then their names wont show directly over the buildings in-game and the access area will be off as I believe these are based on where the building is placed, not where the model is located.
User avatar
matias
World Owner
World Owner
Posts: 46
Joined: Wed Apr 24, 2013 7:37 pm

Post by matias »

To be clear.. when i used the build placing as an adm in the world (configurated to use tile spacing ) the building fitted the ghost. but when i scripted something to build for players the building doesnt fit the ghost its y.x displaced from ghost
User avatar
Mit
Staff
Staff
Posts: 3551
Joined: Sun Sep 21, 2003 10:14 pm
Location: Unknown

Post by Mit »

mm.. ok.. this sounds like it might be a bug in the way the building construct ghost works in the tile-based placement modes. Can you confirm your setting for Buildings -> Positioning Mode ?

Meantime, as an alternative you could probably work around this in script using sysGetTileCenter such as :

Code: Select all

$tileCenterX = sysGetTileCenter( $gPlayerWorldX )
$tileCenterY = sysGetTileCenter( $gPlayerWorldY )
$ret = $sysAddBuildingWorld( 5, $gPlayerID, $tileCenterX, $tileCenterY,Wall,0,0 )
Locked