Blockland Forums > Modification Help

Breaking onActivate

Pages: << < (2/5) > >>

cheese6:


--- Code: ---package JunkTrunk
{
function fxDTSBrick::onActivate(%obj, %player, %client, %pos, %vec)
{
%data = %obj.getDataBlock();

if(%data.getid() == SellBrickData.getId())
{
messageAll('', "\c2" @ %client.name @ " clicked the test brick!");
}
Parent::OnActivate(%obj, %player, %client, %pos, %vec);
}
};
activatePackage(JunkTrunk);
--- End code ---


Amade:

Since you're only doing this for one datablock it can be simplified significantly and wouldn't need to be packaged.
--- Code: ---function SellBrickData::onActivate(%obj, %player, %client, %pos, %vec)
{
messageAll('', "\c2" @ %client.name @ " clicked the test brick!");
Parent::OnActivate(%obj, %player, %client, %pos, %vec);
}
--- End code ---


cheese6:


--- Quote from: Amade on November 08, 2011, 04:15:23 PM ---Since you're only doing this for one datablock it can be simplified significantly and wouldn't need to be packaged.
--- Code: ---function SellBrickData::onActivate(%obj, %player, %client, %pos, %vec)
{
messageAll('', "\c2" @ %client.name @ " clicked the test brick!");
Parent::OnActivate(%obj, %player, %client, %pos, %vec);
}
--- End code ---

--- End quote ---
true. :P

jes00:


--- Quote from: Amade on November 08, 2011, 04:15:23 PM ---Since you're only doing this for one datablock it can be simplified significantly and wouldn't need to be packaged.
--- Code: ---function SellBrickData::onActivate(%obj, %player, %client, %pos, %vec)
{
messageAll('', "\c2" @ %client.name @ " clicked the test brick!");
Parent::OnActivate(%obj, %player, %client, %pos, %vec);
}
--- End code ---

--- End quote ---
Thanks Amade!

Now how could I make a function that checks if %client.Ore is above one and if it is sells %client.Ore for one gold each and tells you how much it sold for? and if %client.Ore is below one it says "You do not have any ore to sell"?

Amade:


--- Quote from: jes00 on November 09, 2011, 06:04:38 AM ---Thanks Amade!

Now how could I make a function that checks if %client.Ore is above one and if it is sells %client.Ore for one gold each and tells you how much it sold for? and if %client.Ore is below one it says "You do not have any ore to sell"?
--- End quote ---
I'm having trouble believing you're unable to do this. Have you tried to script this?

Pages: << < (2/5) > >>

Go to full version