Quick Modding Questions Thread

Is units running in place (animation) a known issue with BtS? Or should I worry that I've messed something up? In the attached screenshot, only one guy jogs. I think he does it forever while the group (of 4 Axemen and 1 Spearman) remains selected. If I select a different group, he stands still; then, if I select his group again, he continues. If I break the group up, he stops for good. I imagine that there is a way to reproduce this from a savegame by selecting and moving units in some particular sequence (but I don't know which sequence).
IIRC I have seen similar thing but those units were jogging only for a little and then stopped. But I also play with single unit graphics.
 
There is such a popular mod on revolution, but no one knows how to change the scheme by which it is determined how many revolutionary units should spawn? I just think there are too many of them, I would like to correct
I mean, what is the name of the file, where this changes. If there is one at all
 
Thanks, Nexus and Inthegrave. I'm also familiar with units running all across the map in BtS, but, yes, just one guy goofing around is strange. I guess I'll have to pay more attention to this until I come across a game state where I can reproduce it.
 
I found a file, it turned out to be Revolution, no matter how trite it turned out
Now I have to record hordes of troops from the air!
 
In custom map scripts (i.e. randomly generated maps), is there any way to restrict which civs are available to select, based on the map script? I am aware that there is a bPlayable property in the civilizations XML file, but that is a global setting that applies to all maps in my mod.

Is there a way, for example, to have an East Asia map script that only allows selecting East Asian civilizations and a Europe map script that only allows selecting European civilizations within the same mod?
 
@Leoreth: I've just tried this
Code:
void CvInitCore::setMapScriptName(CvWString const& szMapScriptName)
{
   GC.getCivilizationInfo((CivilizationTypes)0).setPlayable(
           szMapScriptName != CvWString("Fractal"));
   // ...
}
and it does throw America out of the civ selection menu, however, the menu choices are apparently not updated when a different map is selected. I suspect that the Custom Game screen never updates them. Actually, I've looked into filtering the leader choices for someone else earlier this year and concluded that (copying from a private convo) it "looks like the EXE puts together the list of leaders only once when the screen is opened. I see no way to get it to update the list at a later point. The leaders are listed in the order of Civ4LeaderHeadInfos.xml, so one could at least group the leaders in that file." The ordering seems to work that way for civs too, but I don't suppose that helps. Having to scroll past, say, all the East Asian civs when playing the Europe map is pretty bad, and invalid civs could still be selected and would have to be dealt with once the game has been launched, e.g. by assigning a random civ instead.

Overlaying a new civ selection menu (as a small Python screen) onto the Custom Game screen should be possible, and my thread about replacing the whole Custom Game screen could be a starting point for that. Not sure how to deal with the original menu; covering it up would be best I guess. Seems that the keyboard (Tab key) can't mess with the upper half of the screen. Apart from that, it would probably suffice to have the overlay change the CvInitCore data (setCiv, setLeader, to be exposed to Python) in the DLL – the EXE does not seem to overwrite that data upon game launch. And CvInit::setMapScriptName would have to cause the overlay to be updated.

For the Play Now screen, the snippet on top seems to work. Hm, you didn't actually write that you want to use the Custom Game screen ...
 
Thanks for the info! When you say "the snippet above" you mean dynamically setting the playable property based on the selected map script?

If that solution works for the Play Now screens I'd be fine with it; that was supposed to be the main way of interacting with it. Having the custom game menu be available too would have been nice but it's not critical.

Mainly I also wanted to rule out that there isn't any way to do this that had been intended by Firaxis that I missed, before messing with stuff at the DLL/executable interface. Good to know it's still doable.
 
Thanks for the info! When you say "the snippet above" you mean dynamically setting the playable property based on the selected map script?
Yes. When I tried it, setMapScriptName got called upon clicking the radio button next to a map script or scenario (Play Now/ Play Scenario) or selecting a map script or scenario from the drop-down on the Custom Game/ Custom Scenario screen. And upon returning to the main menu. So that seems promising. The CvCivilizationInfo::setPlayable function doesn't exist, but would just be an ordinary setter.
 
For Beyond the game I wanted to do the same thing for American civ and remove them as possibilities for the map Earth Evolution.

I did this via a gameoption, "North-American civ banned" which you can check uncheck in game staging. Once checked the scroll list of civ choices does update. The only shortcoming is you need to 'click twice' if you choose a not allowed civ already.

Am away at the moment but source DLL is included in last version of BTG if you fancy, it's a new dedicated boolean under bPlayable (bAmerica I think) in civilizations info when the CivPlayable logic in C++ is written to take into account(my logic is a bit more tidy since I have actualy about 8 different options excluding civs).

It might not be exactly what you planned but it's possibly most straightforward. You could also have a callback function called in mapscripts which calls a function which overrides/redefined the bAvailable list, it's more work (you might find it cleaner though), I think with this approach it would work but only act when map generated so your scroll list in game staging would not be updated. So it works with random civ but if you pick an East Asian one you'll get something else (games handle this by default and kicks you to another civ I believe)
 
[...] I did this via a gameoption, "North-American civ banned" which you can check uncheck in game staging. Once checked the scroll list of civ choices does update.
So you'd think that with the hack in setMapScriptName that I posted, I could just toggle any game option after changing the map script and then America would be added or removed from the civ selection drop-down. Doesn't work for me, strangely. It does work when I toggle the Unrestricted Leaders option, and also when I change the difficulty level, team assignment or player details. Anyway, still not possible to cause an update programmatically (toggling Unrestricted Leaders via CvInitCore does not affect the Custom Game screen).
 
Follow up to the map script questions: is it possible in any way to disable the "Random Civilization" option? This doesn't have to be conditional on anything, it can be a mod wide setting.
 
And another question: the exe decides to list civilizations in alphabetical order, not their XML order, and I presume there is no way to change that without recreating the entire main menu?

Edit: if that's the case, any ideas for possible minimally invasive hacks/workarounds? I tried adding invisible html characters to the civilization names in the hope that it would impact their ordering but not how they are displayed, but the game seems to insist on rendering every nominally invisible unicode character I could find as a whitespace, so that also does not seem like it works.
 
Last edited:
Reordering on the Play Now screen – you may recall this question (@bluepotato posted some code on the next page too). I doubt that the "Random" choice can be removed. TXT_KEY_MAIN_MENU_RANDOM probably gets used in a bunch of places by the EXE, so one can't somehow repurpose it either. Overlaying a replacement menu would be my only idea. (Just covering up the Random choice wouldn't work because the menu has a scrollbar.)
 
Thanks! I can live with the random choice, although I would have preferred to remove it. The link was very helpful, I also considered prepending numbers but that looked too ugly in the civilopedia entries, but the idea of changing the name after the fact (or deleting it while the name is rendered where I have control over it) didn't occur to me. That seems workable.
 
How do you add new features to map scripts?
 
How do you add new features to map scripts?

I do not know myself, but Walter H (who made most if not all of the latest updates on the R:I mod) knows. Many features has been added to that mod. And they works(!),
 
@The Snug: Never done that, but here's my best bet:
The FeatureGenerator class in (Warlords - not modified by BtS) Assets\Python\CvMapGeneratorUtil.py should take care of most if not all of the standard map scripts. The complex community-created scripts (e.g. PerfectWorld) have their own feature placement code. If you only want to change one particular map script, then I think the script just needs to define a addFeatures function (no call parameters, no return value); some already have one, e.g. Donut. That function should call addFeatures on an instance of CvMapGeneratorUtil.FeatureGenerator and then place any novel features.

Edit: Features with an appearance probability get placed automatically by CvMapGeneratorUtil:
Spoiler :
Code:
for iI in range(self.gc.getNumFeatureInfos()):
    if pPlot.canHaveFeature(iI):
        if self.mapRand.get(10000, "Add Feature PYTHON") < self.gc.getFeatureInfo(iI).getAppearanceProbability():
            pPlot.setFeatureType(iI, -1)
 
Last edited:
Hey could anyone help me and let me know how to reduce the size of resource icons on the map? the resource circles on the tiles when you press control+R
 
@robbyextreme: For Globe view, it's easy to do, other than that, the only remedy is to play at a lower resolution (in a non-maximized window or on a smaller display). :(
(This more recent stab of mine at the problem also didn't accomplish anything.)
 
@robbyextreme: For Globe view, it's easy to do, other than that, the only remedy is to play at a lower resolution (in a non-maximized window or on a smaller display). :(
(This more recent stab of mine at the problem also didn't accomplish anything.)

alright thanks for the reply and links, that's a shame there's no mod for it. I'd turn them off but playing with icons off feels wrong while thinking.
 
Top Bottom