Mod-Modders Guide to Fall Further

Just passing through, but did you edit the python for the screens to handle with the new parameter you added?
 
Alright, good news and bad news. Found the issue of the python errors I posted (I'm an idiot, will explain below), but now it's just not showing the requirement. The requirement DOES function (Testing it found the other issue), but the display doesn't.


As for what was causing the bug... In several project entries, I listed CIVILIZATION_ILLIAN instead of ILLIANS. There was no popup about a nonexistant civ when it was loading, so I almost didn't catch it... But I had added the Illians to the Austrin ritual for testing, and found they couldn't build it. Checked the xml, found the issue, fixed it on that one... And then did a replace command for Illian->Illians. Resulting in the one I already fixed reading ILLIANSS. :wallbash: Which then led to another hour of checking for a bug that didn't exist.
 
Actually, doing a complete recompile of the DLL after fixing the xml bug yielded this screenie... So it's working. :lol:
 

Attachments

  • Civ4ScreenShot0033.JPG
    Civ4ScreenShot0033.JPG
    183.1 KB · Views: 99
Yeah, that isn't an issue with your C++, especially not that in CvGameTextMgr. That is because there is a defined Filter/Sort rule set which CHECKS the PrereqCivilization, and you changed the function that it is trying to call :p You have to fix that check to work properly (Since it was probably not set to check specific Civs, just to check that there was ANY prereqCiv, you want to target the "eProject.getNumPrereqCivilizations() > 0" condition now). If it was a sort rule, then that one you have to get creative on, either it sorts by just the first Civ prereq, or it needs removed completely, or you have to set up special rules such that it will sort/sub-sort however seems to make sense for you.


EDIT: Or there is another page and it was already solved as being something else entirely :ninja:
 
Hehe, yeah it's been fixed. And the sort was the first thing I removed... Already readded with the exact code you gave. :lol:

Question: Have you ever used setVassal in python? Looking at the API, the function is setVassal(TeamType eIndex, BOOL bVassal, BOOL bCapitulated), so I want setVassal(AscensionTeam, 1, 1). Testing it now, just wanting to see if you may have modified it somehow. ;)
 
EDIT: Nevermind, I'm an idiot. :lol: Didn't realize getTeam() only returned the teamnumber, not the actual team... And I should have, as Player works the same way. Grey Fox straightened me out. ;)

The code works, assigns LoopPlayer as a vassal to pPlayer... meaning if you follow the White Hand when someone ascends, you're now a vassal. Yes, I did test to make sure a player vassalizing to the AI wouldn't cause issues. ;)
Code:
gc.getTeam(pLoopPlayer.getTeam()).setVassal(pPlayer.getTeam(), true, false)


Also, I found a bug in your code (Presume it's in your code, as it refers to a Container and I didn't add it):

In the Ascension python:
Code:
containerUnit = -1
pPlot = pBestCity.plot()
for i in range(pPlot.getNumUnits()):
	if pPlot.getUnit(i).getUnitType() == gc.getInfoTypeForString('EQUIPMENT_CONTAINER'):
		containerUnit = pPlot.getUnit(i)
	if containerUnit == -1:
		containerUnit = gc.getPlayer(gc.getORC_PLAYER()).initUnit(gc.getInfoTypeForString('EQUIPMENT_CONTAINER'), [B]Caster[/B].getX(), [B]Caster[/B].getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
	containerUnit.setHasPromotion(gc.getInfoTypeForString('PROMOTION_GODSLAYER'), True)

The two bold portions should be pPlot.
 
eProject.getNumPrereqCivilizations() > 0"

I noticed in the source code that all your arrays are set up as dual integer - array counterparts, which looks like it might offer a speed and memory improvement, but... how big of an improvement was it to switch to a system like this?
 
I don't honestly need to keep the integer either, I can just use .size(), but since I have to store an integer for memory to read/write properly, I just decided to carry it around anyway so I didn't have to process .size() all the time either.

It is a bit of a tradeoff honestly. It saves storage space, since instead of a HUGE array with only 1 or 2 values being non-default, you just store those 1 or 2 values.

You never have to do a loop over all items in a file when you want to do an action with each non-default value either, so that saves speed.

But if you want to check for a SINGLE specific value, then you need to do a loop over all stored values to see if one of them matches up. HOWEVER, typically this is a very short loop, so I feel that in general you still wind up saving considerable time (especially when you are talking about a loop over promotions in our case, as we have hundreds, or units, or in most base BtS mods, loops over Civs)


Overall, I think that it is a HUGE improvement myself, but there are probably a few cases where it would be massively inappropriate that I am not thinking of at the moment. (like if you changed setHasPromotion to store in a list instead of array, then checking isHasPromotion would require a loop instead of a simple lookup, and thus take longer, and that is called a LOT)

Also, this method works best for a boolean array replacement, as then you swap one array with one list. For an integer array, then you wind up needing 2 lists, or a list of paired numbers, as the state needs quantified. I may make a generalized Struct for such a paired list though, as I am contemplating swapping out most arrays for these type of lists.
 
I don't honestly need to keep the integer either, I can just use .size(), but since I have to store an integer for memory to read/write properly, I just decided to carry it around anyway so I didn't have to process .size() all the time either.

It is a bit of a tradeoff honestly. It saves storage space, since instead of a HUGE array with only 1 or 2 values being non-default, you just store those 1 or 2 values.

Have you ever done quantitiative tests on the actual RAM savings? RoM is notorious for causing MAF's, and since adding more arrays, they appear even more frequently. I wonder if converting most of my changes into this style would offset some of the effects. I've also seen a increase in time for drawing the civilopedia and city screens because of my additions. :(

However, I noticed that the Reading from XML, especially with ReadPass2's, gets a lot more complicated than with standard arrays. I imagine this has to do with the different style of loading that takes place in CvXMLLoadUtilitySet.

Also, I didn't look, did you do anything similar for arrays of arrays?
 
Array of array would become a list of lists, don't think I have used any yet myself. No solid tests on savings, but they will likely help quite a bit.

And yes, loading from the XML is far more of a pain, as is saving. But it pays off eventually.
 
Ah, that's a bit of a tricky trail to follow. But since most probably you are seeking a specific unit to fiddle with, look for a GoodyInfos Type which creates that unit, then search for that Type key in python and you'll find it. Most of the LEX data has been collated into a few functions, but some outliers remain, so that is the most surefire method. Or if you really want all of them, search for GOODY_ and it'll not find too much beyond the LEX code.
 
Hello! I am currently trying to make a Warhammer 40k modmod based off of Rise of Mankind/A New Dawn. I was hoping I would be able to somehow use your system of paying gold for promotions to make unique promotions for units. I want to create Power Armour, Heavy Weapon upgrade promotions, etc for the Space Marines and allow the player to pay to tack as many of these as they can afford on to their unit. I gave a look through your work and I guess the fields that you have added to the promotions xml and it seems like you guys have made this a possibility.

Any guidance would be great, as I'm just getting into this modding thing and have only just created a new civ, building and unit through xml.

Thanks!
 
Adding new tags to the XML requires DLL work. The two you want, one to charge gold for a prromotion and another to not charge XP, are pretty simple work.

I'd advise you start with my Idiot's Guide to the DLL (in sig) and get a feel for DLL Coding, they could easily be your first projects.
 
Thanks for the guidance! Haha, I only just realized that you are the author of that guide! I just set up Codeblocks. I will get started immediately.
 
Thanks for the guidance! Haha, I only just realized that you are the author of that guide! I just set up Codeblocks. I will get started immediately.

A word of warning, codeblocks will not compile RevDCM's sources (The source code used for RoM is RevDCM's. Look in the OP of the RevDCM modpack thread for their source code), due to their additions. You will need to set up VS 2008.
 
It shouldn't be a problem to compile with codeblocks. He would just have to add the extra files to his project, pretty simple to do really (you just go to File, and select Add File to Project. Far easier than modifications to a Makefile)
 
Top Bottom