Buildings Auto Repair

Modding, Map Editor, IES Scripting and Other Questions
Post Reply
Deadly
Posts: 3
Joined: 16 Jul 2016, 14:04

Buildings Auto Repair

Post by Deadly »

i want to make buildings auto repair when near certain buildings just like how troops get auto healed when near town center, however i cant seem to figure ut out how. any leads ?

// city-related area effect
DbAreaEffectInfo CityHeal
{
name = text_uarea_cityheal_name
desc = text_uarea_cityheal_desc
button = ""
selectionType = None

effects = [
// One for me...
EffectHeal {
range = CityUnitIsIn
radius = 0 // implied through range
mask = LandRPS
player = Self
upgradeFactor = CityHealRate
applyEffectHealRateModifier = true
}
// One for mah homies... yeeeah
EffectHeal {
range = CityUnitIsIn
radius = 0 // implied through range
mask = LandRPSNoSpy // Don't heal allies' spies.
player = Allies
upgradeFactor = CityHealRate
applyEffectHealRateModifier = true
EffectHeal {
}
range = CityUnitIsIn
radius = 0 // implied through range
mask = Buildings
player = Self
upgradeFactor = CityHealRate
applyEffectHealRateModifier = true
}
// One for mah homies... yeeeah
EffectHeal {
range = CityUnitIsIn
radius = 0 // implied through range
mask = Buildings
player = Allies
upgradeFactor = CityHealRate
applyEffectHealRateModifier = true
}
]
}




this is what i have done, tried to integrate auto repair to city heal, but apparently it didnt worked, looks like i have UPGRADEFACTOR wrong, any leads on this will be appreciated

User avatar
Dr.MonaLisa
High Representative
Posts: 8697
Joined: 17 Jun 2010, 11:21
Location: Poland
Has thanked: 49 times
Been thanked: 108 times

Re: Buildings Auto Repair

Post by Dr.MonaLisa »

If you use Unofficial Patch 1.5 (non developers version), then you need to add this effect to file:
\zips\dbareaeffects_unittype.ddf
for both, EE2 and AOS use the same file!

Then you need to attach this effect to some unit, for example city center. So you should edit file:
\zips\db_155.zip\db\Units\city_center_15.ddf
Change:

Code: Select all

effects = [ 
				CityHeal
				CityResistCapture
			]
to:

Code: Select all

effects = [ 
				CityHeal
				CityResistCapture
				YourNewEffectName
			]
Then the game should read your effect and repair buildings (if the effect is correct).
If the game crashes on launch after your modification, then the effect has some errors that you need to find and fix.
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
Deadly
Posts: 3
Joined: 16 Jul 2016, 14:04

Re: Buildings Auto Repair

Post by Deadly »

well, i did all that but it didnt worked, no crashes, i think i really need to what what type of upgradefactor i should add o.o

here's the code

Code: Select all

DbAreaEffectInfo AutoRepair
{
	name = text_uarea_cityheal_name
	desc = text_uarea_cityheal_desc
	button = ""
	selectionType = None

	effects = [
		// One for me...
		EffectHeal {
			range = CityUnitIsIn
			radius = 0		// implied through range
			mask = Buildings
			player = Self
			upgradeFactor = RepairRate
			applyEffectHealRateModifier = true
		}
		// One for mah homies... yeeeah
		EffectHeal {
			range = CityUnitIsIn
			radius = 0		// implied through range
			mask = Buildings
			player = Allies
			upgradeFactor = RepairRate
			applyEffectHealRateModifier = true
		}
	]
}
added that to outpost

Code: Select all

abilities = [
		Attack { range = 0; reloadTime = 1; applyDamageTime = 0.0; damage = 0; missileName = "Arrow"; angularRange = 360 }
		LOS { range = 0 }
		AreaEffectCity {
			CityRadius = 15.0
			RepairRate = 12		// per second
			effects = [ 
				AutoRepair
			]
		}
	]
}
User avatar
Dr.MonaLisa
High Representative
Posts: 8697
Joined: 17 Jun 2010, 11:21
Location: Poland
Has thanked: 49 times
Been thanked: 108 times

Re: Buildings Auto Repair

Post by Dr.MonaLisa »

Then your effect is incorrect maybe?
I found some auto-repair effect from iwanicki's Realistic mod:

Code: Select all

DbAreaEffectInfo FactoryRepair
{
	button = ""
	selectionType = None
      effects = [
		 EffectVisualGlow {
			range = RadiusFromUnit
			radius = 7
			mask = FactoryRepairUnits
			player = Self
			OwnerOnly = true
			Icon = spr_game_unitinfFacRep
			Tooltip = tt_power_factory_fallout
			VTooltip = vtt_power_factory_fallout
		}
             EffectHeal {
			range = RadiusFromUnit
			radius = 7
			mask = FactoryRepairUnits
			player = Self
			healRate = 30
		}
            
	]
}
Try to re-make it to work with city centers and buildings you want to repair.
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
Deadly
Posts: 3
Joined: 16 Jul 2016, 14:04

Re: Buildings Auto Repair

Post by Deadly »

finally got it to work

Code: Select all

DbAreaEffectInfo AutoRepair
{
	name = text_uarea_cityheal_name
	desc = text_uarea_cityheal_desc
	button = ""
	selectionType = None

	effects = [
		EffectHeal {
			range = CityUnitIsIn
			radius = 0		// implied through range
			mask = Buildings	
			player = Self
			upgradeFactor = CityHealRate
			applyEffectHealRateModifier = true
		}
		EffectHeal {
			range = CityUnitIsIn
			radius = 0		// implied through range
			mask = Buildings	
			player = Allies
			upgradeFactor = CityHealRate
			applyEffectHealRateModifier = true
		}
	]
}
that will give area effect healing to the buildings nearby
User avatar
Dr.MonaLisa
High Representative
Posts: 8697
Joined: 17 Jun 2010, 11:21
Location: Poland
Has thanked: 49 times
Been thanked: 108 times

Re: Buildings Auto Repair

Post by Dr.MonaLisa »

I would modify it a little. You don't need separated player for Allies and Self. There are options for both. I don't remember now but it can be found in hdrs.zip.
Also how many health points are restored by this effect?
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains
Post Reply

Return to “Questions”