Author Topic: Brick Area  (Read 2112 times)

How would I go about finding the area of a brick and defining it to a variable, Kinda like this.

Code: [Select]
%Bmass = %brick.SizeX * %brick.SizeY * %brick.SizeZ;

tree();

Look for the game objects, look for the datablocks (they come first on the list since the lowest numbers are always reserved for them), find a brick datablock, realize how simple that was.

Code: [Select]
brickMybrickData.dump();
Came up with the variables I have in the first post.

%brickdatablock = %brick.getdatablock();

%Bmass = %brickdatablock.SizeX * %brickdatablock.SizeY * %brickdatablock.SizeZ;

Think about what your working with.

Orly? Why did it not work then.

Code: [Select]
package Lolzplant
{
function fxDtsBrick::onPlant(%brick)
{
parent::onPlant(%brick);
%client = getBrickGroupFromObject(%brick).client;
%Colorz = %brick.getcolorid();
%brickdatablock = %brick.getdatablock();
%Bmass = %brickdatablock.SizeX * %brickdatablock.SizeY * %brickdatablock.SizeZ;

if(%client.quantity["Stone"] < %BMass)
{
commandToClient(%client, 'centerPrint', "\c6You need " @ %BMass @ " \c2Stone!", 3);
%brick.KillBrick();
return;
}
%client.quantity["Stone"] -= %Bmass;
}
};
activatepackage(Lolzplant);
« Last Edit: February 11, 2009, 11:18:58 PM by Kunit »

Does that code not work, you kinda posted it without explaining why you did.

Yes, That code does not work. I just made a more "Clean" version of the code though.

Code: [Select]
package Lolzplant
{
function fxDtsBrick::onPlant(%brick)
{
parent::onPlant(%brick);
%client = getBrickGroupFromObject(%brick).client;
%Colorz = %brick.getcolorid();
%brickdatablock = %brick.getdatablock();
%Bmass = %brickdatablock.SizeX * %brickdatablock.SizeY * %brickdatablock.SizeZ;

if(%Colorz >= 1 && %Colorz <= 46)
{
%Mattobuild = "Special";
}

if(%Colorz >= 47 && %Colorz <= 55)
{
%Mattobuild = "Stone";
}

if(%client.quantity[%Mattobuild] < %Bmass)
{
commandToClient(%client, 'centerPrint', "\c6You need " @ %Bmass @ " \c2" @ %Mattobuild @ "!", 3);
%brick.KillBrick();
return;
}
%client.quantity[%Mattobuild] -= %BMass;
}
};
activatepackage(Lolzplant);

Code: [Select]
package Lolzplant
{
function fxDtsBrick::onPlant(%brick)
{
parent::onPlant(%brick);
%client = getBrickGroupFromObject(%brick).client;
%Colorz = %brick.getcolorid();
%brickdatablock = %brick.getdatablock();
%Bmass = %brickdatablock.BrickSizeX * %brickdatablock.BrickSizeY * %brickdatablock.BrickSizeZ;

if(%Colorz >= 1 && %Colorz <= 46)
{
%Mattobuild = "Special";
}

if(%Colorz >= 47 && %Colorz <= 55)
{
%Mattobuild = "Stone";
}

if(%client.quantity[%Mattobuild] < %Bmass)
{
commandToClient(%client, 'centerPrint', "\c6You need " @ %Bmass @ " \c2" @ %Mattobuild @ "!", 3);
%brick.KillBrick();
return;
}
%client.quantity[%Mattobuild] -= %BMass;
}
};
activatepackage(Lolzplant);
That should work.  You are using the wrong variables.  (I just looked up an old building script I made, which when I was making it I found the variables exactly how I told you to when I first replied.)

Its getDataBlock not getdatablock.

Also its volume not mass.

As far as I know capitalization doesn't matter in TGE scripts.

Edit: Typo
« Last Edit: February 12, 2009, 02:03:55 AM by laremere »

As far as I know capitalization doesn't matter in TGE scripts.

Edit: Typo

Your knowledge does not go too far then.

Edit: It only matters when you're using .datablock instead of .dataBlock so Kunit has made some really lame screwup somewhere and I really can't be bothered to read through that crap.

Doubleedit: Also I hate to be a downer (not really) but how are you going to make an RPG like the one you proposed with those actually quite serious modifications to make when you fall at what appears to be not even a hurdle?
« Last Edit: February 12, 2009, 02:19:48 AM by Ephialtes »

What ever happened to just using %brick.getvolume()?

The getVolume commad always returned to 0. Also, I'm sorry we all can't be god-like at scripting.

The getVolume commad always returned to 0. Also, I'm sorry we all can't be god-like at scripting.

I will accept your apology but sitting around feeling sorry for yourself isn't going to make you any better!

Ok, What did I do to make you so pissy toward me anhyway?