I haven´t used this code often, only seen it in one of Asuka´s and Stygs´ mods, so take this as more of a rough guideline - it should work this way, but I might be missing something.
First, you have to define the value of the crystals. To do so, add
BountyValue="####" (where #### is whatever you want Tiberium to be worth) to the
TiberiumCrystal´s and
TiberiumCrystalBlue´s
GameObject element (the first element that also defines cost, buildtime etc.).
Next, you have to enable the bounty by using an
AttributeModifier. It should look like this:
<AttributeModifier
id="AttributeModifier_TibBounty"
Category="NONE"
Duration="1s"
StackingLimit="1" >
<Modifier Type="BOUNTY_PERCENTAGE" Value="100"/>
</AttributeModifier>
Now, all you need is a weapon that applies this to the crystals and then kills them. Make sure to have the Damage triggered after the AttributeModifier though (but before it runs out):
<WeaponTemplate
id="TiberiumReaper"
Name="TiberiumReaper"
ProjectileCollidesWith = "ALLIES ENEMIES NEUTRAL STRUCTURES WALLS"
RadiusDamageAffects="ALLIES ENEMIES NEUTRALS" >
<Nuggets>
<DamageNugget
Damage="99999"
DelayTimeSeconds="0.5s"
DamageType="CANNON"
Radius="10"
DeathType="NORMAL" >
<SpecialObjectFilter Rule="NONE">
<IncludeThing>TiberiumCrystal</IncludeThing>
<IncludeThing>TiberiumCrystalBlue</IncludeThing>
</SpecialObjectFilter>
</DamageNugget>
<AttributeModifierNugget
PartitionFilterTestType="SPHERE"
AttributeModifierName="AttributeModifier_TibBounty"
Radius="10">
<SpecialObjectFilter Rule="NONE">
<IncludeThing>TiberiumCrystal</IncludeThing>
<IncludeThing>TiberiumCrystalBlue</IncludeThing>
</SpecialObjectFilter>
</AttributeModifierNugget>
</Nuggets>
</WeaponTemplate>
Add this to the harvester with a
FireWeaponUpdate (
FireWeaponCollide could work too) and you´re ready to go.
Note that AttributeModifiers seem to have a hardcoded minimum update frequency, so you might have to increase the delays and durations a bit.
Edited by Golan, 08 January 2009 - 10:38 AM.