Valkrionn
The Hamster King
Check CvPlot for getVisibilityCount(ePlayer) to see if they can see it.
lol Sorry for being a pain, but how exactly do you do that? CvPlot.getVisibilityCount?
Check CvPlot for getVisibilityCount(ePlayer) to see if they can see it.
pPlot.isVisible(iTeam, false)
Yeah, I know I said it completely different, but that was from memory, this was from looking in the DLL![]()
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)
def reqCanFound(caster):
pPlot = caster.plot()
pPlayer = gc.getPlayer(caster.getOwner())
return pPlayer.canFound(pPlot.getX(),pPlot.getY(),1)
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?
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.
So, at present there is no way, but it would actually be fairly simple to make it functional.
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).
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.![]()
Thanks, if anyone can help me.If not, thanks for at least reading my n00b questions. XD
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.
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.
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;
}
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;
}
}
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
if (GC.getGameINLINE().isFinalInitialized())
{
if (GC.getGameINLINE().isOption(GAMEOPTION_ONE_CITY_CHALLENGE) && isHuman())
{
if (getNumCities() > 0)
{
return false;
}
}
}
if (pPlot->isImpassable())
{
return false;
}
if (pPlot->getFeatureType() != NO_FEATURE)
{
if (GC.getFeatureInfo(pPlot->getFeatureType()).isNoCity())
{
return false;
}
}
if (pPlot->isOwned() && (pPlot->getOwnerINLINE() != getID()))
{
return false;
}
bValid = false;
if (!bValid)
{
if (GC.getTerrainInfo(pPlot->getTerrainType()).isFound())
{
bValid = true;
}
}
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;
}
}
}
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;
}
}
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;
}
}
}
}
}
}
if (pPlot->getImprovementType() != NO_IMPROVEMENT)
{
if (GC.getImprovementInfo((ImprovementTypes)pPlot->getImprovementType()).isPermanent())
{
return false;
}
}
return true;
Just for curiosities sake, try your spell on a settler