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

Random Events

Discussion in 'Civ4 - Star Trek Mod' started by TC01, Aug 3, 2009.

  1. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    One of the things deanej said he was working on for 3.0 was random events. I was also working on some random events for a modmod, and when I asked for help on one of them in the main C&C forum, he said that if I could get them working it would be something he didn't have to do.

    Currently I've sucessfully coded four, am working on two more.

    Coded Events: (completed events that work)

    Spoiler :
    Ion Storm:

    An ion storm has decimated an extraction facility near the colony of %s2_city.

    1. Pay to have the facility rebuilt. (-20 Gold)
    2. We cannot spare any resources to deal with this. (The Extraction facility is lost)

    Tantalus Prison Colony: (Requires a jail in a city to trigger, will only trigger once per player)

    Reports have emerged that the director of the Tantalus Penal Colony in the solar system of %s2_city, Dr. Tristan Adams, has been conducting illegal and unethical experiments on prisoners and staff using a dangerous "neural neutralizer".

    1. Arrest Dr. Adams, destroy the neural neutralizer, and renovate the prison into a medical clinic for treating the injuries of Adams' victims. (-100 Gold, +2 Health in Jail, +1 Happy in all Cities)
    2. Arrest Dr. Adams, but study the valuable pyschological and neurological data he collected in his experiments using the neutralizer. (-50 Gold, -(something) to the tech being researched)
    3. Appoint Dr. Adams to the head of our Prison System. Use his techniques in all prisons to increase scientific research and make our prison system something to be afraid of! (+1 Research, +1 Commerce in Jail, -1 Health and Happiness in all cities)

    Babel Conference: (Cannot trigger before Turn 50, only triggers once per player)

    (If it's the Ent Era)
    Local empires have agreed to come together at the Babel diplomatic facility, in neutral space for a conference. We have received an invitation from one of those empires, the %s1_civ.

    (If it's any other era)
    Major galactic empires have agreed to come together at the Babel diplomatic facility, in neutral space, for a conference. We have received an invitation from one of those empires, the %s1_civ.

    1. Accept their invitation. (+1 with %s1_civ)
    2. Accept their invitation and escort their ambassador to Babel on our flagship. (+2 with %s1_civ)
    3. I don't have time for conferences. Refuse their invitation.

    Radiation Dissipation: Requires a plot with a radiation cloud

    Radiation clouds near the system of %s2_city have dissipated. They will no longer damage ships or impede travel through the area.

    1. This is excellent news (Radiation Cloud is removed)


    Uncoded Events: (events I have not coded but were suggested).

    Spoiler :
    Replicators: Requires a nutrition facility in the city, Replicators tech

    Researchers working in the solar system of %s2_city have developed a new food replicator that tastes better, can replicate a wider variety of foods, and is more energy efficient.

    1. Use the technology to increase local food production. (Nutrition Facility: +1 Food)
    2. Sell the technology to other empires. (Anywhere from 50 to 150 gold is gained by you)

    Xindi Attack: 2 civs, who don't have contact yet, and both are in ENT, TOS or movies era.

    A timetraveling race from the 26th century tells you the people of civ B, a faraway empire, will destroy your homeworld during their century! They have offered to give us a weapon that can destroy their homeworld in a single strike!

    1. We should be grateful that such a wise people has warned us! Ask for their help in constructing a doomsday weapon, and deploy a smaller test version of the weapon against their homeworld! (causes war between civs A and B, -3 diplopenalty between civs A and B, lowers the population in civ B's capitol by 1, civ A recieves a Subspace Weapon)
    2. Thank them for their warning, but tell them we'll deal with it on our own. (Contact between civs A and B, -2 diplopenalty from civ A to civ B)
    3. Why should we trust some people who claim they are from the future? (nothing happens)

    Visit from Q: Requires a unit, TNG era

    An unknown individual known as "Q" has arrived on our ship and claims to be "testing" the crew. He has acted arrogantly and mysteriously, but he may have some motive unknown to the ship's crew.

    1. Throw him off the ship! (The unit is destroyed)
    2. Try to pass his test without getting the ship destroyed. (Unit requires Level 5, gains XP).

    V'Ger Attack:

    A massive alien cloud is on a course for our homeworld! It has annihilated fleet sent by other races to stop it, and our forces are spread too thin. We are only able to dispatch one ship, our flagship. What should we have them do?

    1. Try to communicate with the cloud. (Requires x_tech, +random amount of research)
    2. Order the ship to destroy the cloud if possible. (your homeworld is destroyed).

    Cetacean Probe Attack:

    Sensors have detected a cylindrical shaped ship on course for one of our colonies. It has been shutting down all electronics it comes near. Our researchers have theorized it is trying to communicate with a long-extinct species of cetacean. What should we do?

    1. Send a ship back in time to retrieve the cetaceans. (-100 gold, requires x_tech)
    2. There is nothing we can do (your colony is destroyed).

    Supernova 1: Requires an uninhabited solar system

    Our scouts have detected a supernova in a solar system near our colony of %s2_city!

    1. There is nothing we can do (the solar system is destroyed)

    Supernova 2: Requires a city

    Signs indicate that the solar system of %s2_city is going to go supernova and wipe out our colonies there!

    1. Evacuate as many people as possible. (-50 gold).
    2. There is nothing we can do. (-1 anger in all cities).



    Credits:

    -TC01
    -apenpaap
    -God-Emperor
    -Kapkao
    -GeorgiaBoy

    This thread is partly for ideas, partly for requests, and partly a modmod (I haven't gotten it ready though, sorry). If you have an idea for a random event, post it here. If you have an idea about the ones I put above, post it here... I think you get the idea?
     
  2. apenpaap

    apenpaap Tsar of all the Internets

    Joined:
    Apr 7, 2008
    Messages:
    1,468
    Location:
    Amsterdam
    Xindi (or whatever species gets the event) Attack:
    Requires: 2 civs, who don't have contact yet, and both are in ENT, TOS or movies era.

    Civ A gets:
    A timetraveling race from the 26th century tells you the people of civ B, a faraway empire, will destroy your homeworld during their century! They have offered to give us a weapon that can destroy their homeworld in a single strike!
    options:
    -We should be grateful that such a wise people has warned us! Ask for their help in constructing a doomsday weapon, and deploy a smaller test version of the weapon against their homeworld! (causes war between civs A and B, -3 diplopenalty between civs A and B, lowers the population in civ B's capitol by 1, civ A recieves a Subspace Weapon)
    -Thank them for their warning, but tell them we'll deal with it on our own. (Contact between civs A and B, -2 diplopenalty from civ A to civ B)
    -Why should we trust some people who claim they are from the future? (nothing happens)
     
  3. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    Sounds good!

    Unfortunately I'm having more problems with the random event engine. I added the event trigger but it isn't triggering.

    There must be some condition that has not yet been met, since I used the CyPlayer.trigger() function via both python console and scripted in the Event Manager to trigger the event. But I don't know what that might be...

    Here's the python code I wrote for the canTrigger:

    Code:
    def canTriggerXindiAttack(argsList):
    	kTriggeredData = argsList[0]
    	pPlayer = gc.getPlayer(kTriggeredData.ePlayer)
    	eOtherPlayer = kTriggeredData.eOtherPlayer
    	pOtherPlayer = gc.getPlayer(eOtherPlayer)
    	if not (pPlayer.getCurrentEra() == gc.getInfoTypeForString('ERA_ENT') or pPlayer.getCurrentEra() == gc.getInfoTypeForString('ERA_TOS') or pPlayer.getCurrentEra() == gc.getInfoTypeForString('ERA_MOVIES')):
    		return false
    	if not (pOtherPlayer.getCurrentEra() == gc.getInfoTypeForString('ERA_ENT') or pOtherPlayer.getCurrentEra() == gc.getInfoTypeForString('ERA_TOS') or pOtherPlayer.getCurrentEra() == gc.getInfoTypeForString('ERA_MOVIES')):
    		return false
    	if pPlayer.canContact(eOtherPlayer):
    		return false
    	return true
     
  4. God-Emperor

    God-Emperor Chieftain

    Joined:
    Jul 18, 2009
    Messages:
    3,551
    Location:
    Texas
    I have to wonder what, exactly, the CvPlayer.canContact function actually does.

    If you have the ability to build a starship, then you should have the ability to contact them, shouldn't you?

    Perhaps a better example would be in the regular game. You are on continent 1 and player X is on continent 2. The two continents are separated by several ocean tiles - you can't even see the other one with fully expanded borders in a city located at the clostest point, so you can't go there via galley. Before either of you research Astronomy, does canContact return false?
    On the turn you complete researching Astronomy, the first player in the game to get it, what does it return? I would expect it to return true. You can now contact them. Doesnt' mean you have, but you can.

    That is my guess as to what that function does. (Tells you if it is currently possibly for you to contact them, not if you actually have.)

    If I am right, then it will presumably return true for all civilizations in your mod who have the tech to build starships. Perhaps what you want is the CvTeam.isHasMet function, which ought to tell you if you (or anyone on your team) has actually met the other player (I hope - still just guessing).

    The API reference on the modiki really could use a bit of explanation as to what the functions actually do, to avoid all this guessing. A few of them have a very short explanation, but it really is only a few.
     
  5. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    You see, this player versus team confusion comes from the fact that I don't play much multiplayer.

    CvTeam.isHasMet is the function I was looking for, but I didn't look under CyTeam and looked instead under CyPlayer.

    I'll add it in and try it out. Thanks!
     
  6. kapkao

    kapkao Chieftain

    Joined:
    Mar 26, 2009
    Messages:
    1
    How about an attack of REAL Borg? Not a colony under lore, hugh, etc... but the queen? And remove the queen from the list of leaders? Attacks from various probes, V'ger, cetacean probe, etc.

    Visit from Q (tests a ship's crew, if high enough level, survive, receive promotion).
     
  7. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    There seem to be problems with Final Frontier and the event engine... some events just aren't triggering no matter what I do, and deanej had his own trouble when trying to implement them. Hopefully, we can get enough events working anyway or figure out what exactly is Final Frontier's problem (obvious answer: SOLAR SYSTEMS) and fix it.

    Adding units via the event system seemed to cause problems for deanej when he tried it, but I'll try adding something like this.

    The Visit from Q event should work.

    I'm also going to add some "terrain changing" events, like:

    -Star Formation (from Nebula)
    -Radiation Cloud Dispersal
    -Star Goes Supernova
    -Star Collapses Into Black Hole

    -Amounts of x resource found in Asteroid Field
    -x Resource in Asteroid Field has been depleted
    -Starbase bombardment has pulverized an asteroid field
    -A Subspace Weapon has detonated accidentally! (Spread Radiation)

    IF I can get them to work.
     
  8. deanej

    deanej Chieftain

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    The unit stuff was based off of the barbarian events, but it works fine for the non-random events used in scenarios. For the solar system stuff it will be more complex; see the Millennium scenario for how to remove systems. I'd add a check for the supernova/black hole events to not trigger on humans with only one city. It's probably possible to check the start type (despite JJ Abrams, yellow stars aren't supposed to randomly blow up). I don't know if random events can occur for no player or not.
     
  9. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    Right, I came across both the post where God-Emperor figured out how to make that work and the post where you explained how it wasn't working (a year or so earlier in Solver's Event Guide).

    Out of curiousity, I saw there that one event "wasn't triggering". This is precisely the same problem I've had with a few of mine. What kind of stuff was the event doing? I'm trying to figure out what could be causing the problem.
     
  10. deanej

    deanej Chieftain

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    I don't even remember. If anyone has an old copy of beta 3 (or was it beta 2?) there might be a list of events there.
     
  11. GeorgiaBoy

    GeorgiaBoy Chieftain

    Joined:
    Jul 6, 2009
    Messages:
    27
    If you can get the Borg event to work, maybe you could get the Borg to attack the leading human/computer player first.

    If the Borg event can work, my vote is to remove the Borg as a playable civ.

    Also, after the Borg come in, Species 8472?

    GB
     
  12. deanej

    deanej Chieftain

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    I'm bumping this back up as random events are a part of 4.0.

    TC01, do you by any chance still have those events coded?
     
  13. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    As it happens, I do. Attached are the four events I was able to get working.

    Good luck trying to get them to work.
     

    Attached Files:

  14. deanej

    deanej Chieftain

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    I got a python exception, I assume from here:
    Traceback (most recent call last):

    File "<string>", line 1, in ?

    File "<string>", line 52, in load_module

    File "CvRandomEventInterface", line 20, in ?

    TypeError: 'module' object is not callable

    Line 20 is FinalFrontier = CvFinalFrontierEvents()
     
  15. God-Emperor

    God-Emperor Chieftain

    Joined:
    Jul 18, 2009
    Messages:
    3,551
    Location:
    Texas
    I didn't look at the file, but from what you posted the contents of line 20 look like they should actually be "FinalFrontier = CvEventInterface.getEventManager()". That would allow access to the stuff in CvFinalFrontierEvents via things like "FinalFrontier.getSystemAt(iX,iY)"
     
  16. deanej

    deanej Chieftain

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    There's a similar reference to CvSolarSystem right below it. Here's the entire top of the file (minus the comments):
    Code:
    import CvUtil
    from CvPythonExtensions import *
    
    import CvSolarSystem
    import CvFinalFrontierEvents
    
    gc = CyGlobalContext()
    localText = CyTranslator()
    FinalFrontier = CvFinalFrontierEvents()
    CvSystem = CvSystem()
     
  17. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    God-Emperor is correct; my code is wrong (that's from a long time ago...)

    It should be something like this, although the order of the import statements is irrelevant.

    Code:
    from CvPythonExtensions import *
    from CvSolarSystem import *
    import CvUtil
    import CvEventInterface
    
    FinalFrontier = CvEventInterface.getEventManager()
    
    gc = CyGlobalContext()
    localText = CyTranslator()
     
  18. Admiral_Rockso

    Admiral_Rockso Chieftain

    Joined:
    Oct 30, 2010
    Messages:
    13
    Will there be random events built into 4.0?
     
  19. deanej

    deanej Chieftain

    Joined:
    Apr 8, 2006
    Messages:
    4,859
    Location:
    New York State
    The epic game and The Galaxy scenario will both have random events in 4.0. It includes the competed ones here and selected ones from the base BtS events.
     
  20. Admiral_Rockso

    Admiral_Rockso Chieftain

    Joined:
    Oct 30, 2010
    Messages:
    13
    That is great news. I simply cannot wait to play it. And is there any way to make the opening of Wormholes a random event. I think that having a wormhole just pop up and appear somewhere would be a lot of fun.
     

Share This Page