S3rgeus
Emperor
Missions is a very confusingly named table (IMO) in ../Assets/GamePlay/XML/Units/Civ5Missions.xml (and a corresponding one for G&K). It's basically all the unit actions that just 'do stuff', rather than constructing things. (All of those improvement building actions seem to be in Civ5Builds.xml in the same folder.) When I say these actions just 'do stuff', I mean things like "Spread Religion" or "Fortify". These are actions that change the state of the unit/game in different ways for each mission. (Obviously, building a route (roads, railroads) to somewhere is very different from spreading religion, but they're both missions.)
Now, I'm trying to understand how one goes about adding a new mission that players can use (and the AI too, but I'm not yet sure where it gets its mission-related info). As far as I can tell, which missions are available and which missions a unit can perform (so the button actually shows up) are hardcoded in CvUnitMission.cpp (in the DLL). I'm working on a total conversion mod, so I have no problems with compatibility (in that I'm abandoning the distant hope of compatibility with anything). But I want to make sure I'm not missing something.
Has anyone found a way to add new missions without DLL changes that simply test for that mission case in CvUnitMission.cpp? (I would post in the SDK/Lua subforum, but if there is an XML solution to this, I wouldn't want someone who knows the answer to miss it.)
As far as I've seen it's not possible, but I want to make sure. And, if it does turn out to be impossible, would people be interested in a more modular system that relies properly on the DB instead of a massive enum and a huge else-if block? That way new missions could be added to the DB and their success/capabilities could be exposed through Lua events. (I have ideas about how to do this, but want to make sure I'm not missing some glaringly obvious alternative to rewriting the mission-handling code.)
Now, I'm trying to understand how one goes about adding a new mission that players can use (and the AI too, but I'm not yet sure where it gets its mission-related info). As far as I can tell, which missions are available and which missions a unit can perform (so the button actually shows up) are hardcoded in CvUnitMission.cpp (in the DLL). I'm working on a total conversion mod, so I have no problems with compatibility (in that I'm abandoning the distant hope of compatibility with anything). But I want to make sure I'm not missing something.
Has anyone found a way to add new missions without DLL changes that simply test for that mission case in CvUnitMission.cpp? (I would post in the SDK/Lua subforum, but if there is an XML solution to this, I wouldn't want someone who knows the answer to miss it.)
As far as I've seen it's not possible, but I want to make sure. And, if it does turn out to be impossible, would people be interested in a more modular system that relies properly on the DB instead of a massive enum and a huge else-if block? That way new missions could be added to the DB and their success/capabilities could be exposed through Lua events. (I have ideas about how to do this, but want to make sure I'm not missing some glaringly obvious alternative to rewriting the mission-handling code.)