You should look at CityRPG's code then to learn then.
Creating the object, yeah you could parent onDeath and change the value.
%cash = new Item()
{
datablock = castuffem;
canPickup = false;
value = %amount;
};
When you walk over the item, where it says CityRPG data that's where it adds to the player's data. So that's where you'd put %client.BPGold++ or whatever you wanted to add.
function Armor::onCollision(%this, %obj, %col, %thing, %other)
{
if(%col.getDatablock().getName() $= "Castuffem")
{
if(isObject(%obj.client))
{
if(isObject(%col))
{
if(%obj.client.minigame)
%col.minigame = %obj.client.minigame;
CityRPGData.getData(%obj.client.bl_id).valueMoney += %col.value;
messageClient(%obj.client, '', "\c6You have picked up \c3$" @ %col.value SPC "\c6off the ground.");
%obj.client.SetInfo();
%col.canPickup = false;
%col.delete();
}
else
{
%col.delete();
MissionCleanup.remove(%col);
}
}
}
if(isObject(%col))
parent::onCollision(%this, %obj, %col, %thing, %other);
}
When the item is added to the world this makes a schedule to delete it after a while if nobody picks it up.
function Castuffem::onAdd(%this, %item, %b, %c, %d, %e, %f, %g)
{
parent::onAdd(%this, %item, %b, %c, %d, %e, %f, %g);
schedule($CityRPG::pref::moneyDieTime, 0, "eval", "if(isObject(" @ %item.getID() @ ")) { " @ %item.getID() @ ".delete(); }");
}
And this creates the Castuffem datablock (It just uses the default brick selector model but recolors it.
datablock ItemData(castuffem)
{
category = "Weapon";
className = "Weapon";
shapeFile = "base/data/shapes/brickWeapon.dts";
mass = 1;
density = 0.2;
elasticity = 0.2;
friction = 0.6;
emap = true;
doColorShift = true;
colorShiftColor = "0 0.6 0 1";
image = cashImage;
candrop = true;
canPickup = false;
};
datablock ShapeBaseImageData(cashImage)
{
shapeFile = "base/data/shapes/brickWeapon.dts";
emap = true;
doColorShift = true;
colorShiftColor = castuffem.colorShiftColor;
canPickup = false;
};