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

Modmodding Q&A Thread

Discussion in 'Rhye's and Fall - Dawn of Civilization' started by Leoreth, Dec 14, 2013.

  1. Mouthwash

    Mouthwash Escaped Lunatic

    Joined:
    Sep 26, 2011
    Messages:
    8,884
    Location:
    Hiding
    AAAAHHHHHHHHHHHHHHHHH forget it my brain turned LoR into DoC because the letters are similarly typed. I will never ever live this down...
     
  2. trevor

    trevor Chieftain

    Joined:
    Dec 16, 2002
    Messages:
    228
    How would I go about lowering the propensity for the AI to build preserve forest? Or is moving it back to Ecology in BuildInfos going to cause problems?
     
  3. srpt

    srpt Deist

    Joined:
    May 10, 2010
    Messages:
    2,025
    Location:
    Toronto
    I'm trying to make UNITAI_ type for my slave unit. it's supposed to do 1 of 4 things:

    rush a building using the normal mechanic (mini-engineer)

    conduct a trade mission using the normal mechanic (mini-merchant)

    settle in a city (mini-super specialist)

    act as a worker

    I added UNITAI_SLAVE and slaveMove(), which is, for now, just a copy of workerMove(), but the slaves either sit in cities and do nothing or go exploring.

    any idea what might be missing?
     
  4. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,051
    Gender:
    Male
    Location:
    Leblanc
    I couldn't think of anything besides modifying the improvement AI directly.

    Are slaves declared as starting with UNITAI_SLAVE and is it a possible AI for them? Are you sure slaveMove() is actually called when UNITAI_SLAVE is active? Conversely, are you sure that UNITAI_SLAVE is actually active for the units you are using for testing?

    Might be obvious but worth a first check. I can dig into more code specific causes later.
     
  5. srpt

    srpt Deist

    Joined:
    May 10, 2010
    Messages:
    2,025
    Location:
    Toronto
    do you mean in CvUnitInfos.xml? it is their default unitai

    I don't know what is meant by the unit_ai "being active". the only changes I made were defining slaveMove(), adding it to the list under "switch (AI_getUnitAIType())" in CvUnitAI::AI_update()... which I just now realize is just a boolean so it's probably just asking asking whether or not to continue the action it's currently pursuing? I was using your unitai_statesman as a guide as to what needed to be added and only found those references. I guess I'm missing something.

    you can see in cheat mode the that the unit has the proper unitai
     
  6. AtlantaMarty

    AtlantaMarty No longer active

    Joined:
    Jul 9, 2013
    Messages:
    835
    Gender:
    Male
    Location:
    There's no reason for me to stay here
    If I wanted to make a mod that replaced the default RFCE terrain graphics with the ones from SoI, how could I do that?
     
  7. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,051
    Gender:
    Male
    Location:
    Leblanc
    Find where SoI stores its terrain art (terrains, features, resources), put it in your mod, look into the terrain art defines and correct the paths there accordingly.
     
  8. TheLastOne36

    TheLastOne36 Chieftain

    Joined:
    Jan 17, 2007
    Messages:
    14,045
  9. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,051
    Gender:
    Male
    Location:
    Leblanc
    I assume you added them add the end of the XML file? Because I'm pretty sure that's what determines the order in the menu.
     
  10. phrebucci

    phrebucci Chieftain

    Joined:
    Dec 2, 2013
    Messages:
    12
    Location:
    São Paulo, Brasil
    It's possible change the dynamic city name through the WB? Or only in the python and XML files?

    Thanks!
     
  11. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,051
    Gender:
    Male
    Location:
    Leblanc
    You can edit the name of the city in WB of course, but to change how city names are assigned or renamed you need to edit CityNameManager.py.
     
  12. merijn_v1

    merijn_v1 Black Belt

    Joined:
    Dec 29, 2008
    Messages:
    5,589
    Location:
    The city of the original vlaai
    Is there an function to get the 3 letter identifier for a civilization? It could be very useful in some situations.
     
  13. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,051
    Gender:
    Male
    Location:
    Leblanc
    You mean in Python? I don't think I have exported it yet.
     
  14. merijn_v1

    merijn_v1 Black Belt

    Joined:
    Dec 29, 2008
    Messages:
    5,589
    Location:
    The city of the original vlaai
    Yeah, in python. It seems I have to use the old way.
     
  15. merijn_v1

    merijn_v1 Black Belt

    Joined:
    Dec 29, 2008
    Messages:
    5,589
    Location:
    The city of the original vlaai
    Leoreth, do you have a preference for use of brackets in if-statements or for-loops? I'm currently running through plague.py and made several small code updates. In the process, I removed a lot of brackets, like below.

    Code:
    		if (iPreserveDefenders > 0):
    Into
    Code:
    		if iPreserveDefenders > 0:
    I see that you normally doesn't have the brackets. (I assume they are leftovers from Rhye) My concern is that it would make the comparison screen messy.

    If you prefer to keep the brackets, I can revert them.

    (I can also make split my updates in multiple commits. One containing the real updates. The other contains just the removal of the brackets)
     
  16. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,051
    Gender:
    Male
    Location:
    Leblanc
    No, not placing the brackets is more idiomatic in Python. Given his background in robotic engineering, I suspect Rhye's style is heavily influenced by C, where brackets around conditionals are mandatory. You often see him go for C-like constructs where Python offers a more elegant solution.
     
  17. mrrandomplayer

    mrrandomplayer Potentially back

    Joined:
    Aug 1, 2012
    Messages:
    3,307
    Location:
    A point in the time-space continuum
    In CvUnit, what index in the array is Combat 1? I'm working on a mod where one Vic's UP is having all the land units start with that promotion.

    Also, more general question, in mods that aren't offshoots of RFC, can you use getOwnerInline (I'm typing this on mobile, will clarify it once I get to my computer) to determine the identity of a civilization? Namely for unique powers. If not, is there any way besides maybe leader traits to do that in the DLL?
     
  18. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,051
    Gender:
    Male
    Location:
    Leblanc
    The ID associated with a promotion is its position in the XML file where it's defined, starting with 0.

    I suppose you're talking about getOwnerINLINE() in CvUnit? That method returns the player that owns the unit. You can get the civilization with GET_PLAYER(getOwnerINLINE()).getCivilizationType() from there (i.e. getCivilizationType() is a method of CvPlayer). In RFC that step is often skipped because in the scenarios, players are associated with set civilizations so you always know which player is which civs, but in general you can't assume that.
     
  19. mrrandomplayer

    mrrandomplayer Potentially back

    Joined:
    Aug 1, 2012
    Messages:
    3,307
    Location:
    A point in the time-space continuum
    That makes sense, thanks!

    Also, is there any way to do Russia's unique power in a mod derived from regular BTS? If so, where would you check? My first guess would be either in CvUnit and check if the unit is in Russian territory and its owner is at war with Russia, then decrement its health, or check the tile to see if hostile units are on it, then hurt them. Either way seems pretty inefficient. Also, would it be possible to port the civ 5 maya UP to civ 4? It's after they discover Theology (or whatever tech in this case), they get a great person of their choice every 394 years until all choices have been exhausted.
     
  20. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,051
    Gender:
    Male
    Location:
    Leblanc
    I think both units and plots have a doTurn() method where you can put all kinds of things that are checked every turn. I don't think it matters where you're doing it because it's such a simple check. But damage from features is probably done on a plot level so it might be a good idea to do it for a Russian UP type effect as well (and you can copy some code probably).

    For a Maya UP type thing, the main challenges are creating a dialog to choose the GP (including attaching effects i.e. spawning the right GP) and storing some information (the initial turn when the effect was triggered and which types of GP where already chosen). Everything for that can be best implemented in Python in my opinion.
     

Share This Page