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

RFC Modding Central

Discussion in 'Rhye's and Fall Modmods' started by Linkman226, Aug 29, 2011.

  1. srpt

    srpt Deist

    Joined:
    May 10, 2010
    Messages:
    2,025
    Location:
    Toronto
    is zero one of the numbers that can be returned by getSorenRandNum? ie does getSorenRandNum(3) produce a number between 1 and 3 or 0 and 3?
     
  2. AbsintheRed

    AbsintheRed Chieftain

    Joined:
    Jul 27, 2009
    Messages:
    8,212
    Location:
    Szeged, Hungary
    IIRC it's the floor of the outcome in a [0,x) interval
    So the outcome for getSorenRandNum(x) is between 0 and (x-1)
    It should be 0, 1, and 2 in this case
     
  3. srpt

    srpt Deist

    Joined:
    May 10, 2010
    Messages:
    2,025
    Location:
    Toronto
    thanks
     
  4. srpt

    srpt Deist

    Joined:
    May 10, 2010
    Messages:
    2,025
    Location:
    Toronto
    does anyone know what causes the "civ x has declared war on civ x" bug? it has appeared in my current project.

    the code is:

    Code:
    szBuffer = gDLL->getText("TXT_KEY_MISC_SOMEONE_DECLARED_WAR", GET_PLAYER((PlayerTypes)getID()).getCivilizationDescription(), GET_PLAYER((PlayerTypes)eTeam).getCivilizationDescription());
    which is from SoI, replacing the vanilla code which uses leader names. this gives me x has declared on x.

    I can use this:

    Code:
    szBuffer = gDLL->getText("TXT_KEY_MISC_SOMEONE_DECLARED_WAR", GET_PLAYER((PlayerTypes)getID()).getCivilizationShortDescription(), GET_PLAYER((PlayerTypes)eTeam).getCivilizationShortDescription());
    which is from DoC, and it works properly.

    the text key is:

    Code:
    %s1_PlyrName [NUM1:has:has:have:have] declared war on %s2_PlyrName!
    any insight appreciated. I remember that it also occurred in the last stable, pre-Kmod version of RFCE++
     
  5. embryodead

    embryodead Caliph

    Joined:
    Jan 1, 2003
    Messages:
    5,179
    Location:
    basement
    What's the actual bug here?
     
  6. srpt

    srpt Deist

    Joined:
    May 10, 2010
    Messages:
    2,025
    Location:
    Toronto
    the in-game announcement says that civ x has declared war on itself rather than on the civ it has actually declared war on. thats what I meant by "x has declared war on x".
     
  7. srpt

    srpt Deist

    Joined:
    May 10, 2010
    Messages:
    2,025
    Location:
    Toronto
    I want to fix a bug in RFCCW whereby capturing a stack of enemy workers when running the slavery civic only gives you 1 worker.

    the way it works now is that the workers capture tag is "NONE" and the creation of the slave unit is all python and starts from "onCombatResult". if you aren't running the slavery civic python creates a worker, filling in for the missing capture mechanic. so the python just sees the top worker in the stack losing combat with enemy unit and misses the other workers.

    so to fix this I could

    1. insert something into CvUnit::kill(bool bDelay, PlayerTypes ePlayer)

    like here maybe:

    Code:
    eCaptureUnitType = ((eCapturingPlayer != NO_PLAYER) ? getCaptureUnitType(GET_PLAYER(eCapturingPlayer).getCivilizationType()) : NO_UNIT);
    and say right after that:

    "if Civic = slavery and unit = worker then unit = slave" except I have no idea what the syntax would be and the unit types would have to be added to the DLL since they are not there now.

    or

    2. add an "onUnitCaptured" python method, which afaik doesn't exist in any mod.
     
  8. embryodead

    embryodead Caliph

    Joined:
    Jan 1, 2003
    Messages:
    5,179
    Location:
    basement
    1. Bring back <Capture>UNITCLASS_WORKER</Capture>

    2. In CvUnit:kill, after this:
    Code:
    	if ((eCapturingPlayer != NO_PLAYER) && (eCaptureUnitType != NO_UNIT) && !(GET_PLAYER(eCapturingPlayer).isBarbarian()))
    	{
    add this:

    Code:
    		if (eCaptureUnitType == UNIT_WORKER && GET_PLAYER(eCapturingPlayer).getCivics(2) == CIVIC_SLAVERY)
    		{
    			eCaptureUnitType = UNIT_SLAVE;
    		}
    UNIT_WORKER/SLAVE and CIVIC_SLAVERY should be defined as constants somewhere, of course. That should be all.
     
  9. srpt

    srpt Deist

    Joined:
    May 10, 2010
    Messages:
    2,025
    Location:
    Toronto
    thanks. in case anyone is referencing this, the syntax was slightly different:

    Code:
    		if (eCaptureUnitType == UNIT_WORKER && GET_PLAYER(eCapturingPlayer).getCivics((CivicOptionTypes)2) == CIVIC_SLAVERY)
    		{
    			eCaptureUnitType = ((UnitTypes)UNIT_SLAVE);
    		}
    and for the unit constants I just added them to the #defines at the beginning of CvRhyes.h
     
  10. srpt

    srpt Deist

    Joined:
    May 10, 2010
    Messages:
    2,025
    Location:
    Toronto
    I've added this:

    Code:
    			if ((GET_PLAYER(getOwnerINLINE()).getUnitClassCount(eUnitClass)) >= ((pCity->getNumBonuses((BonusTypes)GC.getUnitInfo(eUnit).getPrereqAndBonus())) * 9))
    			{
    				return false;
    			}
    to CvPlot::canTrain to limit some units to a number per resource eg 9 horsemen per horse.

    it seems to ignore the "*9" and just limit the unit to 1 per resource. I've moved the brackets around to no avail.
     
  11. AtlantaMarty

    AtlantaMarty Democracy Manifest: CivFanatics 1984

    Joined:
    Jul 9, 2013
    Messages:
    812
    Gender:
    Male
    Location:
    Atlanta, GA
  12. srpt

    srpt Deist

    Joined:
    May 10, 2010
    Messages:
    2,025
    Location:
    Toronto
    I'd like to be able to run the autoplay on normal speed and then switch to a slower speed once I spawn. I'm sure other RFC players would like this too. I can do it by opening WB, saving the game, text-editing the gamespeed in that file and reloading, but could it be done within the game?
     

Share This Page