Author Topic: Brick placing relative to the player  (Read 681 times)

I am trying to get this-
Code: [Select]

%n=20.0;
%d=5.0;

%k=%n/%d;

%posx = mCos(%k*%i)*mCos(%i);
%posz = 0;
%posy = mCos(%k*%i)*mSin(%i);

%temp = new fxDTSBrick()
   {
    datablock = "brick1x1fData";
    position = 10*%posx SPC 10*%posy SPC %posz;
    rotation = "0 0 0 0";
    colorID = "1";
    scale = "1 1 1";
    angleID = "0";
    colorfxID = "0";
    shapefxID = "0";
    isPlanted = 1;
   };


}
}
to be built relative to the player, so the center will be in the spot the player was standing.

The code is from the blockland wiki.

Why don't you just make the position the same as the player's position and round it to the nearest .5 or whatever?

Why don't you just make the position the same as the player's position and round it to the nearest .5 or whatever?
Bricks are automatically snapped to the grid when they are planted in a position off the brick grid anyway.
If I read your post correctly, you want a sort of bridge thing like truces, where it creates a 1x1 at your feet. Just make posz and posz the same as the player's, but set the posz to the player's z minus its height (word box height) multiplied by z scale.

Bricks are automatically snapped to the grid when they are planted in a position off the brick grid anyway.
If I read your post correctly, you want a sort of bridge thing like truces, where it creates a 1x1 at your feet. Just make posz and posz the same as the player's, but set the posz to the player's z minus its height (word box height) multiplied by z scale.
I'm not much of a scripter, how do I do that?

Bricks are automatically snapped to the grid when they are planted in a position off the brick grid anyway.
But rotation is messed up which stops you from placing bricks around it.

Code: [Select]
	%x=%client.pos.x;
%y=%client.pos.y;
It doesn't have any syntax errors, but it places it in a set spot.  What did I do wrong?

Since when is %client.pos.y a variable?
%x = getWord(%client.player.position, 0);
%y = getWord(%client.player.position, 1);
%z = getWord(%client.player.position, 2);

Since when is %client.pos.y a variable?
%x = getWord(%client.player.position, 0);
%y = getWord(%client.player.position, 1);
%z = getWord(%client.player.position, 2);
Thanks, I am not sure what my code was, I was just experimenting. :P