6.4 Sub-Unit Obj's
When a unit has a specific ability beyond just a simple weapon, it needs a separate Obj that is built off the UnitObj. We'll go through each one.
RestoreObj
This Obj must be included in order for a unit to heal. The following bit comes from the Psitech's config.
RestoreObj()
{
AddHitPoints(12);
Delay(2);
Distance(24);
TargetProperties()
{
Add("Filter::Biological");
Add("Filter::BiologicalFlyer");
Add("Filter::Mechanical");
Add("Filter::MechanicalFlyer");
}
}
AddHitPoints - Number of hit points added per heal cycle
Delay - Frequency of heal cycles
Distance - Maximum range at which it can heal a unit.
TargetProperties - This is where you define what can be healed by the unit you are creating. Each filter type you add will give it the ability to heal all units that have that filter at the beginning of their config. In the case of the Psitech, it can heal all biologicals and mechanicals both on the ground and in the air. This covers every unit currently in the game. The Scaver, however, can only heal mechanicals and mechanical flyers, while the Voodun can only heal biologicals and biological flyers.
WallObj
A WallObj is needed if a unit is to emit a laser fence that attaches to other wall posts. Let's look at the wall config from the Sentinel Gun.
WallObj()
{
Range(6);
BeamOffset(3.0);
DeviationMin(1.0);
DeviationMax(10.0);
Properties();
}
Range - Number of cells that the laser fence can extend.
BeamOffset - Distance in meters between the top and bottom beams.
DeviationMin - Defaults at 1. Don't mess with it.
DeviationMax - The maximum height differential in meters between two posts. So in this case, if a post is placed on a hill that is more than 10 meters above this unit, it will not be able to connect.
Properties - This is where you would place a filter if you wanted the unit to only be able to connect with other walls of a certain type. For example, if you wanted to make a special wall post that was twice as tall as the others and had a much wider beam, you would put a "Filter::Wall::Bigpost" into the properties at the top of the config, and add the same filter to the properties in here. That would prevent the unit from being able to connect with standard wall posts.
TrapObj
This Obj exists specifically for traps. Let's look at the config for the Mine Trap that is layed by the Scaver.
TrapObj()
{
Distance(20);
SelfDestruct(1);
Properties()
{
Add("Filter::Biological");
Add("Filter::Mechanical");
}
}
Distance - Maximum proximity at which the trap will detonate when a unit enters.
SelfDestruct - A flag that specifies whether or not the trap destroys itself when it triggers.
Properties - Specifies which types of units can trigger the trap (see RestoreObj).
ChargeTime - Minimum delay between triggerings, assuming the trap does not self-destruct.
TransportObj
This Obj handles units that can carry other units, such as the Air Barge and Telepad. The following is taken from the Air Barge config.
TransportObj()
{
Spaces(6);
Properties()
{
Add("Filter::Transportable");
}
ChargeTime(90);
PortalType("jda.building.telepadportal");
PortalTime(20);
}
Spaces - How many units can fit inside.
Properties - Specifies which units can enter (see RestoreObj).
Distance - Maximum distance a unit needs to get to before it can enter (used in Air Barge).
NOTE: The following three entries only apply to transports that teleport units:
ChargeTime - Minimum delay between teleports.
PortalType - Refers to the unit that is created on the other end of the teleport, so that units on the other end can pass back through.
PortalTime - Duration that the portal on the other end will exist before disappearing.
SpyObj
A spy has the ability to morph into other units and break into enemy buildings. The following is taken from the JDA Shadowhand.
SpyObj()
{
ResourceRate(20);
PowerLevel(20%);
PowerRate(75);
Properties()
{
Add("Filter::Biological");
}
}
ResourceRate - Rate at which money is stolen when an enemy Refinery is infiltrated. Amount is in units per second.
PowerLevel - Percentage that an advanced power plant's output is reduced to when infiltrated by a spy.
PowerRate - Number of power units that are reduced per second until it reaches the percentage specified by the PowerLevel.
Properties - Specifies which units can be morphed into (Note: For some serious mod wackiness, try adding "Filter::Mechanical").