Quick Modding Questions Thread

hi guys, I am trying to run down errors in my .dll compiling. I have managed to fix a few but this one has me stumped, as when I look at the original, and my new version, the line it is complaining about appears to be identical to the original lines...

So I was wondering if people might be able to help me tease out some extra info from the error messages.

Here it is:
Spoiler :

1>CvUnit.cpp(5317) : error C2059: syntax error : 'else'
1>CvUnit.cpp(5318) : error C2143: syntax error : missing ';' before '{'
1>CvUnit.cpp(5318) : error C2447: '{' : missing function header (old-style formal list?)
1>CvUnit.cpp(5323) : error C2501: 'changeMoves' : missing storage-class or type specifiers
1>CvUnit.cpp(5325) : error C2059: syntax error : 'if'
1>CvUnit.cpp(5326) : error C2143: syntax error : missing ';' before '{'
1>CvUnit.cpp(5326) : error C2447: '{' : missing function header (old-style formal list?)
1>CvUnit.cpp(5337) : error C2059: syntax error : 'if'
1>CvUnit.cpp(5338) : error C2143: syntax error : missing ';' before '{'
1>CvUnit.cpp(5338) : error C2447: '{' : missing function header (old-style formal list?)
1>CvUnit.cpp(5342) : error C2059: syntax error : 'return'
1>CvUnit.cpp(5343) : error C2059: syntax error : '}'
1>CvUnit.cpp(5343) : error C2143: syntax error : missing ';' before '}'
1>CvUnit.cpp(5343) : error C2059: syntax error : '}'
1>CvUnit.cpp(5347) : error C2143: syntax error : missing ';' before '{'
1>CvUnit.cpp(5347) : error C2447: '{' : missing function header (old-style formal list?)
1>NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual C++ Toolkit 2003\bin\cl.exe"' : return code '0x2'
1>Stop.
 
yeah I am trying to figure out what that really means, as neither the original bts or my new code has a ; so I cannot figure out why it is suddenly missing, it's the same with the 'else' reference, as far as I can tell the code is identical, so I was hoping there might be someone who could help me narrow down what might be going wrong, basically just understand what the code is doing, and why it might be doing it wrong! :-)

If someone appears who understands it, I would be happy to send them the code files so they can have a look, if they are willing.
 
is it possible to make a tech not appear in the civilopedia?

and totally unrelated, in CvCity.cpp in CvCity::doReligion we have as the first conditional statement:

if (getReligionCount() == 0)

does this mean that a religion will not randomly spread to a city that already has a religion? and if I change it to "if (getReligionCount() =<= 1)" will religions spread randomly to cities that already have 1 religion?
 
is it possible to make a tech not appear in the civilopedia?

:yup: if you hack a bit into the screens.
I have a small hack here. If you replace your tech civilopedia screen .py with this file, all technologies which have coordinates below 0 (means they don't show up on the tech tree) will also not appear in the civilopedia.

and totally unrelated, in CvCity.cpp in CvCity::doReligion we have as the first conditional statement:

if (getReligionCount() == 0)

does this mean that a religion will not randomly spread to a city that already has a religion? and if I change it to "if (getReligionCount() =<= 1)" will religions spread randomly to cities that already have 1 religion?

IIRC the first assumption is correct, so the second should be too.
 
yeah I am trying to figure out what that really means, as neither the original bts or my new code has a ; so I cannot figure out why it is suddenly missing, it's the same with the 'else' reference, as far as I can tell the code is identical, so I was hoping there might be someone who could help me narrow down what might be going wrong, basically just understand what the code is doing, and why it might be doing it wrong! :-)

If someone appears who understands it, I would be happy to send them the code files so they can have a look, if they are willing.

The error is most likely before the first listed line, the location it gives is just when it ran into something that could not possible be correct given what was before it. The most likely thing is that you have one too many "}" right before that location, or one too few "{" somewhere before that. All the errors probably then follow from that one thing, which it assumes to be correct since up to the first thing it mentions everything could be parsed to be valid code, making everything after it appear to be nonsense to the compiler.
 
thanks for the answers and the civilopedia hack.

another question:

the map doesn't appear in the replay screen in my mod. the rest of the screen is there, the power graph and event log and the play and pause controls and they all work, but no map. I've searched all the python in my mod, BTS and vanilla and all I can find is:

def showReplay(argsList): in CvScreensInterface.py

but it seems to never get called. I searched every file for "showReplay" and got nothing.
 
and totally unrelated, in CvCity.cpp in CvCity::doReligion we have as the first conditional statement:

if (getReligionCount() == 0)

does this mean that a religion will not randomly spread to a city that already has a religion? and if I change it to "if (getReligionCount() =<= 1)" will religions spread randomly to cities that already have 1 religion?

You might want to look at this: http://forums.civfanatics.com/showthread.php?t=166934&page=2

Look for Kael's post #35 as it might interest you.
 
Is there a way to add a UU without it replacing an existing unit? I tried, but the unit in question was available for all civs. I would really appreciate some help with this, thanks in advance.
 
Is there a way to give land units capacity to carry units?
I was thinking along the lines of like a "Troop Transport" which has a lot of moves but sucky defense which you could load on units which have a move of 1 or 2. That way if the transport gets destroyed you lose your troops(like a naval transport) but you can use it to move slow units from one location to another very quickly.
 
But the AI will not use it. The AI does only use transports on the sea.
There was once an attempt to make a land carrier AI, but it turned out to be more complicated than the author thought at the beginning.

Hmm even through sdk?

I am sure most of the attempts is to duplicate the sea AI to land, think its possible to just trick AI into thinking it is normal sea transport, than simply having it so it can only go on land so it is using the trasnport anyway
 
Couple of Questions:

1) Is it possible to add/edit techs using only XML or would I need use python/SDK ?

2) Is it possible to require a building to create units? Like you need to have a Barracks in a city before you can train warriors in that city?

3) Is there a way to make a type of Missile Cruiser/Sub carry only ONE type of missile? For example, I wanted to make a Light Cruiser which carries 8 Guided missiles and has 1/2 the STR of a normal Cruiser (for use for recon/sentry duty). But I don't want to be able to load on T. Nukes on it.

4) Adding in more types of missiles (normal and nukes) doesn't require editing the special units file does it? Or does it req python/SDK?
 
1) Yes, that is entirely possible with just XML.
2) In that unit's entry in the file Civ4UnitInfos.xml, you will find a tag <PrereqBuilding>. Usually this is set to NONE; just set it to what you need.
3) I'm not sure this will work because I haven't tried it, but you might be able to give the tactical nuclear missiles their own SpecialUnit type instead of SPECIALUNIT_MISSILE, but that would mean that anything that carries SPECIALUNIT_MISSILE already wouldn't be able to take t. nuke missiles anymore. Essentially, you'd be dividing all missile carrying ships into "nuke" and "non-nuke".
4) Just edit Civ4UnitInfos.xml. No python or SDK needed. There's a great tutorial here: http://forums.civfanatics.com/showthread.php?t=139721
 
Back
Top Bottom