Quick Modding Questions Thread

But why isn't it a Boolean instead of an integer then?
 
Firaxis coders like to do things in a way nobody understand.
It is not the only one done this way.
There are others like open borders or defensive pact done in similar fashion.
 
This way, if a "bool" is set by two different sources, the information isn't permanently overridden, f.e.
1. building1 blocking bonus is built -> +1.
2. building2 blocking bonus is build -> +1, now at 2.
3. building1 is destroyed -> -1, now at 1, and still correctly blocked.

Simply setting a boolean to true or false wouldn't work correctly in this case, the alternative is to loop through every building and see if one is blocking the bonus.

(I don't see a reason why open borders would have to be coded this way, though. Maybe something with teams?)
 
It is the ability to sign open borders which is done that way.
So... granted by 2 techs? :D
 
1. I noticed that the Ai cost for settlers (using kmod) on epic speed is 146. My own cost for settlers is 149 (both of us without imperialistic).

What modifier controls that? I dont think its in the civ4handicapinfo.xml...because i have the aiunitproduction rate at 90%.

Ive been re-writing the tech xml so the ai takes smart techs early and its expanding faster than I expected, so Im looking for a small way to slow them down at first...and making them pay full price for settlers would be a start.

2. Any interesting or effective way to get the AI, NOT to build Moai Statues in their capitals...seems like a bit of a waste to me. If I lower the ai weight or asset value, they may not make it at all though...
 
I'm having an SDK error... (hehe get ready :groucho: ) Can anyone help?

I've been merging a bunch of stuff. Wait, don't run away yet. All I need is for someone to tell me what this error means:

Code:
1>  CvUnit.cpp
1>CvUnit.cpp(4654): error C2086: 'CvPlot *pTargetPlot' : redefinition
1>          CvUnit.cpp(4642) : see declaration of 'pTargetPlot'

I get it whenever I compile, followed by a whole bunch of "unresolved external symbols" errors. The error in CvUnit.cpp references these few lines from Super Forts:

Code:
        // Super Forts begin *bombard*
	//FAssertMsg(pBombardCity != NULL, "BombardCity is not assigned a valid value"); - Removed for Super Forts

	CvPlot* pTargetPlot;
	//CvPlot* pTargetPlot = pBombardCity->plot(); - Original Code
	if(pBombardCity != NULL)
	{
		pTargetPlot = pBombardCity->plot();
	}
	else
	{
		pTargetPlot = bombardImprovementTarget(pPlot);
	}
	// Super Forts end

[B]	CvPlot* pTargetPlot = pBombardCity->plot();[/B]
	if (!isEnemy(pTargetPlot->getTeam()))
	{
		getGroup()->groupDeclareWar(pTargetPlot, true);
	}

	if (!isEnemy(pTargetPlot->getTeam()))
	{
		return false;
	}

That bolded line there apparently isn't supposed to be there, but if I remove it, I get a whole mess of errors that say "the input line is too long".

Any ideas? :confused:
 
All I need is for someone to tell me what this error means:

Code:
1>  CvUnit.cpp
1>CvUnit.cpp(4654): error C2086: 'CvPlot *pTargetPlot' : redefinition
1>          CvUnit.cpp(4642) : see declaration of 'pTargetPlot'

The CvPlot* text is defining the variable. Once you do that, you dont need to define it again. You just want to change te variable's value. 2nd line (the one you tried to remove), should be changed to simply this:

pTargetPlot = pBombardCity->plot();
 
Does anyone know how CyCity's changeNoBonusCount(BonusType, iChange) works exactly? In particular, what values of iChange do what?

But why isn't it a Boolean instead of an integer then?

Firaxis coders like to do things in a way nobody understand.
It is not the only one done this way.
There are others like open borders or defensive pact done in similar fashion.

This way, if a "bool" is set by two different sources, the information isn't permanently overridden, f.e.
1. building1 blocking bonus is built -> +1.
2. building2 blocking bonus is build -> +1, now at 2.
3. building1 is destroyed -> -1, now at 1, and still correctly blocked.

Simply setting a boolean to true or false wouldn't work correctly in this case, the alternative is to loop through every building and see if one is blocking the bonus.

(I don't see a reason why open borders would have to be coded this way, though. Maybe something with teams?)

The reason for this methodology is not mysterious - it's brilliant.

The integer is a count of 'reasons' that the boolean should be true. The boolean function return is going to ask for 'if the integer of the count is > 0' then true. If there are multiple reasons it's still no less true.

However, if you have a situation where reason one and reason two have both come into play for a player and then only one is removed, it only takes away the one reason rather than changing a direct boolean back to false when there still exists a reason for it to be true. Thus the count of 2 (reasons) goes down to 1 which is still true as opposed to:
Reason 1 when coming into play sets the bool to true, reason 2 redundantly resets the bool to true. Reason 2 is removed and when eliminating it from consideration resets the bool to false.

It's not firaxis being odd, it's really the only right way to go about it when more than one factor can cause an effect.
 
Does anyone know if it's possible to make it so that features like fallout, flood plains, etc. don't get erased when you build cities on top of them the same as bonuses?
 
Does anyone know if it's possible to make it so that features like fallout, flood plains, etc. don't get erased when you build cities on top of them the same as bonuses?

I think that is possible with python or SDK, but i am not sure.
 
Hi guys and good work,

How would u code a building to provide a 10% discount on work boats...apparently they are considered units for unitaiproduction in the handicapinfo but are not worthy of the discount type, as the same as that of a drydock, domain_sea.

let me know if u can see my post im starting to feel invisible lol
 
How to fix this ?
 

Attachments

  • u23fc.JPG
    u23fc.JPG
    47.7 KB · Views: 41
apparently they are considered units for unitaiproduction in the handicapinfo but are not worthy of the discount type, as the same as that of a drydock, domain_sea.

Probably because the have NONE for unitcombat.

let me know if u can see my post im starting to feel invisible lol[/QUOTE]

I see it. :)

How to fix this ?

Looks like you have some sort of special character in one of the unit names that the code doesn't like.
 
How to fix this ?

Looks like something you use has symbols in the name that are not regular text.

Line 123 in CvUtil.py most likely has a statement in it that looks like this:
s.encode("latin_1")
probably with some other stuff on the line.

If so, change that to look this:
s.encode("latin_1", "backslashreplace")

This will put something like the thing in the error message into the output in the log file, like "\u23fc" (I think the "u" is in there, but I don't remember for sure) instead of what is probably a symbol character from the game fonts that this unicode value is used for in-game.

In essence, the problem is that it is trying to put a 16 bit unicode character into a 8 bit "regular" character, which it can't do. The change tells it that when there is an error it should put in the backslash prefixed unicode character number instead.
 
Looks like something you use has symbols in the name that are not regular text.

Line 123 in CvUtil.py most likely has a statement in it that looks like this:
s.encode("latin_1")
probably with some other stuff on the line.

If so, change that to look this:
s.encode("latin_1", "backslashreplace")

This will put something like the thing in the error message into the output in the log file, like "\u23fc" (I think the "u" is in there, but I don't remember for sure) instead of what is probably a symbol character from the game fonts that this unicode value is used for in-game.

In essence, the problem is that it is trying to put a 16 bit unicode character into a 8 bit "regular" character, which it can't do. The change tells it that when there is an error it should put in the backslash prefixed unicode character number instead.

FIXED. Thank you :)

Cities can't have unicode characters.
Do you know how to fix this ?
 

Attachments

  • portug.JPG
    portug.JPG
    35.7 KB · Views: 29
Code:
& #227;
in a text file (NO SPACE: it's just for correct display on forum otherwise it shows ã).

EDIT: here is a link.
 
Hi, I don't know where to begin. I've been reading and experimenting with no success with what I want to do. I would like to know where to begin modding to have an "Auto End Turn" option put into the game. I have seen it in the BUG options in Rise of Mankind A New Dawn and Caveman to Cosmos. I downloaded BUG 4.4 and installed it in the mod folder its the mod I would like to add the auto end turn option to.

Where and how do I go about this?
 
Top Bottom