Get rid of a unique unit

Here's the code you need:

No, that is NOT what you need. Do that, and everything will break because there are still a half-dozen other tables that reference the Longbowman, and deleting the item they refer to will cause the whole thing to stop working. To delete a unit, building, etc. you have to clean up ALL of those as well; there's a simple command for that, but it's a very unsafe process since there might be something more complex than simple direct reference that uses it.

The simplest way to do this is to remove the UU override that causes England to use the Longbowman instead of the standard Crossbowman. Specifically,
Code:
<GameData>
  <Civilization_UnitClassOverrides>
    <Delete UnitType="UNIT_ENGLISH_LONGBOWMAN"/>
  </Civilization_UnitClassOverrides>
</GameData>

Do this, and it simply resets England back to the default for the Crossbowman unit class. The Longbowman unit will still be in the database, but no one will use it.
 
No, that is NOT what you need. Do that, and everything will break because there are still a half-dozen other tables that reference the Longbowman, and deleting the item they refer to will cause the whole thing to stop working. To delete a unit, building, etc. you have to clean up ALL of those as well; there's a simple command for that, but it's a very unsafe process since there might be something more complex than simple direct reference that uses it.

The simplest way to do this is to remove the UU override that causes England to use the Longbowman instead of the standard Crossbowman. Specifically,
Code:
<GameData>
  <Civilization_UnitClassOverrides>
    <Delete UnitType="UNIT_ENGLISH_LONGBOWMAN"/>
  </Civilization_UnitClassOverrides>
</GameData>

Do this, and it simply resets England back to the default for the Crossbowman unit class. The Longbowman unit will still be in the database, but no one will use it.

Spatz, this is not true. I've deleted individual unique units before with no crippling effect on the game. Even though other things reference it, it will have no noticeable effect on gameplay.

Not to mention, you may run into civilization select screen errors if your civs are missing a UU. I don't know if it'll work with two UBs, but every civilization I've seen the UI not work correctly when there is no UU attached to the civilization. Although, that may be because there was a UU defined for the civilization but the unit was missing.
 
Spatz, this is not true. I've deleted individual unique units before with no crippling effect on the game. Even though other things reference it, it will have no noticeable effect on gameplay.

I HAVE had it crash when you deleted individual items without removing all references to it. In fact, I just had a crash bug in my own mod last week along these lines; granted, that was with the deletion of a Promotion instead of a unit. I'd removed the Accuracy and Barrage promotion lines and rolled their effects into Shock and Drill, and the fact that promotion IDs #7-12 were now not used caused the game to crash every time it tried to load.
What happened was, in a patch back in March, the devs finally fixed it so that you could have missing IDs in certain tables without it crashing, but they didn't do this for every table. So for many tables, a Delete command just won't work correctly, and you're better off finding a way to disable the individual item without deleting the underlying entries. And part of this problem is also just tied to missing referents in secondary tables; in some cases, the file will just fail entirely, in others it'll fail gracefully and the user will never know.

Not to mention, you may run into civilization select screen errors if your civs are missing a UU.

There is that. I've never actually tried to see what'd happen if you were to have double UBs.
 
Spatzimaus, I do feel you could have put that across a little more gracefully mate! The method I used was copied straight from Putmalk's mod and it's always worked for me without any crashes or hiccups - though to be fair, what I didn't add is that I also went through the units.xml file and deleted all references to it (such as unitflavours). I would have also deleted the unit class if it were the only unit in that class (or modified it if it were the default unit), though this isn't the case for the longbowman.
 
ok, so everything in the entire mod is actually working perfectly now (to my knowledge :p ). Recoded it so it uses spatz code now. There was a problem where I guess I didn't have the delete commands "high" enough in the load cycle which was causing the mod to load old deleted units. Solved by making the first file loaded a "delete" file (ie a file which only contains delete commands)

edit - I should thank you guys for helping me out too
 
Hi, I'm fairly new as you can see and am trying to do something similar to this, but not quite. I want to make the Great General a strong early fighting unit, just so it isn't so useless. I have found the codes to make this work for the most part, but a curious thing occurs. When I go to attack with it I get the tool tip that tells me the attack ratios, but when the time comes to actually smite the enemy nothing happens. I notice non-combat units have the following line:

<CombatLimit>0</CombatLimit>

I also notice no combat units have this line so simply changing the value won't work... correct?

So, can I simply delete the parameter altogether somehow? With some version of the above?

Something like:

<Units>
<type = "Great_General"/>
<Delete {???}="Combatlimit"/>
</Units>

I understand the rest of the issue in adding a combat parameter and the other issues like unitai and such.

Any help is appreciated, and I hope piggy backing this thread is ok...
 
Hi, I'm fairly new as you can see and am trying to do something similar to this, but not quite. I want to make the Great General a strong early fighting unit, just so it isn't so useless. I have found the codes to make this work for the most part, but a curious thing occurs. When I go to attack with it I get the tool tip that tells me the attack ratios, but when the time comes to actually smite the enemy nothing happens. I notice non-combat units have the following line:

<CombatLimit>0</CombatLimit>

I also notice no combat units have this line so simply changing the value won't work... correct?

So, can I simply delete the parameter altogether somehow? With some version of the above?

Something like:

<Units>
<type = "Great_General"/>
<Delete {???}="Combatlimit"/>
</Units>

I understand the rest of the issue in adding a combat parameter and the other issues like unitai and such.

Any help is appreciated, and I hope piggy backing this thread is ok...

Hi Jagged1971,

The default value for CombatLimit is "100". You can view this at the top of the XML where the values are defined. Therefore, all units that don't have CombatLimit explicitly defined is automatically set to a value of 100. So, you'll want to update that value to 100.

Thus,

Code:
<Units>
 <Update>
  <Where Type="UNIT_GREAT_GENERAL"/>
  <Set>
   <CombatLimit>100</CombatLimit>
   <CivilianAttackPriority></CivilianAttackPriority>
   <Combat>X</Combat> <!-- X is whatever number you choose -->
  </Set>
 </Update>
</Units>

Hope this helps.
 
Thank you for the response!

I tried this, but it did not fix the problem, although I'm sure it took care of whatever combatlimit does.

It's a wierd issue. I also looked back through the tutorial in the unit creation section, and went ahead and updated all the unitai stuff as well, just in case that might contribute, but none of that helped either. I guess my issue is a little different than this one after all, sorry for derailing...
 
Thank you for the response!

I tried this, but it did not fix the problem, although I'm sure it took care of whatever combatlimit does.

It's a wierd issue. I also looked back through the tutorial in the unit creation section, and went ahead and updated all the unitai stuff as well, just in case that might contribute, but none of that helped either. I guess my issue is a little different than this one after all, sorry for derailing...

It's probably <Special></Special>. I've never tried to convert a civilian to a combat unit before, though....
 
Hmmm... Ok, well it was kind of just an thought on a way to make the Great General a little more useful, at least in the early game. I also had in mind that you would play him until he dies and his death would touch off a golden age, but I'm probably not nearly advanced enough to make that work.

Ah well. Thanks again for trying!
 
Hmmm... Ok, well it was kind of just an thought on a way to make the Great General a little more useful, at least in the early game. I also had in mind that you would play him until he dies and his death would touch off a golden age, but I'm probably not nearly advanced enough to make that work.

Ah well. Thanks again for trying!

Well that last bit requires LUA. But don't give up in trying to convert him to a combat unit! Keep trying, you'll get it. It's very possible your mod isn't actually updating changes...do you have proof that some of the changes are working, at least?
 
Hi, just caught your last reply.

Yes, some of the changes are working. I set the value on the "start golden age" a little different just so I could gauge whether or not I had the whole thing right. I went ahead and made a thread for this in case someone else needs this one back... It lists the code as it stood yesterday. I've only tweaked it a tad since.
 
Top Bottom