Making AI Repair Hardpoints? [Solved]
Moderator: Moderators
-
Ascertes
- Private Second Class
- Posts: 65
- Joined: Thu Aug 18, 2016 3:42 pm
- Projects :: Space Carida
- xbox live or psn: No gamertag set
Making AI Repair Hardpoints? [Solved]
I'm trying to find out how to get the AI to repair Shield Generators, Mainframes, etc. By default they don't do this on their own (though I swear the CIS AI repaired the defense mainframe once on the Coruscant Space level...) I've browsed through the ODF files for the hardpoints and fusion cutters, but I've found nothing of relevance. I know people have done this before and it's probably super simple, but I can't seem to figure out what values to add or change. Tried searching the forums but came up empty on that front. Anyone know the answer for this?
Last edited by Ascertes on Sun Sep 18, 2016 3:56 pm, edited 1 time in total.
- Oceans14
- Command Sergeant Major

- Posts: 296
- Joined: Mon Apr 27, 2015 7:09 pm
- Projects :: Athenova Campaign
- Location: Planet 4546b
Re: Making AI Repair Hardpoints?
I'm pretty sure AI repair behavior is dependent on the class label of the prop and the unit, as well as the prop's team. If the class label is something like "destructible building" and the unit is a pilot or engineer class, and the prop is on their team, they'll repair it when it's destroyed or damaged. Check the documentation on AI behavior if you haven't already, and check the classes of props like shield generators and whatnot.
-
Ascertes
- Private Second Class
- Posts: 65
- Joined: Thu Aug 18, 2016 3:42 pm
- Projects :: Space Carida
- xbox live or psn: No gamertag set
Re: Making AI Repair Hardpoints?
Auto turret mainframe label: "destructablebuilding"Oceans14 wrote:I'm pretty sure AI repair behavior is dependent on the class label of the prop and the unit, as well as the prop's team. If the class label is something like "destructible building" and the unit is a pilot or engineer class, and the prop is on their team, they'll repair it when it's destroyed or damaged. Check the documentation on AI behavior if you haven't already, and check the classes of props like shield generators and whatnot.
Shield Generator label: "armedbuilding"
Fusion cutter doesn't have either of these labels within its ODF. However, other items that have those class labels the AI WILL repair, like the turrets on Kashyyyk or Naboo. The relevant section for the fusion cutter reads as follows:
Code: Select all
TargetEnemy = "1"
TargetNeutral = "1"
TargetFriendly = "1"
TargetPerson = "0"
TargetAnimal = "0"
TargetDroid = "0"
TargetVehicle = "1"
TargetBuilding = "1"
TargetMine = "1"
LockOnRange = 4.0
LockOnAngle = 90.0
VehicleHealth = 200
BuildingHealth = 100
BuildingBuild = 50
BuildingRebuild = 50
DroidHealth = 0
MineHealth = -1000
As far as AI documentation, I don't have any within my documentation folder. Which doc are you referring to specifically?
- Oceans14
- Command Sergeant Major

- Posts: 296
- Joined: Mon Apr 27, 2015 7:09 pm
- Projects :: Athenova Campaign
- Location: Planet 4546b
Re: Making AI Repair Hardpoints?
https://sites.google.com/site/swbf2modt ... parameters
Go alllllllllll the way down to the "soldier" heading and note those unit types. Some have the ability to repair (pilot, support). I was incorrect when I said it's the unit's class label that matters. It's the unit type.
The fusion cutter settings shouldn't matter. What I would do is add some sort of object that can be damaged, make it friendly to one team, and watch to see if the engineer units (unit class: support) repair it.
Go alllllllllll the way down to the "soldier" heading and note those unit types. Some have the ability to repair (pilot, support). I was incorrect when I said it's the unit's class label that matters. It's the unit type.
The fusion cutter settings shouldn't matter. What I would do is add some sort of object that can be damaged, make it friendly to one team, and watch to see if the engineer units (unit class: support) repair it.
-
Ascertes
- Private Second Class
- Posts: 65
- Joined: Thu Aug 18, 2016 3:42 pm
- Projects :: Space Carida
- xbox live or psn: No gamertag set
Re: Making AI Repair Hardpoints?
I just checked the ODF's for the CIS pilot and engineer, and both their unit types are "pilot". Same goes for both Republic counterparts. The 2 units on each team both use the exact same fusion cutter as the other on their team.Oceans14 wrote:https://sites.google.com/site/swbf2modt ... parameters
Go alllllllllll the way down to the "soldier" heading and note those unit types. Some have the ability to repair (pilot, support). I was incorrect when I said it's the unit's class label that matters. It's the unit type.
The fusion cutter settings shouldn't matter. What I would do is add some sort of object that can be damaged, make it friendly to one team, and watch to see if the engineer units (unit class: support) repair it.
Engineers obviously repair and build stuff, but for some reason the pilots won't. I'm also not seeing anything within these ODF's that would cause such a glaring difference.
-
Marth8880
- Resistance Leader
- Posts: 5042
- Joined: Tue Feb 09, 2010 8:43 pm
- Projects :: DI2 + Psychosis
- xbox live or psn: Marth8880
- Location: Edinburgh, UK
- Contact:
Re: Making AI Repair Hardpoints?
The UnitType needs to be support.
-
Ascertes
- Private Second Class
- Posts: 65
- Joined: Thu Aug 18, 2016 3:42 pm
- Projects :: Space Carida
- xbox live or psn: No gamertag set
Re: Making AI Repair Hardpoints?
Alright, thank you.Marth8880 wrote:The UnitType needs to be support.
But a couple questions:
1. If the unit type needs to be support, why do engineers with the "pilot" UnitType still repair stuff?
2. If I switch the pilot's type in my space map to support, will they not be able to repair the vehicles they are in?
-
Marth8880
- Resistance Leader
- Posts: 5042
- Joined: Tue Feb 09, 2010 8:43 pm
- Projects :: DI2 + Psychosis
- xbox live or psn: Marth8880
- Location: Edinburgh, UK
- Contact:
Re: Making AI Repair Hardpoints?
Sticking this here for reference.

I could swear there was more thorough documentation on the different UnitType values, but I can't seem to find it.[color=#FFFFFF]ODF Parameters.txt[/color] wrote: Scout
Anti-Armor rocket
Assault rocket
Repair
Support repair
Pilot
Trooper
Special - repair
I honestly don't know what to tell you lol. The best answer I can give is that Battlefront is just..."special".Ascertes wrote:1. If the unit type needs to be support, why do engineers with the "pilot" UnitType still repair stuff?
I'm not sure, but it wouldn't be very difficult to test.Ascertes wrote:2. If I switch the pilot's type in my space map to support, will they not be able to repair the vehicles they are in?
-
thelegend
- Sith

- Posts: 1433
- Joined: Thu Jan 23, 2014 6:01 am
- Projects :: Star Wars - Battlefront III Legacy
- xbox live or psn: El_Fabricio#
- Location: Right behind you :)
Re: Making AI Repair Hardpoints?
AINoRepair = "1" disables all AI from repairing it. Maybe by adding: AINoRepair = "0" will help.
-
Samee3
- First Lance Corporal

- Posts: 123
- Joined: Sun Jul 05, 2015 5:07 pm
- Projects :: BF2 Refresh Mod
- xbox live or psn: VaporousFern310
- Location: California, USA
Re: Making AI Repair Hardpoints?
This probably has something to do with AI Goals (Deathmatch, Conquest, CTFOffense, CTFDefense).
So unless you would like to try adding something other than Deathmatch in the script, you're probably not going to get them to do what you want.
So unless you would like to try adding something other than Deathmatch in the script, you're probably not going to get them to do what you want.
-
Ascertes
- Private Second Class
- Posts: 65
- Joined: Thu Aug 18, 2016 3:42 pm
- Projects :: Space Carida
- xbox live or psn: No gamertag set
Re: Making AI Repair Hardpoints?
Here is what I have done:
1. Added AINoRepair = "0" to the auto turret mainframe, no AI moved to repair it.
2. Created a custom unit with the support UnitType armed with a fusion cutter. No luck.
3. Damaged and destroyed the mainframe, in neither case were the AI motivated to fix it.
EDIT: I just tested on Space Coruscant in campaign mode, the AI are in fact repairing the auto mainframe if you destroy it during the mission. Now just have to figure out why they do it there and not anywhere else.
EDIT2: I poured over the LUA for the Space Coruscant mission, and this line stuck out to me:
spa_prop_liquidgen is the ODF for the auto defense mainframes in the game. I wonder if setting that property does anything related (though I'm not sure why it wouldn't just do that via the Team box in ZE...) Any other ideas?
EDIT3: Played the Kashyyyk space mission, lo and behold the AI were repairing that mainframe as well. There was no line about the team for the mainframe though, so I guess that theory is out the window. I think this does have something to do with the campaign AI objectives. It's worth noting the CIS droids will repair their team's mainframe, but the Republic AI will not.
1. Added AINoRepair = "0" to the auto turret mainframe, no AI moved to repair it.
2. Created a custom unit with the support UnitType armed with a fusion cutter. No luck.
3. Damaged and destroyed the mainframe, in neither case were the AI motivated to fix it.
I wouldn't mind giving it a go, personally. Just how complicated is it, though?Samee3 wrote:This probably has something to do with AI Goals (Deathmatch, Conquest, CTFOffense, CTFDefense).
So unless you would like to try adding something other than Deathmatch in the script, you're probably not going to get them to do what you want.
EDIT: I just tested on Space Coruscant in campaign mode, the AI are in fact repairing the auto mainframe if you destroy it during the mission. Now just have to figure out why they do it there and not anywhere else.
EDIT2: I poured over the LUA for the Space Coruscant mission, and this line stuck out to me:
Code: Select all
SetProperty("spa_prop_liquidgen", "Team", 2)EDIT3: Played the Kashyyyk space mission, lo and behold the AI were repairing that mainframe as well. There was no line about the team for the mainframe though, so I guess that theory is out the window. I think this does have something to do with the campaign AI objectives. It's worth noting the CIS droids will repair their team's mainframe, but the Republic AI will not.
- AnthonyBF2
- Sith

- Posts: 1255
- Joined: Wed Aug 21, 2013 3:55 pm
- Projects :: PS2+PSP Overhaul
Re: Making AI Repair Hardpoints?
It may be because the CIS mainframe is part of the objective, and the republic one is not. I may be wrong because I haven't played the campaigns in ages. Study spa3c_c.lua and also study the scripts it calls for at the top of the file and you might get what you want.
-
Ascertes
- Private Second Class
- Posts: 65
- Joined: Thu Aug 18, 2016 3:42 pm
- Projects :: Space Carida
- xbox live or psn: No gamertag set
Re: Making AI Repair Hardpoints?
I'm half tempted to just start adding those scripts to my LUA and see which one gets the AI to repair, though I suspect it will be a little more complicated than that.AnthonyBF2 wrote:It may be because the CIS mainframe is part of the objective, and the republic one is not. I may be wrong because I haven't played the campaigns in ages. Study spa3c_c.lua and also study the scripts it calls for at the top of the file and you might get what you want.
EDIT: After studying both spa2c_c and spa3c_c LUA's, these are the scripts shared between them:
1. setup_teams (though I doubt this is the right one because all maps use that one as well.)
2. ObjectiveAssault
3. MultiObjectiveContainer
4. LinkedShields (I don't think any of the "Linked" scripts are our controllers.)
5. LinkedTurrets
6. LinkedDestroyables
7. PlayMovieWithTransition (Don't see how this could be related.)
So likely suspects are ObjectiveAssault, MultiObjectiveContainer. I'll have to do a little more digging to see if these work properly when added to my LUA.
EDIT2: After reading MultiObjectiveContainer, I don't think this is it either. The LUA description says its sets a number of objectives to be completed, and when all sets are completed. the map ends. That would explain why its only used in campaign LUA's.
EDIT3: Found something interesting! I studied the kashyyyk conquest LUA and there is an objective in there, it reads as follows:
Code: Select all
conquest.OnStart = function(self)
conquest.goal1 = AddAIGoal(REP, "Defend", 30, "gatepanel")
conquest.goal2 = AddAIGoal(CIS, "Destroy", 30, "gatepanel")
conquest.goal3 = AddAIGoal(CIS, "Destroy", 10, "woodl")
conquest.goal4 = AddAIGoal(CIS, "Destroy", 10, "woodc")
conquest.goal5 = AddAIGoal(CIS, "Destroy", 10, "woodr")
conquest.goal6 = AddAIGoal(REP, "Defend", 10, "woodl")
conquest.goal7 = AddAIGoal(REP, "Defend", 10, "woodc")
conquest.goal8 = AddAIGoal(REP, "Defend", 10, "woodr") EDIT4: Added the conquest LUA to my _Diet Dr. Pepper LUA, along with the above code (but replaced the objects with the names of my defense mainframes) no luck...
- Oceans14
- Command Sergeant Major

- Posts: 296
- Joined: Mon Apr 27, 2015 7:09 pm
- Projects :: Athenova Campaign
- Location: Planet 4546b
Re: Making AI Repair Hardpoints?
I honestly don't think AI goals or objective scripts have anything to do with repairs. That said, they're always good to use. I'm interested in this myself now, so when I'm off work I'll run a few tests and report back.
-
Ascertes
- Private Second Class
- Posts: 65
- Joined: Thu Aug 18, 2016 3:42 pm
- Projects :: Space Carida
- xbox live or psn: No gamertag set
Re: Making AI Repair Hardpoints?
Thank you very muchOceans14 wrote:I honestly don't think AI goals or objective scripts have anything to do with repairs. That said, they're always good to use. I'm interested in this myself now, so when I'm off work I'll run a few tests and report back.
- Oceans14
- Command Sergeant Major

- Posts: 296
- Joined: Mon Apr 27, 2015 7:09 pm
- Projects :: Athenova Campaign
- Location: Planet 4546b
Re: Making AI Repair Hardpoints?
Got it. Here's what I did:
Proof:
Code: Select all
1) Set my prop's classlabel to "armedbuilding". In the odf for several space conquest props (poke around in BF2_ModTools\space_template\Worlds\@#$\odf) it is actually noted "was armedbuilding. needs to be armed in order to regen health/shields". So they actually tell you how to get ai to repair stuff, just not very clearly. Anyway...
2) Set prop to team 1 in ZE, since I wanted to see the clone engineer repair the prop once damaged.
3) Save, munge, play. The engineer began to repair the prop immediately after I put a few shots into it. It's worth noting that in subsequent rounds of gameplay the engineers would ignore the prop when engaged in heavy combat. Also, because the prop was set to team 1, team 2 sporadically shot at it. (If desirable, ai goals could be used so that the enemy team (or your team, whatever) focuses more directly on destroying the prop.)Hidden/Spoiler:
-
Ascertes
- Private Second Class
- Posts: 65
- Joined: Thu Aug 18, 2016 3:42 pm
- Projects :: Space Carida
- xbox live or psn: No gamertag set
Re: Making AI Repair Hardpoints?
Well, that doesn't explain though why the AI in space won't repair the hardpoints. The auto defense mainframe's ClassLabel is "armedbuilding", yet the AI refuse to touch it in regular gameplay.Oceans14 wrote:Got it. Here's what I did:
Proof:Code: Select all
1) Set my prop's classlabel to "armedbuilding". In the odf for several space conquest props (poke around in BF2_ModTools\space_template\Worlds\@#$\odf) it is actually noted "was armedbuilding. needs to be armed in order to regen health/shields". So they actually tell you how to get ai to repair stuff, just not very clearly. Anyway... 2) Set prop to team 1 in ZE, since I wanted to see the clone engineer repair the prop once damaged. 3) Save, munge, play. The engineer began to repair the prop immediately after I put a few shots into it. It's worth noting that in subsequent rounds of gameplay the engineers would ignore the prop when engaged in heavy combat. Also, because the prop was set to team 1, team 2 sporadically shot at it. (If desirable, ai goals could be used so that the enemy team (or your team, whatever) focuses more directly on destroying the prop.)Hidden/Spoiler:
I'm going to add engineers to my map just to see what they do.
EDIT: Nope, stock engineers won't repair the mainframes.
- Oceans14
- Command Sergeant Major

- Posts: 296
- Joined: Mon Apr 27, 2015 7:09 pm
- Projects :: Athenova Campaign
- Location: Planet 4546b
Re: Making AI Repair Hardpoints?
Well hang on. A hardpoint is a node on a model that effects and odfs and even unit models can be attached to. AI will never repair hardpoints because they don't know what a hardpoint is. They'll repair props (which I know is what you meant, but I wanted to clarify the terminology). And no, tbh that doesn't explain why they won't repair armedbuildings in space. From what I can tell, their attention isn't fantastic and they'll only repair something if they sort of stumble across it. Since that's the case, you could use the defend goal in combination with hint nodes and pathing to keep some units close to your prop. That way when it takes damage they should already be in the vicinity to set about making repairs.
Also I might point out that if all else fails, you can set a prop to regenerate its health over a period of time with the AddHealth and MaxHealth odf lines.
Also I might point out that if all else fails, you can set a prop to regenerate its health over a period of time with the AddHealth and MaxHealth odf lines.
-
Ascertes
- Private Second Class
- Posts: 65
- Joined: Thu Aug 18, 2016 3:42 pm
- Projects :: Space Carida
- xbox live or psn: No gamertag set
Re: Making AI Repair Hardpoints?
You'll have to explain to me what the defend goal is, but I'll try out the hintnodes. And how would pathing tie into this, because the paths I have go right next to the mainframe.Oceans14 wrote:Well hang on. A hardpoint is a node on a model that effects and odfs and even unit models can be attached to. AI will never repair hardpoints because they don't know what a hardpoint is. They'll repair props (which I know is what you meant, but I wanted to clarify the terminology). And no, tbh that doesn't explain why they won't repair armedbuildings in space. From what I can tell, their attention isn't fantastic and they'll only repair something if they sort of stumble across it. Since that's the case, you could use the defend goal in combination with hint nodes and pathing to keep some units close to your prop. That way when it takes damage they should already be in the vicinity to set about making repairs.
Also I might point out that if all else fails, you can set a prop to regenerate its health over a period of time with the AddHealth and MaxHealth odf lines.
-
AQT
- Gametoast Staff

- Posts: 4910
- Joined: Sat Nov 03, 2007 4:55 pm
- Location: SoCal, USA
Re: Making AI Repair Hardpoints?
AI will repair stuff if their UnitType is "pilot" and if one of their goals is "Conquest." This is similar to how AI will use snipe hint nodes if their UnitType is "sniper" and if one of their goals is "Conquest."
