Author Topic: Ghost Bricks || Moving and Planting [SOLVED]  (Read 1440 times)

I kind of need the command for creating a ghost brick for this mod I have in mind, does anyone know it? Any help would be appreciated, thank you.

I got that, but how would you plant the ghost, use servercmdshiftbrick to move it, and then plant the brick (.isplanted=1) after it has been moved? For me it just skips straight to planting it and doesn't even shift the brick. Please help, again.

Specific problems time:

Ok Ok, that piece of script I posted was just my prototype of the big picture. I'm really making an output event for this, it is so forgeted up though. :(

Code: [Select]
registerOutputEvent(fxDtsBrick, "MoveBrick", vector);

function fxDtsBrick::MoveBrick(%this, %c)
{
%loltisabrick = new fxDtsBrick()
{
position = %this.position;
rotation = %this.rotation;
angleID = %this.angleID;
colorID = %this.oldcolorID;
colorFXID = %this.oldcolorFXID;
shapeFXID = %this.shapeFXID;
printID = %this.printID;
dataBlock = %this.dataBlock;
isBasePlate = %this.isBasePlate();
};
%this.delete();
servercmdshiftbrick(%loltisabrick, 0, 0, 3);
%loltisabrick.iplanted = true;
%loltisabrick.plant();
}

Here are my problems:

1. The shifting of the brick and the planting of it will happen at the same time, canceling each other out.

2. It won't plant the brick at all.

3. It won't move the ghost brick at all.

Thank you if you help guys.

Also: I do not need advice on anything else, not the vector, not the other script, nothing besides this.

I think I covered all of my problems in there.
« Last Edit: June 28, 2009, 02:37:22 PM by gamefandan »


Code: [Select]
%a = new fxDTSBrick()
{
angleID = 2;
client = 0;
colorFxID = 0;
colorID = 0;
dataBlock = brick2xData;
isBaseplate = false;
isPlanted = false;
position = %pos;
printID = 0;
rotation = %rot;
scale = 1 SPC 1 SPC 1;
shapeFxID = 0;
};

All of this should be pretty self-explanitory.  %pos is position %rot is rotation, and datablock is datablock.  Using the default colorset this should make a 2x brick wherever you set %pos to and rotated by %rot.

Bricks are aligned on a grid (.5 x, y studs, .2 z studs).  Do this to plant it.

Code: [Select]
%a.setTrusted(1);
%a.isPlanted = true;
%a.plant();

Code: [Select]
function servercmdplantit(%client)
{
%loveybrick = new fxDtsBrick()
{
angleID = 2;
client = 0;
colorFxID = 0;
colorID = 0;
dataBlock = brick2xData;
isBaseplate = false;
isPlanted = false;
position = %client.player.position;
printID = 0;
rotation = 0;
scale = 1 SPC 1 SPC 1;
shapeFxID = 0;

%loveybrick.setTrusted(1);
%loveybrick.isPlanted = true;
%loveybrick.plant();
findclientbyname(%client.name).brickgroup.add(%loveybrick);
}
}

Would this not create and plant a brick at my position and add it to my brickgroup?
« Last Edit: June 26, 2009, 09:04:09 PM by gamefandan »

Works perfectly, thank you Azimuth. Locking.

Name am bumped. This bump is pointless, I'm already on top! :D

Several things wrong.

1. The 3rd bracket needs a semicolon because it is creating a new object.
2. %loveybrick.setTrusted(1); to findclientbyname(%client.name).brickcgroup.add(%loveybrick); needs moved outside the brackets after it.
3. You can use getBrickGroupFromObject(%client).add(%loveybrick); instead of that whole fiasco, or even just us %client instead of findClientByName(%client.name) because you already have the god damn client object.
4. getWords(%client.player.getTransform(),0,2); is better than %client.player.position i think.
5. Rotation needs to be set to 0 SPC 0 SPC 0; or "0 0 0";
6. Related to the clients position: it would probably be place in mid-air and forget up.
7. If your shifting the brick down a specific amount to get it to the ground that wouldn't work out well from what I know (player jetting, jumping, on something, etc.)
8. serverCmdShiftBrickForward, serverCmdShiftBrickBackward are probably the functions your looking for.  I'm not sure, but just serverCmdShiftBrick is strange.  You should check them.  Also, their only argument would probably be %client.

Several things wrong.

1. The 3rd bracket needs a semicolon because it is creating a new object.
2. %loveybrick.setTrusted(1); to findclientbyname(%client.name).brickcgroup.add(%loveybrick); needs moved outside the brackets after it.
3. You can use getBrickGroupFromObject(%client).add(%loveybrick); instead of that whole fiasco, or even just us %client instead of findClientByName(%client.name) because you already have the god damn client object.
4. getWords(%client.player.getTransform(),0,2); is better than %client.player.position i think.
5. Rotation needs to be set to 0 SPC 0 SPC 0; or "0 0 0";
6. Related to the clients position: it would probably be place in mid-air and forget up.
7. If your shifting the brick down a specific amount to get it to the ground that wouldn't work out well from what I know (player jetting, jumping, on something, etc.)
8. serverCmdShiftBrickForward, serverCmdShiftBrickBackward are probably the functions your looking for.  I'm not sure, but just serverCmdShiftBrick is strange.  You should check them.  Also, their only argument would probably be %client.

That didn't answer my question or solve any non - existent problems.

I asked how can you make it so it doesn't do things at the same time, like:

Code: [Select]
servercmdshiftbrick(%loveybrick, 0, 0, 1);
%loveybrick.isplanted=1;

This is part of the event mod I'm making (not releasing) called move brick. I want to know how I would move the ghost and then plant it. Thank you.

Use schedules.

Syntax:
Code: [Select]
schedule(TIME IN MS,APPLIED ON OBJECT,FUNCTION NAME,ARGUMENT,ANOTHER ARGUMENT,ETC);

4. getWords(%client.player.getTransform(),0,2); is better than %client.player.position i think.

Why not just do %client.player.getPosition();?

8. serverCmdShiftBrickForward, serverCmdShiftBrickBackward are probably the functions your looking for.  I'm not sure, but just serverCmdShiftBrick is strange.  You should check them.  Also, their only argument would probably be %client.

serverCmdshiftBrick(X in studs, Y in studs, Z in flats);
With the Z axis everything is done in 1/3rd of a brick (e.g. a plate) so if you want to move it up 1 brick you would use 3.

Use schedules.

Syntax:
Code: [Select]
schedule(TIME IN MS,APPLIED ON OBJECT,FUNCTION NAME,ARGUMENT,ANOTHER ARGUMENT,ETC);

Aren't schedules used for loops?

Why not just do %client.player.getPosition();?

serverCmdshiftBrick(X in studs, Y in studs, Z in flats);
With the Z axis everything is done in 1/3rd of a brick (e.g. a plate) so if you want to move it up 1 brick you would use 3.
X and Y are relative to the player who owns the temp brick and may be glitchy if that player is not alive or nearby when the bricks are created through script.

In any case, if you're creating them manually then can't you just place them in the position they're needed instead of shifting them?

I thought there was a method called plant. So you could do %blahghostbrickthing.plant(); instead of %blahghostbrickthing.isplanted = 1;

I would use the first if it exists because it seems safer.

You have to set isPlanted to true before you call .plant(); because otherwise it won't plant.