Mod-Modders Guide to Fall Further

pPlot.isVisible(iTeam, false)

Yeah, I know I said it completely different, but that was from memory, this was from looking in the DLL :)

So, will this code do what it's intended to do then? Basically, it checks all plots to see if they are visible to the Doviello, and then checks if they have either a bear den or lion den, and then if so spawns a settler and two defending animals on the plot. It then checks the Animal civ for any animals within Doviello vision, and converts them to Doviello control with the Enraged promotion.

Edit: Apparently not... deactivates spells completely. Something horribly wrong... :lol:


Code:
def spellWildHunt(caster):
	pPlayer = gc.getPlayer(caster.getOwner())
	iTeam = pPlayer.getTeam()
	iBear = gc.getInfoTypeForString('IMPROVEMENT_BEAR_DEN')
	iLion = gc.getInfoTypeForString('IMPROVEMENT_LION_DEN')
	iHero = gc.getInfoTypeForString('PROMOTION_HERO')
	iPromotionEnraged = gc.getInfoTypeForString('PROMOTION_ENRAGED')
	py = PyPlayer(gc.getANIMAL_PLAYER())
	
	for i in range (CyMap().numPlots()):
		pPlot = CyMap().plotByIndex(i)
		if pPlot.isVisible(iTeam, false):
			if pPlot.getImprovementType() == iBear:
				newUnit = pPlayer.initUnit(gc.getInfoTypeForString('UNIT_SETTLER'), pPlot.getX(), pPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
				newUnit = pPlayer.initUnit(gc.getInfoTypeForString('UNIT_BEAR'), pPlot.getX(), pPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
				newUnit = pPlayer.initUnit(gc.getInfoTypeForString('UNIT_BEAR'), pPlot.getX(), pPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
				pPlot.setImprovementType(-1)
			if pPlot.getImprovementType() == iLion:
				newUnit = pPlayer.initUnit(gc.getInfoTypeForString('UNIT_SETTLER'), pPlot.getX(), pPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
				newUnit = pPlayer.initUnit(gc.getInfoTypeForString('UNIT_LION'), pPlot.getX(), pPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
				newUnit = pPlayer.initUnit(gc.getInfoTypeForString('UNIT_LION'), pPlot.getX(), pPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
				pPlot.setImprovementType(-1)
	
	for pUnit in py.getUnitList():
		if pUnit.isHasPromotion(iHero) == False):
			pPlot = pUnit.plot()
			if pPlot.isVisible(iTeam, false):
				for i in range(pPlot.getNumUnits(), -1, -1):
					pNewPlot = -1
					pLoopUnit = pPlot.getUnit(i)
					if pLoopUnit.isHiddenNationality():
						pNewPlot = cf.findClearPlot(pLoopUnit, -1)
						if pNewPlot != -1:
							pLoopUnit.setXY(pNewPlot.getX(), pNewPlot.getY(), false, true, true)
				newUnit = pPlayer.initUnit(pUnit.getUnitType(), pUnit.getX(), pUnit.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
				newUnit.convert(pUnit)
				newUnit.setHasPromotion(iPromotionEnraged, True)
 
A few questions back, I asked about the Power system. Nobody responded. Just wondering if anyone has an answer. I'm referring to the iPower tag that appears on a lot of promotions and units. Where exactly does it come into play?

Secondly, is it possible to add Collateral Damage and/or City Bombard capabilities to a unit that didn't already have them, via a promotion? Or would I need to edit the base info of each unit and add the capability there?


And thirdly, where can I find a list of all valid DAMAGE_TYPEs
Also, is there any "non-elemental" damage type? I'm looking to make a spell which can only be resisted by generic magic resistance, but not any specific element.


Edit: Nevermind the third question. I found DamageInfos.xml
I guess I'll go with physical. Nothing resists that, right?
 
I want to block AI workers from constructing stuff on mana nodes (and thus razing the mana improvement)? Does the canbuild check in python work for that?
 
Is there a way to use a promotion to make a unit able of founding cities ?
(without creating a spell...)

EDIT: it seems from the DLL source that the bFound tag is comparsery (too bad to have the condition hardcoded)... so it seems impossible to give the ability throught a promo. Maybe I could remove it through a promo though, I"ll check.

EDIT2: I checked the DLL in CvPlayer.cpp and I finally decided to use a spell whith the following requirement function:

def reqCanFound(caster):
pPlot = caster.plot()
pPlayer = gc.getPlayer(caster.getOwner())
return pPlayer.canFound(pPlot.getX(),pPlot.getY(),1)

As the unit does not have the bFound flag set-up, I use the player function instead.
However the function seems to always return false as the button is not visible (while it is when I delete the function requirement; meaning the other conditions in the XML are verified).

Any idea ?
 
Secondly, is it possible to add Collateral Damage and/or City Bombard capabilities to a unit that didn't already have them, via a promotion? Or would I need to edit the base info of each unit and add the capability there?


I don't think it is. I tried all of the collateral damage fields in the schema and wasn't able to pull it off.
 
A few questions back, I asked about the Power system. Nobody responded. Just wondering if anyone has an answer. I'm referring to the iPower tag that appears on a lot of promotions and units. Where exactly does it come into play?

Secondly, is it possible to add Collateral Damage and/or City Bombard capabilities to a unit that didn't already have them, via a promotion? Or would I need to edit the base info of each unit and add the capability there?


And thirdly, where can I find a list of all valid DAMAGE_TYPEs
Also, is there any "non-elemental" damage type? I'm looking to make a spell which can only be resisted by generic magic resistance, but not any specific element.


Edit: Nevermind the third question. I found DamageInfos.xml
I guess I'll go with physical. Nothing resists that, right?

iPower and iAsset adjust the player's Power and Asset levels in the area, which are consulted by the AI for various functions. High Asset units are less likely to be volunteered for death, and you should understand Power mostly, it is the Power Graph. The values are percentage modifiers of the unit's base Power/Asset value. So Combat I on Drifa is worth quite a few more points of Power than Combat I on a scout.

Collateral damage tags exist for PromotionInfos, but I never got around to making them work before getting distracted by other projects. I had started DLL modding by trying to move everything from UnitInfos into PromotionInfos. So, at present there is no way, but it would actually be fairly simple to make it functional.

I want to block AI workers from constructing stuff on mana nodes (and thus razing the mana improvement)? Does the canbuild check in python work for that?

Actually that very function is how AI workers get the ability to build Mana Nodes in the first place. So it should be fairly trivial (most of the legwork of defining variables would already be done, possibly you can just place an ELSE statement and be finished)

Is there a way to use a promotion to make a unit able of founding cities ?
(without creating a spell...)

EDIT: it seems from the DLL source that the bFound tag is comparsery (too bad to have the condition hardcoded)... so it seems impossible to give the ability throught a promo. Maybe I could remove it through a promo though, I"ll check.

Odd that I hadn't imported that one long ago, as a boolean tag it would have been one of the first I should have tried to work on. But yes, it would seem python is your only recourse.
 
So, at present there is no way, but it would actually be fairly simple to make it functional.

aww :(
I hope you can get around to it sometime soon then. Guess I'll have to just put it in the unitinfo for now.

A seperate question. This picture mostly shows the issue

Spoiler :
pinkboxes.png



I'm adding new art for promotions I'm making. They display correctly in one view, but not the other. The images are correctly referenced.

Please don't tell me this is another limitation with modular loading. I swear I'll strangle something :mad:
 
Odd that I hadn't imported that one long ago, as a boolean tag it would have been one of the first I should have tried to work on. But yes, it would seem python is your only recourse.

sylvain5477 said:
I checked the DLL in CvPlayer.cpp and I finally decided to use a spell whith the following requirement function:

def reqCanFound(caster):
pPlot = caster.plot()
pPlayer = gc.getPlayer(caster.getOwner())
return pPlayer.canFound(pPlot.getX(),pPlot.getY(),1)

As the unit does not have the bFound flag set-up, I use the player function instead.
However the function seems to always return false as the button is not visible (while it is when I delete the function requirement; meaning the other conditions in the XML are verified).

Any hope you may look at my second EDIT ? :)
I tried the python, but cannot seem to receive a "true" for the canFound function...
 
Sure seems that it ought to work. You should be passing a true instead of a 1 for the last variable, but that shouldn't matter, any non-zero is typically considered true. Though I think you'd rather use false there anyway so that it prevents you from settling a city on the tile right next to any already existing city.

Just for curiosities sake, try your spell on a settler

EDIT: Forgot to respond to Warkirby: Remove the spaces from the DDS names.
 
Hi! I'm... Extremely new to modding, and I've been pretty annoyed about how poorly computer Kuriotates do. I'd heard a suggestion to remove their city limit, and I was curious as to how to do that? I'm hoping it will improve them enough on it's own so that I'll actually SEE them in a way other then announcing their deaths. XD

I'm also curious about how to create new traits/leaders, or to modify existing traits... But I'm going to be going through here to look that part up anyways, I just can't figure out what I should put in, and where, to remove the Kurio limits. :p

Thanks, if anyone can help me. :p If not, thanks for at least reading my n00b questions. XD
 
Hi! I'm... Extremely new to modding, and I've been pretty annoyed about how poorly computer Kuriotates do. I'd heard a suggestion to remove their city limit, and I was curious as to how to do that? I'm hoping it will improve them enough on it's own so that I'll actually SEE them in a way other then announcing their deaths. XD

I'm also curious about how to create new traits/leaders, or to modify existing traits... But I'm going to be going through here to look that part up anyways, I just can't figure out what I should put in, and where, to remove the Kurio limits. :p

Thanks, if anyone can help me. :p If not, thanks for at least reading my n00b questions. XD


City limit thing is super-easy. Fall Further>assets>xml>civilizations>civtraitinfo.xml.

Open it with notepad or wordpad, control-F search for "trait_sprawling". Scroll down until you get to the max cities field. Change the value from 3 to -1.
 
I think I figured out part of the answer to my other question as well.. For example, if I was to copy the Financial +1 to comerce over to Industrial as a hammer boost, I'd put it in... the second of the three spots? And if I was to create a new trait, Agricultural, and give +1 food for 2 or more I'd put it in the second spot? What if I wanted to give a trait, Agricultural, that gives +1 food just to farms and pastures so that it wouldn't affect any other food-harvesting things such as fishing boats or more "woodsy" things such as camps? I think it would be a nice little trait, flavor-wise, although I'd need to think of a way later on to have it added as a random event... Or perhaps have it attainable via ritual for the farming guild. :p
 
So...I seem to recall there is a hard limit on number of units you can dd to the game via XML.


What is the magic number, and how close is Fall Further to it?


I added some units and I'm getting CTD at startup...which is a new experience for me. Usually I just get XML errors.
 
IIRC Kael had found that in the DLL once and commented on it (there was a loop somewhere which was supposed to loop over all units, but would stop at 150-something even if there were more units), but he also removed it IIRC, as nobody could figure out any good reason to have such a thing.
 
IIRC Kael had found that in the DLL once and commented on it (there was a loop somewhere which was supposed to loop over all units, but would stop at 150-something even if there were more units), but he also removed it IIRC, as nobody could figure out any good reason to have such a thing.


Thanks.


That is both a good and a bad thing. Bad in that now I have no idea what I broke. :sad:


I've never killed the game like this playing with XML before...but I just started playing with art defines and unitclass infos.

Would a screw-up in one of those be likely to cause a CTD when the game tries to load?

Maybe I should just reinstall and start over....maddening thing is I made a ton of changes, started up and had a minor XML error (but the game made it to the menu, was able to look at the pedia, etc...). Shut down, fixed the xml problem...and now
no luck.

Is it possible that the XML glitch forced the rest of that file to be skipped, and the error is somewhere after the glitch in that file(unitinfos)? I'm still unclear on how all this works...I'm just a monkey pressing buttons. :D
 
Sure seems that it ought to work. You should be passing a true instead of a 1 for the last variable, but that shouldn't matter, any non-zero is typically considered true. Though I think you'd rather use false there anyway so that it prevents you from settling a city on the tile right next to any already existing city.

I checked the C code to see why it would refuse to accept the city but cannot find out why :

Code:
bool CvPlayer::canFound(int iX, int iY, bool bTestVisible) const
{
	CvPlot* pPlot;
	CvPlot* pLoopPlot;
	bool bValid;
	int iRange;
	int iDX, iDY;
    if (getID() == DEMON_PLAYER || getID() == ANIMAL_PLAYER)
    {
        return false;
    }

I'm not neither Bhall nor Aghares so I should pass this.

Code:
	pPlot = GC.getMapINLINE().plotINLINE(iX, iY);

	long lResult=0;
	if(GC.getUSE_CANNOT_FOUND_CITY_CALLBACK())
	{
		CyArgsList argsList;
		argsList.add((int)getID());
		argsList.add(iX);
		argsList.add(iY);
		gDLL->getPythonIFace()->callFunction(PYGameModule, "cannotFoundCity", argsList.makeFunctionArgs(), &lResult);

		if (lResult == 1)
		{
			return false;
		}
	}

The cannotFoundCity python function is short as follow :

Code:
	def cannotFoundCity(self,argsList):
		iPlayer, iPlotX, iPlotY = argsList
		pPlot = CyMap().plot(iPlotX,iPlotY)
		pPlayer = gc.getPlayer(iPlayer)
		
		if gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_SETTLERS):
			if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_SCIONS'):
				if pPlayer.getNumCities() > 0:
					return true
		if pPlot.getBonusType(-1) == gc.getInfoTypeForString('BONUS_MANA'):
			return true

		return False

As the current plot is not mana and I am not Scions, it should returne false, so result=0.

Code:
	if (GC.getGameINLINE().isFinalInitialized())
	{
		if (GC.getGameINLINE().isOption(GAMEOPTION_ONE_CITY_CHALLENGE) && isHuman())
		{
			if (getNumCities() > 0)
			{
				return false;
			}
		}
	}

I do not have the option onecity challenge activated, so I should pass this as well.

Code:
	if (pPlot->isImpassable())
	{
		return false;
	}

This one easy, I'm on a plot which is a grass. Not impassable.

Code:
	if (pPlot->getFeatureType() != NO_FEATURE)
	{
		if (GC.getFeatureInfo(pPlot->getFeatureType()).isNoCity())
		{
			return false;
		}
	}

No feature on the plot, plain grass (no forest).

Code:
	if (pPlot->isOwned() && (pPlot->getOwnerINLINE() != getID()))
	{
		return false;
	}

The plot is not owned (start of a new game) and I have no cities.

Code:
	bValid = false;

	if (!bValid)
	{
		if (GC.getTerrainInfo(pPlot->getTerrainType()).isFound())
		{
			bValid = true;
		}
	}

The terrain is grass so bValid should value true.

Code:
	if (!bValid)
	{
		if (GC.getTerrainInfo(pPlot->getTerrainType()).isFoundCoast())
		{
			if (pPlot->isCoastalLand())
			{
				bValid = true;
			}
		}
	}

	if (!bValid)
	{
		if (GC.getTerrainInfo(pPlot->getTerrainType()).isFoundFreshWater())
		{
			if (pPlot->isFreshWater())
			{
				bValid = true;
			}
		}
	}

bValid being true, skip this two parts normally.

Code:
	if(GC.getUSE_CAN_FOUND_CITIES_ON_WATER_CALLBACK())
	{
		CyArgsList argsList2;
		argsList2.add(iX);
		argsList2.add(iY);
		lResult=0;
		gDLL->getPythonIFace()->callFunction(PYGameModule, "canFoundCitiesOnWater", argsList2.makeFunctionArgs(), &lResult);
	}

	if (lResult == 1)
	{
		bValid = true;
	}
	else
	{
		if (pPlot->isWater())
		{
			return false;
		}
	}

The canFoundCitiesOnWater function always return false and the plot is not water, so passing again.

Code:
	if (!bValid)
	{
		return false;
	}

	if (!bTestVisible)
	{
		iRange = GC.getMIN_CITY_RANGE();

		for (iDX = -(iRange); iDX <= iRange; iDX++)
		{
			for (iDY = -(iRange); iDY <= iRange; iDY++)
			{
				pLoopPlot	= plotXY(pPlot->getX_INLINE(), pPlot->getY_INLINE(), iDX, iDY);

				if (pLoopPlot != NULL)
				{
					if (pLoopPlot->isCity())
					{
						if (pLoopPlot->area() == pPlot->area())
						{
							return false;
						}
					}
				}
			}
		}
	}

bValid is true and bTestVisible true also so skip this part.

Code:
	if (pPlot->getImprovementType() != NO_IMPROVEMENT)
	{
	    if (GC.getImprovementInfo((ImprovementTypes)pPlot->getImprovementType()).isPermanent())
	    {
	        return false;
	    }
	}

No improvement, so passing again.

Code:
	return true;

Ha! It should return true ! :)





Just for curiosities sake, try your spell on a settler

I'll try it for curiosity sake.
EDIT : Tried, build city appear but not the spell.
 
Back
Top Bottom