Hey guys, I've been trying to implement missions a couple of times already, but am struggling with an issue I'm sure some of you faced : despite me being extremely careful in the mission order etc. it looks like I "bumped" the order and its producing obvious bugs :
i) All units starts fortified/fortifying when created
ii) all Worker animation is out of whack, they always "run" instead of build stuff
I guess it's pretty obvious (not sure though) that I'm missing an entry somewhere and that it doesn't understand the list properly.
Where am changing : Absolutely everywhere in C++ just under the MISSION_INFILTRATE
What I read here on the forum:
That the Missions in Civ4MissionsInfo.xml need to be in same order than CvEnums.h, but I did that, and I even did all the rest of my SDK code the same way, always behind mission infiltrate
This is how I structured in XML
What am left with:
My development is actually 100% functional, it's the side consequences I want to fix.
My Mission does that a given unit (workers) can join a city, grow it's population by 1, presuming it has a dedicated (UB) building, and it's not the last 20 turns of the game. This is all working well.
The main piece in CvUnit.cpp. Just under the 2 function that to the job for MISSION INFILTRATE:
What I should be looking at:
I don't know... here below a sample of what I do, you'll see it's a plagiate 1-to-1 of the mission above,
I can send all code (marked with 2.06h) if need be but not sure it's useful.
I don't think am looking at why my units all start fortified,
I think am looking at where else I need to declare something and haven't
CvGameCoreUtils
CvSelectionGroup
I would love some help ! Thanks a ton
i) All units starts fortified/fortifying when created
ii) all Worker animation is out of whack, they always "run" instead of build stuff
I guess it's pretty obvious (not sure though) that I'm missing an entry somewhere and that it doesn't understand the list properly.
Where am changing : Absolutely everywhere in C++ just under the MISSION_INFILTRATE
Spoiler :
Code:
MISSION_INFILTRATE,
MISSION_GROWTHCITY,//2.06h
What I read here on the forum:
That the Missions in Civ4MissionsInfo.xml need to be in same order than CvEnums.h, but I did that, and I even did all the rest of my SDK code the same way, always behind mission infiltrate
This is how I structured in XML
Spoiler :
Code:
<MissionInfo>
<Type>MISSION_INFILTRATE</Type>
<Description>TXT_KEY_MISSION_INFILTRATE</Description>
<Help>TXT_KEY_MISSION_INFILTRATE_HELP</Help>
<Waypoint>NONE</Waypoint>
<EntityEventType>ENTITY_EVENT_GREAT_EVENT</EntityEventType>
<iTime>18</iTime>
<bTarget>0</bTarget>
<bBuild>0</bBuild>
<bSound>0</bSound>
<HotKey/>
<bAltDown>0</bAltDown>
<bShiftDown>0</bShiftDown>
<bCtrlDown>0</bCtrlDown>
<iHotKeyPriority>0</iHotKeyPriority>
<HotKeyAlt/>
<bAltDownAlt>0</bAltDownAlt>
<bShiftDownAlt>0</bShiftDownAlt>
<bCtrlDownAlt>0</bCtrlDownAlt>
<iHotKeyPriorityAlt>0</iHotKeyPriorityAlt>
<bVisible>1</bVisible>
<Button>,Art/Interface/Buttons/TechTree/Corporation.dds,Art/Interface/Buttons/Beyond_the_Sword_Atlas.dds,7,16</Button>
</MissionInfo>
<MissionInfo>
<Type>MISSION_GROWTHCITY</Type>
<Description>TXT_KEY_MISSION_GROWTHCITY</Description>
<Help>TXT_KEY_MISSION_GROWTHCITY_HELP</Help>
<Waypoint>NONE</Waypoint>
<EntityEventType>ENTITY_EVENT_GREAT_EVENT</EntityEventType>
<iTime>18</iTime>
<bTarget>0</bTarget>
<bBuild>0</bBuild>
<bSound>0</bSound>
<HotKey/>
<bAltDown>0</bAltDown>
<bShiftDown>0</bShiftDown>
<bCtrlDown>0</bCtrlDown>
<iHotKeyPriority>0</iHotKeyPriority>
<HotKeyAlt/>
<bAltDownAlt>0</bAltDownAlt>
<bShiftDownAlt>0</bShiftDownAlt>
<bCtrlDownAlt>0</bCtrlDownAlt>
<iHotKeyPriorityAlt>0</iHotKeyPriorityAlt>
<bVisible>1</bVisible>
<Button>,-,Art/Interface/Buttons/and_misc_buttons.dds,4,14</Button>
</MissionInfo>
What am left with:
My development is actually 100% functional, it's the side consequences I want to fix.
My Mission does that a given unit (workers) can join a city, grow it's population by 1, presuming it has a dedicated (UB) building, and it's not the last 20 turns of the game. This is all working well.
The main piece in CvUnit.cpp. Just under the 2 function that to the job for MISSION INFILTRATE:
Spoiler :
Code:
bool CvUnit::isJoinCity() const //2.06h
{
return m_pUnitInfo->isJoinCity();
}
bool CvUnit::canGrowthCity(const CvPlot* pPlot, bool bTestVisible) const//2.06h
{
if (isDelayedDeath())
{
return false;
}
if (GC.getGameINLINE().getMaxTurns() - GC.getGameINLINE().getElapsedGameTurns() < 20)
{
return false;
}
if (!isJoinCity())//Attribute of the unit
{
return false;
}
CvCity* pCity = pPlot->getPlotCity();
if (pCity == NULL || pCity->isBarbarian())
{
return false;
}
if (pCity->getAllowsJoin() <= 0)//This counter goes over 1 each time the city builds a building which allows units to join
{
return false;//2.06s
}
return true;
}
bool CvUnit::GrowthCity()//2.06h
{
if (!canGrowthCity(plot()))
{
return false;
}
NotifyEntity(MISSION_GROWTHCITY);
kill(true);
CvCity* pCity = plot()->getPlotCity();
pCity->changePopulation(1);
return true;
}
What I should be looking at:
I don't know... here below a sample of what I do, you'll see it's a plagiate 1-to-1 of the mission above,
I can send all code (marked with 2.06h) if need be but not sure it's useful.
I don't think am looking at why my units all start fortified,
I think am looking at where else I need to declare something and haven't
CvGameCoreUtils
Spoiler :
Code:
case MISSION_INFILTRATE: szString = L"MISSION_INFILTRATE"; break;
case MISSION_GROWTHCITY: szString = L"MISSION_GROWTHCITY"; break;//2.06h
Spoiler :
Code:
case MISSION_INFILTRATE:
if (pLoopUnit->canInfiltrate(pPlot, bTestVisible))
{
return true;
}
break;
case MISSION_GROWTHCITY://2.06h
if (pLoopUnit->canGrowthCity(pPlot, bTestVisible))
{
return true;
}
break;
I would love some help ! Thanks a ton