1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Platy World Builder

Discussion in 'Civ4 - Mod Components' started by platyping, Mar 27, 2013.

  1. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    1) Plot Yield
    Modified Plot Yield is not so straightforward. There isn't a getExtraPlotYield(xxx) command, so what you see is actually tedious calculations based on terrain, subtracting improvement, etc.
    Thus, saving it is a chore. I remembered attempting to modify plot yield on that save file before and it CTD, so chances are it is unlikely to happen.

    2) City Leader Icon
    Doable easily

    3) End all players
    Not sure if it is actually needed. If my game hang, I definitely want to know who is the culprit, so I will want to end each player one by one. Adding such a function is doable, just a matter of layout.

    4) Mouseover
    Doable easily

    5) Wait/Fort/Finish Status
    Adding another column is doable, which then makes the color coding unnecessary. If necessary, that page can be broken into 2 separate ones, for units and cities so that each can display more sortable data, such as population, culture level etc for cities.

    Busy these few days, so wont happen too soon.
     
  2. Acek

    Acek Chieftain

    Joined:
    Jun 3, 2008
    Messages:
    22
    Location:
    Piteå, Sweden
    The plot thing could (not effectively, but would work) be worked around if it would be possible to change MP options while hosting a single player save in MP. Anyone know if this is possible? I for example tried to host my saved file, which would work if I would be able to use "take over AI" and add "simultaneously turns".
    Sorry for off-topic but I'm desperate for this to work xD
     
  3. MagisterCultuum

    MagisterCultuum Great Sage

    Joined:
    Feb 14, 2007
    Messages:
    16,343
    Location:
    Kael's head
    Couldn't you allow custom plot yields not by keeping track of the extra yields, but by saving the total yields when saving and then when reading setting the plot's yields to zero before adding the custom value?

    --------

    I realize now that my Skip All Players button is not particularly useful, as players who have not yet had their turn have such things reset at the start of the turn anyway.

    What is very useful is an easy way to identify which player's turn is currently in progress, as it would be that player's units which are the troublemakers.

    It can be hard to glean that information even by reading the logs, as the repeated statements of the units stuck in a loop may be several pages down from the last mention of the player to which they belong and it can be easy to miss that when scrolling up.

    I discovered that this is an easy feature to add, like so:
    Code:
    
    		screen.addDropDownBoxGFC("CurrentPlayer", 20, 20, screen.getXResolution()/5, WidgetTypes.WIDGET_GENERAL, -1, -1, FontTypes.GAME_FONT)
    		for i in xrange(gc.getMAX_PLAYERS()):
    			pPlayerX = gc.getPlayer(i)
    			if pPlayerX.isEverAlive():
    				sText = pPlayerX.getName()
    				if not pPlayerX.isAlive():
    					sText = "*" + sText
    [COLOR="Red"]				if pPlayerX.isTurnActive():
    					sText = "[" + sText + "]"[/COLOR]
    				screen.addPullDownString("CurrentPlayer", sText, i, i, i == iPlayer)

    --------

    As I said I tried adding another Wait/Fort/Finish Status column, but couldn't get it to sort and so found it useless.
     
  4. MagisterCultuum

    MagisterCultuum Great Sage

    Joined:
    Feb 14, 2007
    Messages:
    16,343
    Location:
    Kael's head
    I figure I might as well upload my recent non-FfH2-related changes here.

    This adds the leader icons for buildings, the "Skip Turn"/"Kill" mousovers, the brackets around the player's whose turn it is (on all player drop down menus), and my aesthetic rearrangement of the Units+Cities screen.

    It also cleans up a lot of unnecessary white space from otherwise unaltered files; if you use these files as your basis for future versions then it would make the merger process much less annoying for me.
     
  5. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Version 4.13

    1) Modified from Magister's version with minor fixes and changes. Removed Magister's comments not out of disrespect, but since I know you are gonna add your own FFH's changes, so easier for you to tell what is in original WB. Also, easier for me to identify new changes from you in future.

    2) Added All/Team/Player to Religion and Corporation pages, as well as Leader Icons.
    Now you can add a religion to all players' cities with a click.

    3) All/Owner/Team in all pages changed to All/Team/Player as "Owner" does not make sense in some pages like Religion.
    Also weird for Player to be in between 2 bigger groups.

    4) Added a column for Wait/Fortify/Moved to Units + Cities List page.
    Removed color coding, and use that for Selected item instead of bold, to be consistent with other pages.

    Plot Yield will take some exploration, so I leave it till I am free.
     
  6. MagisterCultuum

    MagisterCultuum Great Sage

    Joined:
    Feb 14, 2007
    Messages:
    16,343
    Location:
    Kael's head
    Thanks platyping!

    I was about to go to sleep, but just downloaded and started testing this version instead.

    The first problem I noticed is that the color coding in the Units + Cities page is not updating when I select a different unit, which makes it more confusing than having no color coding at all.

    It would probably be better if there were some mouseover to help identify what each of the new the Wait/Fortify/Moved icons represents.

    If I click on one of those new icons, then the unit gets deselected. The map disappears as does the link above it, but I can still use the link in the drop down menu to go to the unit screen. There are python errors due to no unit with an ID of -1 existing, which causes most of the screen not to load.


    The link on the Plot Data page that should go to the Units + Cities list page does not do anything. It seems that I overlooked this bit of code, as most of the changes in WBPlotScreen.py were FfH2 specific.
    Spoiler :
    Code:
    		elif inputClass.getFunctionName() == "CurrentPage":
    			iIndex = screen.getPullDownData("CurrentPage", screen.getSelectedPullDownID("CurrentPage"))
    			if iIndex == 1:
    				WBEventScreen.WBEventScreen().interfaceScreen(pPlot)
    			elif iIndex == 2:
    				WBPlayerScreen.WBPlayerScreen().interfaceScreen(pPlot.getOwner())
    			elif iIndex == 3:
    				WBTeamScreen.WBTeamScreen().interfaceScreen(pPlot.getTeam())
    			elif iIndex == 4:
    				if pPlot.isCity():
    					WBCityEditScreen.WBCityEditScreen(CvPlatyBuilderScreen.CvWorldBuilderScreen()).interfaceScreen(pPlot.getPlotCity())
    			elif iIndex == 5:
    				pUnit = pPlot.getUnit(0)
    				if pUnit:
    					WBUnitScreen.WBUnitScreen(CvPlatyBuilderScreen.CvWorldBuilderScreen()).interfaceScreen(pUnit)
    
    #Magister Start
    			elif iIndex == 6:
    				if pPlot.isCity():
    					WBPlayerUnits.WBPlayerUnits().interfaceScreen(pPlot.getPlotCity().getOwner())
    				else:
    					pUnit = pPlot.getUnit(0)
    					if pUnit:
    						WBPlayerUnits.WBPlayerUnits().interfaceScreen(pUnit.getOwner())
    					elif pPlot.isOwned():
    						WBPlayerUnits.WBPlayerUnits().interfaceScreen(pPlot.getOwner())
    #Magister Stop
    			elif iIndex == 11:
    				iPlayer = pPlot.getOwner()
    				if iPlayer == -1:
    					iPlayer = CyGame().getActivePlayer()
    				WBInfoScreen.WBInfoScreen().interfaceScreen(iPlayer)
     
  7. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Updates:
    Fix all the above
     
  8. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Version 4.13b

    Diplomacy:
    1) No longer able to change war status between Master and Vassals.
    Irritating when i wanna declare war on all others and end up declaring war on my vassals too.

    2) Fix a bug with changing attitude. Free vassals are supposed to be permanently friendly, not capitulated ones.
     
  9. Blazekingz

    Blazekingz Chieftain

    Joined:
    Jul 11, 2013
    Messages:
    15
    Im new to modding civ 4 and i just downloaded this mod. Am i suppose to have something alongside this mod? Cause when i use it my UI disapears and in the world builder i have 2 empty blue boxes.
     
  10. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Unless you are not using BTS 3.19 patch, I don't see this issue with others.
     
  11. Blazekingz

    Blazekingz Chieftain

    Joined:
    Jul 11, 2013
    Messages:
    15
    Remember when i was mentioning i was noob to the civ 4 modding, i forgot to mention i was also a noob to the game. Played more than enough civ 5 but never played civ 4. I seemed to have selected the vanilla game instead of the beyond the sword one which was up to date.

    So yeah it works now...
     
  12. Erha

    Erha Chieftain

    Joined:
    Aug 4, 2015
    Messages:
    3
    Hi am new to modding/making new scenarios. I have figured out how to edit XML pretty well, and do somethings with making new graphics for leaderheads/units/buildings etc. My question is, does this world builder allow you to create anything new or purely just manipulate what already exists in your game? Can it be used to create new techs etc? I am getting the impression it doesn't allow for that but it looks great and would be awesome if it did. Am I wrong?
     
  13. ales_

    ales_ Heir

    Joined:
    Apr 10, 2012
    Messages:
    5,639
    Gender:
    Male
    Location:
    Toulouse, France
    If I understand you correctly, you're wrong.
     
  14. Xyth

    Xyth History Rewritten

    Joined:
    Jul 14, 2004
    Messages:
    4,054
    Location:
    Aotearoa
    Hey Platy, I've come across some instability on the Units+Cities page when it comes to Barbarians. Firstly, opening the page for one player and then using the dropdown to switch to the Barbarian player will cause a CTD. Secondly, if you kill a Barbarian unit, then close the page, reopening it will also cause a CTD. I'm not sure if this happens with non-Barbarian players too, but I can reproduce it every time with them.
     
  15. MagisterCultuum

    MagisterCultuum Great Sage

    Joined:
    Feb 14, 2007
    Messages:
    16,343
    Location:
    Kael's head
    I have not had any such instability with the Units + Cities page in my version.

    I have found some cases where I get python errors that don't seem to matter much, but not a crash. It seems they can be fixed by adding this red line within def setUnitTable(self):
    Code:
    		(loopUnit, iter) = pPlayer.firstUnit(False)
    		while(loopUnit):
    			[COLOR="Red"]if loopUnit.isNone():continue[/COLOR]
    			iRow = screen.appendTableRow("WBUnitList")
    

    I recently had a request to add a function to kill/skip all units of the same unit type. I went ahead and implemented this for my modmod, and did the same for unit combat and domain while I was at it. I'm thinking of also adding units on the same plot, in the same area, and of the same unit AI type.

    (I had to put the code for these buttons under placeUnitMap rather than interfaceScreen, but they seem to work fine. I also had to shift the map over to the right instead of centering it to make room for text explaining to what units each button would apply.)

    You are of course welcome to borrow that code with you if you are interested, once I've tested it a bit more and released it.


    I also just added the ability to change a unit's Fortify Turns. It seems like such a basic thing that you'd want it in your version too, but when I searched the API found pUnit.getFortifyTurns() listed but not pUnit.setFortifyTurns(). The latter function might have been exposed by Kael only for FfH2, in which case it is no use to you.
     
  16. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Hmm, might look into it when I have time, cause I already uninstalled Civ IV since not much requests nowadays.

    Xyth, perhaps you can test it out in plain WB to see if the problem occurs as well, or just in your HR mod?

    @Magister
    You might be wary of using continue in a while loop. I tried it out before in other mod comps. It will cause a infinite loop hang, if it happens to continue at the final iteration. (Last unit/city)

    @Fortify
    SetFortifyTurns is definitely not available.
     
  17. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    Code:
    
    
    It looks like I have another problem with the WB, more specifically with the file CvWBDesc.py.

    I'm trying to set a Scenario with a Team 16 a vassal of Team 15. So in Team 16, I write "VassalOfTeam=15".

    In game, the contrary happens and 15 is a vassal of 16. When I go to the WB and write the file as such, I see that the game added a "VassalOfTeam=16" to the Team 15 (which corresponds to the wrong situation - I then discarded these changes).

    I then changed the CvWBDesc file in def applyInitialItems to replace the "Team" stuff with the original BtS version and now the vassal is expressed correctly.

    Could you please have a look at it and tell us what you think? Thank you! :)

    PS/Edit:

    Same declaration for both:
    Code:
    					pTeam = gc.getTeam(iTeamLoop)
    					pWBTeam = self.teamsDesc[iTeamLoop]
    but:

    Original BtS version:
    Code:
    					for vassalTeam in self.teamsDesc[iTeamLoop].bVassalOfTeamList:
    						gc.getTeam(vassalTeam).assignVassal(iTeamLoop, true)
    Your version:
    Code:
    			for item in pWBTeam.bVassalOfTeamList:
    				pTeam.assignVassal(item, true)
    It's the second line which is problematic, as the Team in your version is the Team of "iTeamLoop" and it is different than the Team of "vassalTeam" or "item".

    Solution:
    Code:
    gc.getTeam(item).assignVassal(iTeamLoop, true)
    It looks like it is an isolated case in the function.
     
  18. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    I have another problem with the CvWBDesc.py file.

    It's about the "StateReligionBuilding=" derived from the Organized Religion Civic and the "CoastalTradeRoute=" from the Great Lighthouse (there might be other ones).

    It looks like the values are cumulated if you write a WBS file from within the WB.

    For example, my "StateReligionBuilding=25" became "StateReligionBuilding=50" and
    my "CoastalTradeRoute=2" became "CoastalTradeRoute=4".

    I believe that you added this information. I wonder if it is useful when the game will apply them anyway if the Civic is applied or if the Wonder exists and is not obsoleted.
     
  19. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Fixed the one for vassals.
    As for the other one, didn't test it out yet.

    There are various other new such functions for users to add SRB or CTR to certain teams even if they are not running certain civics.
     
  20. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    Thanks.

    Still, I think that the WBS file should only contain information that will influence the launching of a game and that such modifiers (SRB, CTR) should not come out of this file. They should come from an identifiable process in game and ideally should be documented.
     

Share This Page