Author Topic: Creating a Tempbrick  (Read 746 times)

I want to create a tempbrick for a player due to there being very few surfaces for placing one on to start with. However, when I try to create this tempbrick, the player can't actually move it and it isn't actually theirs.

(%temp = new fxDtsBrick()
{
    client = %cl;
    colorID = %cl.currentColor;
    datablock = %cl.inventory[%cl.currInv];
}).setTransform(%end@" 0 0 1 "@(%angle/$PI/2));
%cl.brickgroup.add(%temp);
%pl.tempbrick = %temp;


%cl, %pl, %end, and %angle are all defined prior, and refer to the client, player, position, and rotation respectively.


What am I missing?

This is the code from the duplorcator:
Code: [Select]
%temp = new FxDTSBrick()
{
datablock = $uinametable[%db];
position = vectorAdd(%newPosition,vectorAdd(%client.player.getPosition(),vectorScale(%client.player.getForwardVector(),2)));
angleID = %angleID;
rotation = rotationFromAngleID(%angleID);
colorID = %newColor;
printID = getValueFromBrickStr(%line,"printID");
};
%client.player.tempbrick = %temp;
Try to remove the client field? Setting angle ID and rotation?

I just tried doing that, but it still doesn't recognize it as being the player's new tempbrick. Hrm.

EDIT: That feeling when you realize you're an idiot. The %pl variable is actually called %this here. Problem solved.
« Last Edit: December 23, 2013, 04:59:32 AM by Xalos »