Mod-Modders Guide to Fall Further

Could you please use [code][/code] instead of [quote][/quote]? Indentation may not really matter in C++ like in Python, but it still makes things easier to read.
 
Another small question: Which files do I have to edit in order to make a new UnitCombat?

I know this post was from a while back, but I have found grep to be a very helpful tool for finding where things are in the xml and python files. If you don't have Linux on your PC, you could install Cygwin (google it). cd to the python directory, for example, and do "grep -i rust *.py" to search for the word RUST (ignoring case) to find out what files it is used in (PROMOTION_RUSTED).

There may be easier/better ways for multi-file searches, but I happen to use unix often, so find that easiest.

If you have an text editor that does multi-file searches, use that. In fact, that may be easier.
 
Vermicious Knid: Art errors will almost ALWAYS cause a CtD, and it won't give you a chance to get any information on what the crash was. So I would check there first.

sylvain5477: Remove the python requirement from your spell. See if it still fails to work. If it starts to work then, put the python prereq back in there, but have it return true on the first line (so essentially doesn't do anything), if that still works, restore your full python from before, but instead of returning the check on the player for canFound, use it as an IF statement, return true if the IF passes, otherwise let it run to a return false statement.
 
Vermicious Knid: Art errors will almost ALWAYS cause a CtD, and it won't give you a chance to get any information on what the crash was. So I would check there first.

sylvain5477: Remove the python requirement from your spell. See if it still fails to work. If it starts to work then, put the python prereq back in there, but have it return true on the first line (so essentially doesn't do anything), if that still works, restore your full python from before, but instead of returning the check on the player for canFound, use it as an IF statement, return true if the IF passes, otherwise let it run to a return false statement.

After all these tests and somemore :), there is a working combinaison:

Code:
def	reqCanFound(caster):
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	if pPlayer.canFound(pPlot.getX(),pPlot.getY()) == false:
		return false
	return true

Strangely, returning directly does not work, as if the "true" is not returned when not false...
Thank you for your suggestions.
 
Hi there!

I'm adding buildings that give extra yields to city plots, such as +1:food: on plains with a unique smokehouse. Issue: the bonus is still there if the terrain becomes a grassland or a desert or anything else. I would like to check if the terrain changed and thus recalculate extra yields. I thought of check tiles every turn, seeing if their actual yields match their theoretical yields and acting consequently but it could cripple the loading time, I think, even though it only checks city workable tiles. Is there any other way to do this?
 
Does resistance affect the damage cap of a spell, as well as the damage done?

I've set my Breathe Fire spell to have a damage limit of 100, but I can't seem to kill Orcish warriors with it, presumably because of their resistance to fire.

Also, how much random variance is there around the supposed damage value? I'm seeing damage values varying widely on either side of (but mostly below) the 40% damage value I set for the spell.


Over 3 casts while attakcin a Khadi scout
74%
22%
1%
This seems strange. The damage for the spell is set at 40%, so the scout should be dead after 3 casts. How can a spell with no damage cap, be reduced so much as to do only 1% damage? This is a str2 scout against a str40 dragon

And also, do units in cities get extra magic resistance? Casting Breathe Fire on a city containing 5 enemies, I'm frequently getting all 5 of them resisting. The resist chance of the spell is 40% (20% resistance modifier)
 
After all these tests and somemore :), there is a working combinaison:

Code:
def    reqCanFound(caster):
    pPlot = caster.plot()
    pPlayer = gc.getPlayer(caster.getOwner())
    if pPlayer.canFound(pPlot.getX(),pPlot.getY()) == false:
        return false
    return true
Strangely, returning directly does not work, as if the "true" is not returned when not false...
Thank you for your suggestions.

Have you placed the unit on a mountain, next to (or in) another city or in the ocean to make sure that it returns false when it should?

Hi there!

I'm adding buildings that give extra yields to city plots, such as +1:food: on plains with a unique smokehouse. Issue: the bonus is still there if the terrain becomes a grassland or a desert or anything else. I would like to check if the terrain changed and thus recalculate extra yields. I thought of check tiles every turn, seeing if their actual yields match their theoretical yields and acting consequently but it could cripple the loading time, I think, even though it only checks city workable tiles. Is there any other way to do this?

If you set this up in the SDK, you want to modify CvPlot::setTerrainType or whatever it is called so that if the terrain changes, it updates the yield of the tile all over again. Ought to do that anyway, so I am guessing you set it up in python. I don't think there is a callback for when terrain type is set, so it'll be pretty tricky to fix.

Does resistance affect the damage cap of a spell, as well as the damage done?

I've set my Breathe Fire spell to have a damage limit of 100, but I can't seem to kill Orcish warriors with it, presumably because of their resistance to fire.

Also, how much random variance is there around the supposed damage value? I'm seeing damage values varying widely on either side of (but mostly below) the 40% damage value I set for the spell.


Over 3 casts while attakcin a Khadi scout
74%
22%
1%
This seems strange. The damage for the spell is set at 40%, so the scout should be dead after 3 casts. How can a spell with no damage cap, be reduced so much as to do only 1% damage? This is a str2 scout against a str40 dragon

And also, do units in cities get extra magic resistance? Casting Breathe Fire on a city containing 5 enemies, I'm frequently getting all 5 of them resisting. The resist chance of the spell is 40% (20% resistance modifier)


Not sure if resistance affects the cap, but I suppose it would make some sense if it did (mostly just for making magic immunity real easy to set up). Cities DO aid in magical resistance of all occupying units.
 
Have you placed the unit on a mountain, next to (or in) another city or in the ocean to make sure that it returns false when it should?

Indeed, and it works perfectly so far.
 
If you set this up in the SDK, you want to modify CvPlot::setTerrainType or whatever it is called so that if the terrain changes, it updates the yield of the tile all over again. Ought to do that anyway, so I am guessing you set it up in python. I don't think there is a callback for when terrain type is set, so it'll be pretty tricky to fix.
Thanks. I think I will have to thoroughly read your idiots' guide in order to mod the dll. It would make things much easier :)
 
So, any idea if this will work? Kind of hard to test, as it's for the AI only... ;)
How about something like this?
Code:
animalunits=0
for pUnit in player.getUnitList():
     if pUnit.getUnitCombatType() == gc.getInfoTypeForString('UNITCOMBAT_ANIMAL'):
            animalunits+=1
 
Problem is that this will run at LEAST once per turn per unit for the Doviello. At least until they cast their Worldspell for the first time, so unless they get 20 animals fairly early on, it'll be a fair slowdown for AI processing speed (though with the model designed I assume 20 animals WILL come fairly fast)
 
Couldn't it just be set to run once every 5 turns or so?

Oh, and I'd guess it'd be a good idea to only run the check if the No Animals game option isn't on.
 
Back
Top Bottom