1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. Photobucket has changed its policy concerning hotlinking images and now requires an account with a $399.00 annual fee to allow hotlink. More information is available at: this link.
    Dismiss Notice
  3. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  4. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  5. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  6. Dismiss Notice
  7. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

Random events in FFP

Discussion in 'Civ4 - Final Frontier Plus' started by PsiCorps, Feb 17, 2015.

  1. PsiCorps

    PsiCorps FF: Babylon 5 mod team

    Joined:
    Dec 30, 2007
    Messages:
    1,415
    Location:
    Britain
    Hi all
    I've been busy with the B5 Mod and have managed to get a few more events (some from C2C) added to the ones you had in.

    So far I've successfully added in the following:-

    • Ion Storm event - destroys trade routes.
    • Abundant World - Food bounty to help growth.
    • Famine - Opposite of above.
    • Faux Pas - Same as standard Civ event.
    • The Huns - Same as standard event.

    I've also added in variations of the following events but have yet to see them fire off.

    • Tsunami - Modified to be a Meteor Strike (may need some Python Modification to make it work)
    • Mining Accident - Same as standard event.
    • Influenza - Similar to standard event.
    • Best Defense - Same as standard event.

    These are where I have run into a problem.

    • The Huns - Same as standard event.
    • The Vandals - Same as standard event.
    • The Goths - Same as standard event.
    • The Philistines - Same as standard event.
    • The Vedic Aryans - Same as standard event.

    The event appears to fire and I have experienced one assault courtesy of the Huns variation but python keeps throwing out the following messages, which I am assuming means there is some C++ reference for the event.
    Line 142 in Buffy is:-

    Code:
    if (loopCity.canTrain(iCounterUnit, false, false, false, false)):
    Which is part of this whole section in Buffy:-

    Code:
    # BUG - 3.17 - Start
    	if (GameUtil.isVersion(317)):
    		# rest indented but unchanged
    		# Can we build the counter unit?		
    		iCounterUnitClass = gc.getInfoTypeForString('UNITCLASS_CRUISER_II')
    		iCounterUnit = gc.getCivilizationInfo(player.getCivilizationType()).getCivilizationUnits(iCounterUnitClass)
    		if iCounterUnit == -1:
    			return false
    
    		(loopCity, iter) = player.firstCity(false)
    		bFound = false
    		while(loopCity):
    			if (loopCity.canTrain(iCounterUnit, false, false, false, false)):
    				bFound = true
    				break
    
    			(loopCity, iter) = player.nextCity(iter, false)
    
    		if not bFound:
    			return false
    # BUG - 3.17 - End
    If this does require C++ coding then I'll have to remove the event as I have no C++ skill at all. If it's possible to resolve the issue without messing with C++ then I'm hoping someone that reads the FFP posts will be able to point me in the right direction or tell me what needs to be changed in order to get it to work.

    Any help is greatly appreciated.
     
  2. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    So, the error means what it says: you're calling canTrain with the wrong set of arguments. Taking a look at CyCity.cpp (which is the Python bindings in the DLL), it looks like the function should be defined as:

    Code:
    bool CyCity::canTrain( int /*UnitTypes*/ eUnit, bool bContinue, bool bTestVisible )
    {
        return m_pCity ? m_pCity->canTrain((UnitTypes)eUnit, bContinue, bTestVisible) : false;
    }
    
    
    Taking a look at the copy of Buffy.py in civ4ffplus trunk, it seems they have it correct:

    Code:
            while(loopCity):
                if (loopCity.canTrain(iCounterUnit, false, false)):
                    bFound = true
                    break
    
    I'm not sure how you got the two extra "false, false" arguments, but remove them and it should all work.

    I should also note that the second error message (over in your "Deleted" thread, where the screenshots are still posted) looks like it's complaining about the same thing on line 387 in CvRandomEventInterface.py.
     
  3. PsiCorps

    PsiCorps FF: Babylon 5 mod team

    Joined:
    Dec 30, 2007
    Messages:
    1,415
    Location:
    Britain
    Thanks TC01, I'll amend and test.
     
  4. PsiCorps

    PsiCorps FF: Babylon 5 mod team

    Joined:
    Dec 30, 2007
    Messages:
    1,415
    Location:
    Britain
    Good news for events. There have been no error messages and I've finally seen another event triggered - influenza variant event struck...I now know what I need to do to make it more effective.

    Thanks again TC01.
     
  5. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    Not a problem!

    Adding more random events was always on the to-do list... how would you feel about having the events you got working added to FF+ upstream as well?

    There have been one or two bugfixes that could stand to go into a small 1.84 patch along with new random events.
     
  6. PsiCorps

    PsiCorps FF: Babylon 5 mod team

    Joined:
    Dec 30, 2007
    Messages:
    1,415
    Location:
    Britain
    More than happy to have them added to FF+, you may need to amend the text so they fit better with FF+. You will need to change any prereq techs and triggers to use the FF+ techs instead of the B5 techs, there's probably some other stuff that would need to be amended in Python so it looks for the right techs/ship types.
     
  7. Imp. Knoedel

    Imp. Knoedel Imperator Knoedel the Great, Glorious and Gracious

    Joined:
    Nov 11, 2011
    Messages:
    7,719
    Location:
    Bergdeutschland
    Sorry for the necro, but I just had an idea for a random event should you ever get around to implementing them in FFP: How about when one of your ships is about to be destroyed by a black hole you have the chance to get a one time research bonus to the tech you are currently researching? Basically the data you can gather from your doomed crew before they are silenced forever (or rather screaming in slow motion) widened your understanding of the universe, physics etc. or something.
     

Share This Page