- Joined
- Jan 24, 2011
- Messages
- 4,914
You're using the template, no? Meaning you're using an object file that associates object.uP51DMustang = civ.getUnitType(56)Again, I'm not an expert programmer in lua (at this stage of my development path perhaps an experienced beginner) but my first thoughts are that it's not simply a matter of the batch file.
Basically the complication is related to how I track the number of 'specific' units in the game, which is currently all based on the unit object names. This is not only done within the procurement file, which is already over 4400 lines, but at least 3 others as well such as onTurn, consolidatedEvents, onTribeTurnBegin. Trying to track different unit names for the same unit type might become overly complicated.
It looks like you are, as in Procurement you have this line:
if unit.type == object.uP51DMustang then
totalP51DMustang = totalP51DMustang + 1
end
As long as you're pointing to civ.getUnitType in your object file, and not using the scheme in Napoleon (where you specifically IIRC searched for certain things like units by NAME) you ought to be able to simply change the name in the Rules file and change the art. The change to the rules file **shouldn't** make any difference to your code, at least here. It's one of the massive advantages of using the template over getunittypebyname or whatever the code was back in the day.
You might find that there are other hard compromises you have to make that can be sorted here.
The only reason why you'll see multiple lines in my object file in HoF was to make it easier on ME to write the events from scratch, but as you can see both objects refer to the same unit type. I could have just left one but then every US event after turn 37 would have referenced "GreekMountaineer" which just would have been annoying for me. Since your events are already written and ready and working you don't have to change anything in them, unless you've also referenced unit types by name rather than object somewhere else in the code.
object.uGreekMountaineer =civ.getUnitType(62)
object.uAmericanTankI =civ.getUnitType(62) -- Winter 1941 onward (turn 37)
But hey you've been working on this forever and who knows if it's worth the trouble if we're talking 2 units! Just thought I'd share how you could do it. Not exactly a game breaker
