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. isenchine

    isenchine Empress

    Joined:
    Oct 18, 2010
    Messages:
    1,774
    Location:
    Brussels, Belgium
    So, where do we set self.bSpecial to 0 if we want? Only in the read function of the class CvWBDesc?
     
  2. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Instructions in post 1
     
  3. platyping

    platyping Sleeping Dragon

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

    CvWBDesc
    Code:
    BeginTeam
    	TeamID=1, (Sitting Bull)
    	Tech=TECH_MYSTICISM
    	Tech=TECH_MEDITATION
    	Tech=TECH_POLYTHEISM
    	Tech=TECH_PRIESTHOOD
    	Tech=TECH_MONOTHEISM
    	Tech=TECH_MONARCHY
    	EspionageTeam=2, EspionageAmount=7, (Shaka)
    	EspionageEverAmount=11
    	ContactWithTeam=0, (User)
    	ContactWithTeam=2, (Shaka)
    	ContactWithTeam=3, (Elizabeth)
    	ContactWithTeam=4, (Mansa Musa)
    	ContactWithTeam=5, (Suryavarman II)
    	AtWar=18, (Barbarian)
    	OpenBordersWithTeam=2, (Shaka)
    	VassalOfTeam=0, Type=CAP, (User)
    	RevealMap=0
    	VassalPower=37
    	MasterPower=86
    EndTeam
    WB Save Files now provide names of players and teams for easy identification in "( )". Notes that this is purely informative for modders to get a clearer picture. Editing the items in "( )" will not do anything as these data are not read back by the WB.
     
  4. platyping

    platyping Sleeping Dragon

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

    Units + Cities
    Units can now be sorted by their current "Activity".
    Means you can locate all units on Blockage or Intercept status.
    Added Activity Status to Unit Details Window.

    Unit Edit Screen
    Added New Command: Push Mission
    Push Mission allows you to force selected unit to blockage, fortify, intercept etc.
    Certain Missions require a target plot to be chosen, such as Move to and Route to.
    Certain Missions assume there is only one option, Spread Religion, Join City.
    Certain Missions are excluded due to complexity, Air Strike, Move to Unit, Build Improvements.

    Select the target plot and mission first before you choose to push mission.

    Notes:
    Move to in Commands is not same as Push Mission: Move to.
    The former will teleport the unit instantly, while the latter will manually try to crawl to destination.

    CvPlatyBuilderScreen
    Modifications done to select target plot

    This should now allows users to locate and stop units on blockage mission.
     
  5. MagisterCultuum

    MagisterCultuum Great Sage

    Joined:
    Feb 14, 2007
    Messages:
    16,341
    Location:
    Kael's head
    When I was first trying out the new move to location I accidentally sent some units to the non-existent (-1,-1) or (-2147483647, -2147483647) tile.

    Since the game was not able to generate unit maps for that plot, it caused python errors that made it hard to get them back.

    It was not hard to place the "screen.addPlotGraphicGFC(...)" statements within a "if not pUnit.plot().isNone:" conditional. It also seems to be necessary for other statements like if pUnit.getGroup().canStartMission(...)


    Maybe the default target tile should be set to the unit's current tile, rather than(-1,-1)


    I was surprised that units could even exist at a non-existent tile. I rather like that fact though, as I think it might be better for me to store the Sluagh dummy units in my modmod there rather than making the (0,0) tile impassible. That is, if we can prevent the python bugs so I still have a way to access them in worldbuilder. It will require more testing on my part.

    Edit: My testing seems to reveal that trying to load a saved game with units on the (-1,-1) tile causes the game to crash. I guess Storing units there won't be so useful.

    P.S. I don't see why moving a unit to a different tile should deselect that unit rather than just refreshing the screen so we can see the unit in its new locale.
     
  6. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Not sure how you managed to send it to (-1, -1) though.
    There is a if pTargetPlot: check to prevent it.
     
  7. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,544
    Gender:
    Male
    Location:
    Canberra, Australia
    (-1,-1) is a valid target plot:D. I made the same mistake. It is the default plot for the city rally point which is how I got it.
     
  8. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Tried and tested, clicking move while target plot is (-1, -1) does nothing.
     
  9. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,544
    Gender:
    Male
    Location:
    Canberra, Australia
    I got CTD if I did Ctrl-A ie move all units with actions set.
     
  10. MagisterCultuum

    MagisterCultuum Great Sage

    Joined:
    Feb 14, 2007
    Messages:
    16,341
    Location:
    Kael's head
    If you open up World Builder in a new game and the first thing you do is select a unit and use the Move To command without first selecting a target, it definitely moved the unit to (-1,-1)

    I have screen shots to prove it.

    The unit data screen is messed up enough that you cannot set a new target location while that unit is selected, but you can select a different unit, set a new target, and then go back to a unit at (-1,-1) from the Units + Cities page and move it to the new target plot.

    It seems odd to me that target plots carry over from one unit to another like that, but they do.
     

    Attached Files:

  11. platyping

    platyping Sleeping Dragon

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

    General
    Changed if pPlot: to if not pPlot.isNone():. Apparently the former does not work well.

    Unit Edit Screen
    1) Screen no longer closed after unit moved
    2) Target plot reset when screen closed.
    3) Enabled Air Bomb Mission, excluded by mistake. Air Strike is not disabled, but somehow it never pass canStartMission check.
     
  12. MagisterCultuum

    MagisterCultuum Great Sage

    Joined:
    Feb 14, 2007
    Messages:
    16,341
    Location:
    Kael's head
    Thanks Platyping! This version seems much better.

    I went ahead and merged it with MNAI and MagisterModmod, and it seems to be working fine so far.

    Before releasing those updates though, I think it would be good if we could change one more thing.

    Your code seems to be written on the assumption that a unit could only possibly be used to construct one building or join a city as one kind of specialist.

    In the FfH2 based mods, there are some which can join cities as multiple kinds of specialists some which can construct multiple types of buildings.

    I think that we should be able to push those join and construct missions separately. It should of course state the name of the specialist or building for that particular mission.

    I also think that the Discover Technology mission should show the name of the technology being researched, and maybe the amount of research granted towards that tech too.

    (There are no units able to spread multiple religions and no corporations at all in these mods, but in theory there could be. It would probably be best to list those missions separately too, and definitely good to specify what religion/corporation is being spread.)


    Would it be possible for mousing over the items in that missions list to show the same mouseover info as placing the cursor over the commands in the game?
     
  13. platyping

    platyping Sleeping Dragon

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

    1) Added a secondary filter for missions, where it is possible to have choices.
    Religions, Construct etc

    2) Added info text for certain missions, such as Discover and Hurry.

    3) Build Mission enabled.

    AFAIK, dropdowns do not have hover text, unless other formats are used, such as list tables, which take too much space.
     
  14. MagisterCultuum

    MagisterCultuum Great Sage

    Joined:
    Feb 14, 2007
    Messages:
    16,341
    Location:
    Kael's head
    Thanks Platyping! It just keeps getting better.

    It still is not perfect though.

    Could you make the Construct missions work for a unit's ForceBuildings too instead of just Buildings?

    Would it be possible to make the Hurry Production and Discover Technology missions specify how many :science: or :hammers: it will provide?

    And maybe show the icons for specific specialists, religions, corporations, ect?
     
  15. platyping

    platyping Sleeping Dragon

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



    Command: Move to
    Revert back to old style since Target Plot shifted away from the column.

    City Data 1
    Minor changes to align with the above for duplicate/move city

    Game Utils
    Hover Text for Builds

    Unit Edit Screen
    Massive changes

    P.S.
    Set all the parameters, then click Push Mission.
     
  16. MagisterCultuum

    MagisterCultuum Great Sage

    Joined:
    Feb 14, 2007
    Messages:
    16,341
    Location:
    Kael's head
    Why is it that after pushing a mission that moves the unit, you cannot select any more missions for that unit until after closing and opening world builder again?

    It makes sense for missions that kill the unit (like Join City, Construct, Hurry, Great Work, and Discover Technology), but seems off for the Move To or Route To missions.


    Aesthetically speaking, I think I'd prefer to have the missions drop down menu be aligned with the top of the top of the map and the Target Plot and Push Mission buttons below it, aligned with Script Data box. The box to let you select what to construct/spread/join/etc does not usually have enough options to fill a box of its current size.

    I'd either move the Awake/Hold/Mission text (which probably would be better if not ALL CAPS) to be near those buttons or place it just above or below the map. (The gap between the map and the Script Data label looks like the best spot.) It seems odd to have it bellow those radio buttons. (I have more of those FfH2/MNAI specific buttons in my version, enough that this new text gets pushed off the bottom of the page unless I reduce the spacing.)



    (It seems to me that it would make more sense for me to handle casting spells though the Missions rather than repurposing the cargo box like I did so long ago, but I can't seem to get that to work. Things work just fine the way I have it now, but just seems like it would be more intuitive the other way. I guess that is not much of your concern though. I'd also really like to be able to make spells show the python help strings that MNAI makes possible, but it doesn't seem to be possible for the python widget to pass on enough info to identify the specific unit as well as the specific spell. I'm assuming that is out of your control.)
     
  17. platyping

    platyping Sleeping Dragon

    Joined:
    Oct 22, 2010
    Messages:
    4,626
    Location:
    Emerald Dreams
    Because its status becomes "Mission". Until WB is closed, the game doesn't really proceed, which is why even if you order an ICBM to nuke, it will still remain there till WB is closed to nuke and die.

    The mission box is usually not filled for construct/join/spread, but it definitely is for Worker Builds. It is unlikely for Join/Spread to have many options, but Construct may have more for mods with many corporations. Anyway, when I looked at the screen to make space, the first thing that came to my mind was to chop the Cargo table, since it is seldom going to be modified.

    The activity status, belongs in the same category as Promotion Ready, Made Intercept etc. They all reflect the current status of the unit. As for the caps, I did wonder whether I should change it. Currently, it is a hard coded list based on the Activity Types since there is no gc.getActivityInfo function. I would prefer to use it to refer to some translated texts for the benefit of other languages.

    The gap between map and script data is not usable, because this gap is due to current screen resolution. The space there is for scaling of the map for various resolutions. The screenshot above is based on default resolution, 1024 x 768. In 1366 x 768, there is no gap.

    Python Widgets can hold 2 data, I have instances where I stored 3 datas instead ( Player ID, Unit ID and the Widget ID). iData1 = 8000 + Player ID, while iData2 = Unit ID, effectively storing 3 values in 2 data storage spaces. Unit ID can be very big, but iData1 can easily be used as 900,000 + Player ID * 1,000 + Spell ID since no mods have more than 100 players, Player ID * 1,000 won't interfere with the "9". If your mod has > 1,000 spells then add one more 0
     
  18. platyping

    platyping Sleeping Dragon

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

    Reveal Mode in CvPlatyBuilderScreen
    Adds "Blockage" as 4th View. Just to display which tiles are under "Blockage" for current team. There is nothing you can do here, since no functions exposed to python.

    @Magister
    You can try setting flagDirty to True to see if it can force the plot to update for dead blockading units.

    Edit:
    Re-uploaded for spelling error
     
  19. Xyth

    Xyth History Rewritten

    Joined:
    Jul 14, 2004
    Messages:
    4,054
    Location:
    Aotearoa
    Just updated to 4.17 and found an error in CvWBDesc.py:

    Code:
    Traceback (most recent call last):
    
      File "CvWBInterface", line 18, in writeDesc
    
      File "CvWBDesc", line 1882, in write
    
      File "CvWBDesc", line 284, in write
    
    UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 20: ordinal not in range(128)
    ERR: Python function writeDesc failed, module CvWBInterface
    Appears atop the Dawn of Man screen and caused by having a leader with an accented character in their name as one of the starting civs. Even if you use codes like "&# 225;"in the XML files. Only happens on the first game you launch after loading BTS, exiting to menu and launching subsequent games with the same leader(s) in play doesn't seem to trigger the problem.
     
  20. platyping

    platyping Sleeping Dragon

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

    Fix the above
    Only changes in CvWBDesc
     

Share This Page