Limiting upgrades?

jefmart1

Prince
Joined
Aug 16, 2005
Messages
463
Is there a way to require that a unit must be in a city and have a prerequisite building to upgrade?

And how do I make a unit an upgrade only unit?
 
you could add to the PreReqBuilding tag in the unitinfos.xml for the building part, for the upgrade only part you may be able to do iCost = -1, though not sure how that would affect the upgrade cost
 
For some reason, I dont think that will work.

I think if you set the cost to -1, it makes it unbuildable, which I believe includes Upgrading.

If you give it a cost, It might work, I am not sure how the Building prereq will come into play, this might make it necessary for the Unit to be within a city. Never tried it to be 100% sure.

If that does't work, I think what you want to do is going to require Python or SDK work.
 
If it's not -1, then try 0 in the iCost, that would probably work, but again, i'm not sure how the Upgrade Cost would be affected.
 
yea it would probably require python I bet if icost -1 wouldn't work, also for the "must be in city" part
 
I just tested it and prereqbuilding doesn't limit upgrades to the city, it just means you must have the building in one city to upgrade anywhere.

Changing the cost to 0 or -1 is pointless because I want it to cost something for the upgrade.

What I'm trying to do is create units that you find in goody huts then can be upgraded. For example, you find a big rig unit and then you can upgrade it to an armored rig. But you need the right resources, building, and enough cash to do it.

I also think that upgrading outside the city is a little ridiculous, so I want to force the unit back to the city with the appropriate building to upgrade.

Probably adding in new schema would work for the upgrade only(I don't know how or have the ability to do that). Like adding an upgrade only flag which would limit it.

As for the upgrade only in cities, I swear I played a mod that had that but I cannot remember which one.
 
you could add to the PreReqBuilding tag in the unitinfos.xml for the building part, for the upgrade only part you may be able to do iCost = -1, though not sure how that would affect the upgrade cost

No, all you need is for the unit to require a certain building in order to be built, just like the Monastery. It won't upgrade unless you bring it back to a city with that particular building. I discovered that when experimenting with having a building requirement for every unit. I dropped that idea because it made upgrading too much of a pain. It's also going to be a handicap for the AI since it won't know that it has to move a unit to a city to upgrade.
 
No, all you need is for the unit to require a certain building in order to be built, just like the Monastery. It won't upgrade unless you bring it back to a city with that particular building. I discovered that when experimenting with having a building requirement for every unit. I dropped that idea because it made upgrading too much of a pain. It's also going to be a handicap for the AI since it won't know that it has to move a unit to a city to upgrade.

I tested that, and it requires a building in the city to build it; but only one building in the entire civ to upgrade and it doesn't need to be in the city. I am using RoM 2.5 as my base for this, so maybe you have extra schema or python changes?

Its for a postapocalyptic mod, so I was trying to limit upgrades in the "wild" to give a feel of being only safe in a city.

As for the upgrade only units, its so you have to find or capture a base unit and upgrade it with weapons and armor. They cannot be built from scratch. This is to limit the bigger and more powerful units and encourage exploration.
 
It probably can be done with the:

Code:
	def canUpgradeAnywhere(self, argsList):
		pUnit = argsList
		
		bCanUpgradeAnywhere = 0
		
		return bCanUpgradeAnywhere

Function in the GameUtils python.
 
Back
Top Bottom