Author Topic: [Solved] Replacing a brick's texture.  (Read 3676 times)

didn't we just go over the fact that you can't put textures on a brick?

Sorry about that, I read all of that quickly because I have to leave. Thanks for your input guys.

Alright, new idea! Is there a way to set the default print on a print brick instead of it defaulting to A?

Alright, new idea! Is there a way to set the default print on a print brick instead of it defaulting to A?
Set the print when parenting the onPlant function for the brick

example
Code: [Select]
function FxDTSBrick::onPlant(%this, %obj)
{
%data = %this.getDatablock();
if(%data.uiName $= "Brick-Name")
{
             %printID = int;
             %this.setPrint(%printID);
}
return Parent::onPlant(%this, %obj);
}

Set the print when parenting the onPlant function for the brick

I see, thank you.

If you're going to do that to multiple prints that's going to create a massive package tree

If you're going to do that to multiple prints that's going to create a massive package tree
Code: [Select]
function FxDTSBrick::onPlant(%this, %obj)
{
%data = %this.getDatablock();

if(%data.uiName $= "Brick-Name")
{
             %printID = int;
             %this.setPrint(%printID);
}
if(%data.uiName $= "Brick-Name2")
{
             %printID = int;
             %this.setPrint(%printID);
}
if(%data.uiName $= "Brick-Name3")
{
             %printID = int;
             %this.setPrint(%printID);
}
if(%data.uiName $= "Brick-Name4")
{
             %printID = int;
             %this.setPrint(%printID);
}

return Parent::onPlant(%this, %obj);
}
Not really, since it only checks one brick each plant (and technically you only plant one brick at a time)
« Last Edit: January 30, 2016, 09:14:11 AM by Goth77 »

Code: [Select]
function fxDTSBrick::onPlant(%this, %object) {
    %db = %this.getDatablock();
    if($customPrint[%db.uiName] !$= "") {
        %this.sendPrint($customPrint[%db.uiName]);
    }
    return Parent::onPlant(%this, %object);
}
$customPrint["UI-Name"] = "PrintID";
$customPrint["UI-Name-2"] = "PrintID-2";
A much nicer looking alternative.

And in a situation such as your code, a better solution would be using else if, that way when it finds the matching name, it doesn't have to continue checking.

Good lookin out ChocoboPah   :cookie:

replace %db.uiName with getSafeVariableName(%db.uiName) if you're going to have prints with spaces, dashes, etc because it could mess up the variable, this replaces - with DASH, spaces with underscores, and more.
then $customPrint[getSafeVariableName("Your print ui name here")] = "PrintID";

yes getSafeVariableName(%string) is part of the game

Code: [Select]
function FxDTSBrick::onPlant(%this, %obj)
{
%data = %this.getDatablock();

if(%data.uiName $= "Brick-Name")
{
             %printID = int;
             %this.setPrint(%printID);
}
if(%data.uiName $= "Brick-Name2")
{
             %printID = int;
             %this.setPrint(%printID);
}
if(%data.uiName $= "Brick-Name3")
{
             %printID = int;
             %this.setPrint(%printID);
}
if(%data.uiName $= "Brick-Name4")
{
             %printID = int;
             %this.setPrint(%printID);
}

return Parent::onPlant(%this, %obj);
}
Not really, since it only checks one brick each plant (and technically you only plant one brick at a time)
no

function YourBrickData::onPlant(%data, %obj)
{
    //%obj is brick
}