Blockland Forums > Modification Help
FarmMod
(1/5) > >>
Freebuild:
Recently I have tried to code something called Farm Mod. I got the brick and stuff working and all, I can place it.

But apparently whenever I click it, it doesn't do anything. Since there's probably a ton of people on the forums. I was wondering if you could help me out.

Here is the code.


--- Code: ---datablock fxDTSBrickData(FarmRPGBlueberryData)
{
brickFile = "Add-Ons/Script_FarmMod/brickShapes/1x1F.blb";
category = "Farm Mod";
subCategory = "Small Plants";
uiName = "Blueberry Plant";
iconName = "Add-Ons/Script_FarmMod/brickIcons/blueberry.png";
};

function FarmRPGBlueberryData::Plant(%datablock, %client)
{
%datablock.setcolor(54);
}


function FarmRPGBlueberryData::Activate(%datablock, %client)
{
if(!%datablock.isWatered)
{
messageClient(%client,'',"\c6You have watered your \c5blueberry\c6 plant.");
%datablock.isWatered = 1;
schedule(120000,0,eval,"%datablock.growth = 1;");
schedule(120000,0,eval,"%datablock.setcolor(55);");
schedule(120000*2,0,eval,"%datablock.growth = 2;");
schedule(120000*2,0,eval,"%datablock.setcolor(56);");
schedule(120000*3,0,eval,"%datablock.growth = 3;");
schedule(120000*3,0,eval,"%datablock.setcolor(57);");
schedule(120000*4,0,eval,"%datablock.growth = 4;");
schedule(120000*4,0,eval,"%datablock.setcolor(58);");
schedule(120000*5,0,eval,"%datablock.growth = 5;");
schedule(120000*5,0,eval,"%datablock.setcolor(59);");
}
else if(%datablock.isWatered)
{
messageClient(%client,'',"\c6You have already watered your \c5blueberry\c6 plant!");
}
else if(%datablock.growth = 1)
{
messageClient(%client,'',"\c6The \c5blueberry\c6 plant is \c320\c6% done!");
}
else if(%datablock.growth = 2)
{
messageClient(%client,'',"\c6The \c5blueberry\c6 plant is \c340\c6% done!");
}
else if(%datablock.growth = 3)
{
messageClient(%client,'',"\c6The \c5blueberry\c6 plant is \c360\c6% done!");
}
else if(%datablock.growth = 4)
{
messageClient(%client,'',"\c6The \c5blueberry\c6 plant is \c380\c6% done!");
}
else if(%datablock.growth = 5)
{
messageClient(%client,'',"\c6You harvested your \c5blueberry \c6plant!");
%datablock.growth = 0;
%datablock.setcolor(63);
%datablock.isWatered = 0;
%client.blueberry += 1;
}
return;
}
--- End code ---

Post if any of you can fix this. It should work a LITTLE BIT like Cromedome's drug mod.

There is no syntax errors or anything, its all clean. It just doesn't do anything on activate.


Thanks for your help :)
FFSO:
EDIT: Topic was moved by Badspot.
Headcrab Zombie:
It's onActivate, not Activate

Also I believe onActivate will only be called if there is an onActivate event on the brick
Ephialtes:

--- Code: ---else if(%datablock.growth = 1)
--- End code ---

Really?
jes00:
You might wanna also change:

--- Code: ---function FarmRPGBlueberryData::Plant(%datablock, %client)
{
%datablock.setcolor(54);
}

--- End code ---
To:

--- Code: ---function FarmRPGBlueberryData::onPlant(%datablock, %client)
{
%datablock.setcolor(54);
}

--- End code ---
Navigation
Message Index
Next page

Go to full version