Ok, I'm working on a gamemode that's like Salvage Mod meets Honor Mining. It's called Bellkel, don't ask why.
However, I'm not very good at scripting, so could someone tell me what I should do here?
I currently have a scriptgroup for the material data like Unlimited Mining uses, but Bellkel doesn't use one datablock for salvageable materials, and I want a way to call the material's properties after setting the material to the brick. I'm not sure how to do this.
Here's what I got, with just a sample of the scriptgroup:
if ( !isObject(BellkelData) )
{
new SimSet(BellkelData)
{
//new ScriptObject(Material)
//{
// fakename = "
// value =
// hp =
// mass =
// variable = "
//}
//new ScriptObject(Material)
//{
// fakename = "
// value =
// hp =
// mass =
// variable = "
// name = "
// toolminlevel = "
//}
new ScriptObject(Material)
{
fakename = "Stone";
value = 1;
hp = 1;
mass = 4;
variable = "Stone";
}
new ScriptObject(Material)
{
fakename = "Wood";
value = 1;
hp = 1;
mass = 1;
variable = "Wood";
}
new ScriptObject(Material)
{
fakename = "Cloth";
value = 1;
hp = 1;
mass = 1;
variable = "Cloth";
}
new ScriptObject(Material)
{
fakename = "Coal";
value = 3;
hp = 3;
mass = 3;
variable = "Coal";
}
new ScriptObject(Material)
{
fakename = "Glass";
value = 1;
hp = 1;
mass = 2;
variable = "Glass";
}
new ScriptObject(Material)
{
fakename = "Bone";
value = 1;
hp = 1;
mass = 1;
variable = "Bone";
}
new ScriptObject(Material)
{
fakename = "Darkwood";
value = 2;
hp = 2;
mass = 1;
variable = "Darkwood";
}
new ScriptObject(Material)
{
fakename = "Steel";
value = 11;
hp = 11;
mass = 3;
variable = "Steel";
}
}
}
And then
package BellkelConvert
{
function fxDTSbrick::onplant(%brick)
{
Parent::onPlant(%brick);
%brick.loadSalvageness();
echo("Brick planted, loading salvageness");
}
function fxDTSbrick::onLoadPlant(%brick)
{
Parent::onLoadPlant(%brick);
%brick.loadSalvageness();
%brick.materialname
echo("Brick loaded, loading salvageness");
}
function fxDTSbrick::loadSalvageness(%brick)
{
%color = %brick.getColorID();
echo("Got color ID: " @ %color);
%colorFX = %brick.getColorFxID();
echo("Got color FX ID: " @ %colorFX);
%shapeFX = %brick.getShapeFxID();
echo("Got shape FX ID: " @ %shapeFX);
//Datablock override
%mainresult = %brick.exceptionvaluecheck();
if(%mainresult !$= "NothingSpecial" && %mainresult !$= "Barrel")
{
//do something different
}
else if (%mainresult $= "Barrel")
{
}
else if(%mainresult $="NothingSpecial")
{
%brick.material = %brick.colorCheck(%color, %colorFX, %shapeFX);
}
}
//Funct: Searches to see if there's a special result for the datablock in question
//Sends: "NothingSpecial" or a material
function fxDTSbrick::exceptionValueCheck(%brick)
{
%Datablock = %brick.getDataBlock();
switch$(%datablock)
{
case "brickTreasureChestData":
%lock = mFloor(getRandom(1, 50));
if (%lock >= 48)
{
return "LockedChest";
}
else
{
return "TreasureChest";
}
case "brick1x1MugData":
%result = "Ceramics";
case "brick2x2fPlateData":
%result = "Ceramics";
case "brick1x2fKeyboardData":
%result = "WetElectronics";
case "brick1x2fKnifeNForkData":
%result = "Silver";
case "brick2x3x2Computer1Data":
%result = "WetElectronics";
case "brick2x3x2Computer2Data":
%result = "WetElectronics";
case "brick2x3x2Computer3Data":
%result = "WetElectronics";
case "brick2x4x7FlatscreenData":
%result = "WetElectronics";
case "brick4x4x15FridgeData":
%result = "WetElectronics";
case "brick4x4x9OvenData":
%result = "WetElectronics";
case "brickTeledoorData":
%result = "Nope";
case "brick1x1x5AntennaData":
%result = "WetElectronics";
case "brickBarrelData":
%result = "Barrel";
case "brickBarrel2Data":
%result = "Barrel";
case "brick2x2FBookHorizData":
%result = "WetBooks";
case "brick1x2BookVertData":
%result = "WetBooks";
case "brick2x2BookDiagData":
%result = "WetBooks";
case "brick2x2BookDiagLData":
%result = "WetBooks";
case "brickCheckpointData":
%result = "Nope";
case "brick2x2x5PresentData":
%result = "Gift";
case "brick2x2x5PresentTwoData":
%result = "Gift";
case "brick2x2x5PresentThreeData":
%result = "Gift";
case "brickClockData":
%result = "Electronics";
case "mugEmptyData":
%result = "Ceramics";
case "mugFullData":
%result = "Ceramics";
case "brick2x2PictureFrameData":
%result = "Picture";
case "brick3x4x5VendingMachineData":
%result = "WetElectronics";
case "brick1x1CupData":
%result = "Ceramics";
case "brickPumpkinBaseData":
%result = "MessyFood";
case "brickPumpkinFaceData":
%result = "MessyFood";
case "brickPumpkinScaredData":
%result = "MessyFood";
case "brickPumpkinAsciiData":
%result = "MessyFood";
case "brick2x2x5BarrelData":
%result = "Barrel";
case "brick3x3x2CrabData":
%result = "Crabs";
case "brick2x2FBookHorizPrData":
%result = "WetBooks";
case "brick1x2BookVertPrData":
%result = "WetBooks";
case "brick2x2BookDiagPrData":
%result = "WetBooks";
case "brick2x2BookDiagLPrData":
%result = "WetBooks";
case "brick2x2x5BarrelData":
%result = "Barrel";
default:
%result = "NothingSpecial";
}
return %result;
}
function fxDTSbrick::colorcheck(%brick, %color, %colorFX, %shapeFX)
{
if (%shapefx == 2)
{
return "Nope";
}
else if (%shapefx == 1)
{
if ((%colorfx == 0 || %colorfx == 3));
{
if ((%color == 17 || (%color >= 27 && %color <= 35)|| %color == 44))
{
return "Liquids";
}
else
{
return "Cloth";
}
}
else if ((%colorfx == 2 && %color == 41));
{
return "Evanadium";
}
else
{
return "Nope";
}
} //That was almost too easy. I probably screwed it up somewhere.
else if (%shapefx == 0)
{
if (%colorfx == 0)
{
if ((%color >= 4 && %color <= 7)) //Are these double ()s really needed? Idk.
{
return "Stone";
}
else if ((%color == 3 || %color == 20 || %color == 48))
{
return "Wood";
}
else if ((%color == 16))
{
return "Coal";
}
else if ((%color == 17 || (%color >= 27 && %color <= 35) || %color == 44))
{
return "Glass";
}
else
{
return "Nope";
}
}
else if (%colorfx == 1)
{
if ((%color == 6))
{
return "Steel";
}
else if ((%color == 28))
{
%bug = mFloor(getRandom(1, 50));
if (%bug >= 49)
{
return "Amberbug";
}
else
{
return "Amber";
}
}
else
{
return "Nope";
}
}
else if ((%colorfx == 2))
{
if ((%color == 5))
{
return "Quicksilver";
}
else
{
return "Nope";
}
}
else if ((%colorfx == 3))
{
if ((%color == 15))
{
return "Lightstone";
}
else
{
return "Nope";
}
}
else
{
return "Nope";
}
}
else
{
return "Nope";
}
}
You get the idea. There's more materials than that.
Anyways, how do I call the given properties of the material specified?