Author Topic: Getting a brick's color in the colorset and more  (Read 979 times)

I'm working on a salvaging-based gamemode, somewhere between Salvage Mod and Honor Mining (carried variables/valuables) but I'm having some trouble. Issues are:
1. Is there an fxdts function to get the paint color of an existing brick (as in, the number of the brick's color in the "paint can" table)? If so, what is it, and if not, how do I make one?

2. Do the same functions exist with Color FX and Shape FX?

3. What do I use to call a function on a brick when said brick is painted/fillcanned/has it's color changed by an event? (I know onPlant and onLoadPlant, but not the "on painted")

4. What is the ratio of brick mass (in plates) to brick health, and how does it differ when transparency is involved?

5. How do I make a "materials list" for bricks based on above color, color fx, and shape fx? Remember, I want to get the material from the brick, not the other way around. Should I use the color, color fx, and shape fx functions in a switch and have the default case centerprint the client "This brick cannot be salvaged"? Or should I use some sort of script object? If I have to use a script object, how do I apply it's effects to an existing brick?

6. Is there a sethealth function for bricks?Never mind this, I think Salvage Mod has one.

7. Is there a way to load one "base" save and then afterwards load in certain locations one randomly generated save? I ask because I want the area (it's an enormous underwater pit) to be somewhat randomized, with sunken wrecks in different places every round.

Keep in mind that I'm a real noob at scripting, and I can only learn from stuff that works (and even then I have trouble).

1. Do a dump of any brick to find it (%brick.dump();)
2. Yes, look through the dump
3. Search for something like onColorChange in the forums
4. Make your own system, it doesn't really matter. Default probably uses volume as a direct relationship though
5. Save a value to the object, such as %brick.material = wood;
6. Ok
7. This is a pretty complicated thing and is significant enough to deserve its own topic. I recommend you use a different method for creating the salvage area

I'm working on a salvaging-based gamemode, somewhere between Salvage Mod and Honor Mining (carried variables/valuables) but I'm having some trouble. Issues are:
1. Is there an fxdts function to get the paint color of an existing brick (as in, the number of the brick's color in the "paint can" table)? If so, what is it, and if not, how do I make one?
%brickObject.getColorID();
2. Do the same functions exist with Color FX and Shape FX?
%brickObject.getColorFxID();
What do I use to call a function on a brick when said brick is painted/fillcanned/has it's color changed by an event? (I know onPlant and onLoadPlant, but not the "on painted")
function FxDTSBrick::onColorChange(%brick, %color)

Screw the painting, I won't need to repaint something while the salvage game is running anyway. But I do need some other stuff answered.
1. Should I have onPlant and onLoadPlant use (%this) or (%brick)? And will a function fxDTSbrick::onPlant or onLoadPlant effect every brick or only one datablock? And do I need to put in a parent return as well?
(I'm really new at this, and it shows.)

Screw the painting, I won't need to repaint something while the salvage game is running anyway. But I do need some other stuff answered.
1. Should I have onPlant and onLoadPlant use (%this) or (%brick)? And will a function fxDTSbrick::onPlant or onLoadPlant effect every brick or only one datablock? And do I need to put in a parent return as well?
(I'm really new at this, and it shows.)
Code: [Select]
function fxDTSbrick::OnPlant(%brick)
{
    Parent::OnPlant(%brick);
    //Your code
}
The above affects all bricks. You shouldn't need to return the parent for this function, I believe
« Last Edit: August 11, 2012, 02:16:18 PM by Treynolds416 »

Code: [Select]
fxDTSbrick::OnPlant(%brick)
{
    Parent::OnPlant(%brick);
    //Your code
}
The above affects all bricks. You shouldn't need to return the parent for this function, I believe
Ah, gotcha. Thanks!

I forgot to write function in front of fxDTSbrick

I forgot to write function in front of fxDTSbrick
's ok, I realized that.
I once crashed Tomtom's Unlimited Mining by forgetting two semicolons in the ores I was adding lol

Wait, are you sure it's %brickObject and not %brick? Or does %brickObject work in any function that uses %brick?

Wait, are you sure it's %brickObject and not %brick? Or does %brickObject work in any function that uses %brick?
What are you asking. The local variable can be named whatever you want, as long as you use the same thing inside the function

What are you asking. The local variable can be named whatever you want, as long as you use the same thing inside the function
I'm trying to ask if
Code: [Select]
function fxDTSbrick::onplant(%brick)
{
Parent::onPlant(%brick);
%brick.loadSalvageness();
echo("Brick planted, loading salvageness");
}
function fxDTSbrick::onLoadPlant(%brick)
{
Parent::onLoadPlant(%brick);
%brick.loadSalvageness();
echo("Brick loaded, loading salvageness");
}
function fxDTSbrick::loadSalvageness(%brick)
{
%color = %brickObject.getColorID();
echo("Got color ID: " @ %color);
%colorFX = %brickObject.getColorFxID();
echo("Got color FX ID: " @ %colorFX);
%shapeFX = %brickObject.getShapeFxID();
echo("Got shape FX ID: " @ %shapeFX);
}
will work when I used %brick AND %brickObject. Or do I have to define %brick somewhere?
EDIT: Realized I forgot the () for loadSalvageness.
EDIT2: I just realized that %brick is the variable representing the brick  being planted
« Last Edit: August 11, 2012, 04:14:05 PM by YourBuddyBill »

Any local variables you use must be defined within the function you are using it for. The value of %brickObject is "" until you set it to something else.

Any local variables you use must be defined within the function you are using it for. The value of %brickObject is "" until you set it to something else.

Got it. So if I change %brickObject to %brick, will it work properly?

Got it. So if I change %brickObject to %brick, will it work properly?
Yes because %brick is a brick's object -_-