I also don't see anything wrong with your code. Does the tooltip work outside of the WB?
I don't think there is such a scripted event.Is there a scripted event that destroys Indian cities in 600AD scenario. Moreover, which function controls birth of civs?
I don't think there is such a scripted event.
If you select a civ that requires autoplay, it spawns immediately at 500 ad with a warrior, no tech and no flip. The ai spawns work fine though.
^This.I have a feeling that the problem relating to the player not spawning as well as the loading dates error is somewhere in CvRhye or whatever it is called. Leoreth, did you encounter the same problem in the 1700 AD? Do you think that is where the autoplay and opening screen problems are?
You probably will have to change the scenario starting date in RFCUtils.py and CvGameCoreUtils.cpp.
Maybe you have to make sure that pCity isn't null? Usually you are in a city screen when showing the unit tooltip, but that's not the case when you're in the world builder interface, so it could be a null pointer exception.
if (GC.getUnitInfo(eUnit).getPrereqAndBonus() != NO_BONUS)
{
if (NULL == pCity)
{
if (!isPlotGroupConnectedBonus(getOwnerINLINE(), (BonusTypes)GC.getUnitInfo(eUnit).getPrereqAndBonus()))
{
return false;
}
}
else
{
if (!pCity->hasBonus((BonusTypes)GC.getUnitInfo(eUnit).getPrereqAndBonus()))
{
return false;
}
}
// srpt resource unit restriction mk II
int iJ = 0;
for (int iI = 0; iI < GC.getNumUnitInfos(); iI++)
{
if ( GC.getUnitInfo((UnitTypes)iI).getPrereqAndBonus() == GC.getUnitInfo(eUnit).getPrereqAndBonus() )
{
UnitClassTypes eUnitClass = ((UnitClassTypes)(GC.getUnitInfo((UnitTypes)iI).getUnitClassType()));
iJ += (GET_PLAYER(getOwnerINLINE()).getUnitClassCountPlusMaking(eUnitClass));
}
}
if (iJ >= ((pCity->getNumBonuses((BonusTypes)GC.getUnitInfo(eUnit).getPrereqAndBonus())) * 6) )
{
return false;
}
}
// srpt end
// srpt resource unit restriction
if (pCity != NULL)
{
if( GC.getUnitInfo(eUnit).getPrereqAndBonus() != NO_BONUS )
{
iJ = 0;
int iK = 0;
int iL = 0;
for (int iI = 0; iI < GC.getNumUnitInfos(); iI++)
{
if ( GC.getUnitInfo((UnitTypes)iI).getPrereqAndBonus() == GC.getUnitInfo(eUnit).getPrereqAndBonus() )
{
UnitClassTypes eUnitClass = (UnitClassTypes)GC.getUnitInfo((UnitTypes)iI).getUnitClassType();
iJ += (GET_PLAYER(ePlayer).getUnitClassCountPlusMaking(eUnitClass));
}
}
iK = pCity->getNumBonuses((BonusTypes)GC.getUnitInfo(eUnit).getPrereqAndBonus())*6;
iL = (iK - iJ);
if (iL < 0)
{
iL = 0;
}
szBuffer.append(NEWLINE);
szBuffer.append(gDLL->getText("TXT_KEY_UNIT_RESOURCE_BASED_UNIT_LEFT", (iL)));
}
}
thank you Leoreth. I have no idea what a null pointer is but I got it to work. here is the whole implementation in case anyone is interested or wants to use it in a mod. one caveat is that it doesn't deal with "Or" bonus prereqs.
in CvPlot::canTrain:
Spoiler :Code:if (GC.getUnitInfo(eUnit).getPrereqAndBonus() != NO_BONUS) { if (NULL == pCity) { if (!isPlotGroupConnectedBonus(getOwnerINLINE(), (BonusTypes)GC.getUnitInfo(eUnit).getPrereqAndBonus())) { return false; } } else { if (!pCity->hasBonus((BonusTypes)GC.getUnitInfo(eUnit).getPrereqAndBonus())) { return false; } } // srpt resource unit restriction mk II int iJ = 0; for (int iI = 0; iI < GC.getNumUnitInfos(); iI++) { if ( GC.getUnitInfo((UnitTypes)iI).getPrereqAndBonus() == GC.getUnitInfo(eUnit).getPrereqAndBonus() ) { UnitClassTypes eUnitClass = ((UnitClassTypes)(GC.getUnitInfo((UnitTypes)iI).getUnitClassType())); iJ += (GET_PLAYER(getOwnerINLINE()).getUnitClassCountPlusMaking(eUnitClass)); } } if (iJ >= ((pCity->getNumBonuses((BonusTypes)GC.getUnitInfo(eUnit).getPrereqAndBonus())) * 6) ) { return false; } } // srpt end
and the tooltip, in CvGameTextMgr::setUnitHelp:
Spoiler :Code:// srpt resource unit restriction if (pCity != NULL) { if( GC.getUnitInfo(eUnit).getPrereqAndBonus() != NO_BONUS ) { iJ = 0; int iK = 0; int iL = 0; for (int iI = 0; iI < GC.getNumUnitInfos(); iI++) { if ( GC.getUnitInfo((UnitTypes)iI).getPrereqAndBonus() == GC.getUnitInfo(eUnit).getPrereqAndBonus() ) { UnitClassTypes eUnitClass = (UnitClassTypes)GC.getUnitInfo((UnitTypes)iI).getUnitClassType(); iJ += (GET_PLAYER(ePlayer).getUnitClassCountPlusMaking(eUnitClass)); } } iK = pCity->getNumBonuses((BonusTypes)GC.getUnitInfo(eUnit).getPrereqAndBonus())*6; iL = (iK - iJ); if (iL < 0) { iL = 0; } szBuffer.append(NEWLINE); szBuffer.append(gDLL->getText("TXT_KEY_UNIT_RESOURCE_BASED_UNIT_LEFT", (iL))); } }
To whenever the scenario starts. 500 AD in this case apparently.
// Leoreth: identify the active scenario
ScenarioTypes getScenario()
{
if (GET_PLAYER((PlayerTypes)EGYPT).isPlayable()) return SCENARIO_3000BC;
if (GET_PLAYER((PlayerTypes)GREECE).isPlayable()) return SCENARIO_500AD;
if (GET_PLAYER((PlayerTypes)BYZANTIUM).isPlayable()) return SCENARIO_600AD;
return SCENARIO_1700AD;
}
int getScenarioStartYear()
{
ScenarioTypes eScenario = getScenario();
if (eScenario == SCENARIO_3000BC) return -3000;
else if (eScenario == SCENARIO_500AD) return 500:
else if (eScenario == SCENARIO_600AD) return 600;
else return 1700;
}
int getScenarioStartTurn()
{
return getTurnForYear(getScenarioStartYear());
}
def getScenario(self):
if gc.getPlayer(con.iEgypt).isPlayable():
return con.i3000BC
if gc.getPlayer(con.iGreece).isPlayable():
return con.i500AD
if gc.getPlayer(con.iByzantium).isPlayable():
return con.i600AD
return con.i1700AD
def getScenarioStartYear(self):
lStartYears = [-3000, 500, 600, 1700]
return lStartYears[self.getScenario()]
def getScenarioStartTurn(self):
return getTurnForYear(self.getScenarioStartYear())
Have you compiled the C++ code?
Looking how to compile a DLL in general is probably too much for your purposes because you still have to figure out how to compile the BtS source code. I recommend this tutorial instead.
In general, the Civ4 Modiki is worth checking out for more general information about Civ4 modding - maybe you want an overview of how the game as a whole is structured instead of my very narrow answers for specific features.