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 v3

Discussion in 'Civ5 - Mod Components' started by ArbogLi, Oct 11, 2010.

  1. ArbogLi

    ArbogLi Chieftain

    Joined:
    Apr 25, 2010
    Messages:
    64
    Random events v7

    A new mod where which add random events to the game. You have a chance of 5% more or less to have one of this events per turn. For now you can find events are:

    - v1-2: get a free tile, population increase in one city or earn extra gold.
    - v3: only can see the event of your empire, can loose gold and natural disasters happens.
    - v4: can raze a forest, cities can get an extra amount of food and some minor bugs fixed.
    - v5: can earn or loose research point, a damaged unit can get free experience and a city can loose food and can find new resources deposits.
    - v6: a puppet or an occupied city can become yours, a city can be reduced to 1 population if the empire is really unhappy, can finish a production or loose all the production progress, can occur a tsunami (a lot of damage) and minor bugs fixed.
    - v7: can grow a forest somewhere in the map, text changes and bug with added resources solved.

    Known bugs

    When you conquer a city and this city (f.ex. from a city-state) has get one tile with the "free tile event", even if the civ is defeated it continue being the owner of this land. (I tryed to fix it but I missend, if someone could help me..., follow this link to read about the problem thread)



    Ideas for new random events are welcome (but not a hundred in one day, think that I'm human) or if you make a random event to add pass me and I will test an add.

    Is releases and you can find using the mod browser and searching for "Random events".

    Actual random event list:

    Spoiler :
    - Freet tile: the choosen city get a free tile.
    - Add cityzen: the choosen city grow by one.
    - Add gold: you the gold between 50-200.
    - Loose gold: you loose gold between 50-200.
    - Disaster: a disaster destroy improvements around the affected city.
    - Fire: a forest is lost near a city.
    - Extra food: a city increase the food reserves. Depending of the resource, it changes between 6 and 11 units.
    - Research increase: the current research receive extra science points.
    - Research decrease: the current research loose science points.
    - Free exp.: a damaged unit get free exp. points.
    - Plague: a plague destroy all the city food reserves.
    - New resources: a new resource is discovered inside your territory.
    - Exodus: if your empire is very unhappy the citizens of one city decide to leave it reducing the size to one.
    - Merge: if your happiness is over 10, a pupet and/or an occupied city will decide become part of your empire.
    - Production accident: the current production of one city is lost.
    - Production finished: the current production of the city is finished.
    - Tsunami: a big tsunami devast one coast city, killing a lot of citizens and destroying the current production.
    - Forest: A forest can appear somewhere in the map
     
  2. jooyo

    jooyo Warlord

    Joined:
    Jan 9, 2009
    Messages:
    240
    Location:
    Poland
    Downloading :D

    New events could be for example:
    research breakthrough - extra science points for current research
    culture breakthrough - extra culture points for next policy
    fire in forest - removes forest feature in culture borders
    resource found - adds extra resources in culture borders
     
  3. Valkrionn

    Valkrionn The Hamster King

    Joined:
    May 23, 2008
    Messages:
    14,450
    Location:
    Crestview FL
    If you don't mind, I'm going to take a look at this code later today when I have time... Maybe try to set it up in it's own Lua file (rather than overwriting the core file). ;)
     
  4. ArbogLi

    ArbogLi Chieftain

    Joined:
    Apr 25, 2010
    Messages:
    64
    Feel free with the mod files ;)
     
  5. MilkmanDan

    MilkmanDan Chieftain

    Joined:
    Dec 24, 2005
    Messages:
    54
    add some negative events too, disease (pop drop), flood/earthquake/tornado (building loss), improvement loss.

    was thinking great person but that might be overpowered, maybe addition to gp counter instead. unit advance, free promotion/xp. diplomatic events good and bad.
     
  6. hgthechinese

    hgthechinese Warlord

    Joined:
    Jul 2, 2007
    Messages:
    207
    No reason to reinvent the wheel...Civ4 ROM had ...err.....hundreds (or maybe thousands?) of events...

    Btw, would it be possible right now, before modders get DLL access, to have events that give players a choice rather than just "happen"? e.g., forest fire, 2 choices: lose the forest, or pay 20 gold and have the trees replaced.
     
  7. ArbogLi

    ArbogLi Chieftain

    Joined:
    Apr 25, 2010
    Messages:
    64
    Buy is a bit diferent: all the events can't be re-created in civ5 (and I don't know all the events that someone create) and the gameplay is different to the last civilization, for this reason asking for ideas.

    By the way... the v3 released! :)
     
  8. hgthechinese

    hgthechinese Warlord

    Joined:
    Jul 2, 2007
    Messages:
    207
    Definitely true. There were a lot of religion events, for example, and those would be obsolete in the current version of the game. However, just because we can just take over an old wheel doesn't mean we have to reinvent it...maybe look down the event list and pick 'n choose what you like/is possible?

    BTW, here is a link of nice long list of events....should keep ya busy for a while :D
     
  9. Valkrionn

    Valkrionn The Hamster King

    Joined:
    May 23, 2008
    Messages:
    14,450
    Location:
    Crestview FL
    Heh, you made a change that I myself made to the file, the "Only see your own events". :goodjob:
     
  10. ArbogLi

    ArbogLi Chieftain

    Joined:
    Apr 25, 2010
    Messages:
    64
    Thanks hgthechinese, I'll look the events!

    And by the way... there is not relligion... for now!! In units XML you can find:
    - <Column name="SpreadReligion" type="boolean" default="false"/>
    - <Column name="IsReligious" type="boolean" default="false"/>

    @Valkrionn, was my intention to do it from the begining but I had have some problems with the IsHuman function, now are solved and this change is running ^^
     
  11. Opera

    Opera Deity

    Joined:
    Sep 21, 2008
    Messages:
    4,643
    Gender:
    Female
    Most likely a left-over from Civ4.
     
  12. Edgecrusher

    Edgecrusher King

    Joined:
    Aug 7, 2006
    Messages:
    915
    Location:
    Massachusetts
    Those religion tags are also in the building.xml files
     
  13. ArbogLi

    ArbogLi Chieftain

    Joined:
    Apr 25, 2010
    Messages:
    64
    @Edgecrusher: yep. They don't hide what will be in the expansions.

    @Opera: it was a good idea and now we can't have the events, so we adapt a mod to the new game and enjoy it ^^

    By the way: v4 released.
     
  14. hgthechinese

    hgthechinese Warlord

    Joined:
    Jul 2, 2007
    Messages:
    207
    ArbogLi, is there a way to modify the odds for events to happen? In my current game I had 3 random events happen to me so far---bankrupt, bankrupt, and bankrupt. IDK if it is just my luck, or maybe because of my situation I'm extremely prone to bankruptcy or something, but it is kinda annoying that nothing but "you just lost this much money" happen to me randomly :(
     
  15. Horem

    Horem Emperor

    Joined:
    Apr 1, 2010
    Messages:
    1,720
    Location:
    Wales, UK
    Any chance you can add in comment aroudn what you changed in the NotificationPanel.lua please? It will make merging with other mods that use this file alot easier.
     
  16. ArbogLi

    ArbogLi Chieftain

    Joined:
    Apr 25, 2010
    Messages:
    64
    @hgthechinese: In the NewTurn.lua (you can open with a simple text editor) you can find (I use a if-else... don't know why but I'm unable to find a switch for LUA)

    Code:
    function RandomEvent()
    
    	--loop through players:
    	for cPlayer_num = 0, GameDefines.MAX_CIV_PLAYERS - 1 do
    
    		if (Map.Rand(1000, "Random generator, a chance of 5% to happens a random event") < 50) then
    
    			--LuaEvents.CustomNotification(5,5,"Entered players loop","Generic");
    			local pCurrentPlayer = Players[cPlayer_num];	--get next player
    
    			--Select one of the events
    			local random = math.random (7);
    			if (random == 1) then
    				addPlot(pCurrentPlayer)
    			elseif (random == 2) then
    				addCitizen(pCurrentPlayer)
    			elseif (random == 3) then
    				addGold(pCurrentPlayer)
    			elseif (random == 4) then
    				deductGold(pCurrentPlayer)
    			elseif (random == 5) then
    				disasters(pCurrentPlayer)
    			elseif (random == 6) then
    				Ffire(pCurrentPlayer)
    			elseif (random == 7) then
    				extraFood(pCurrentPlayer)
    			end
    			
    		end -- First IF ending
    	end -- Players loop end
    end -- RandomEvent()
    All is random (but you seem really unlucky), if you don't want the "Bankrupt" you must change:

    Code:
    elseif (random == 4) then
    	deductGold(pCurrentPlayer)
    for:

    Code:
    elseif (random == 4) then
    	--deductGold(pCurrentPlayer)
    The if the number 4 appears, nothing will happen (in this case, no money loose).

    @Horem, if I'm not wrong in NotificationPanel.lua the changes are limited by "-- Mod" and "-- /Mod" in the source.
     
  17. Horem

    Horem Emperor

    Joined:
    Apr 1, 2010
    Messages:
    1,720
    Location:
    Wales, UK
    I did see that, did u happen to make the same changes as this mod?

    From what I can see the changes look identical, going to go with it, and see.
     
  18. ArbogLi

    ArbogLi Chieftain

    Joined:
    Apr 25, 2010
    Messages:
    64
    Yep, you are right. As template used the Emigration mod... I think I didn't make any changes to the notifications in this Lua. In my opinion really useful.
     
  19. Baleur

    Baleur Prince

    Joined:
    Jul 9, 2010
    Messages:
    526
    Location:
    Qingdao, China
    Left-over? Wasnt Civ5 completely redone from scratch? (hence no old civ4 files)
    I smell a "Beyond God" expansion early spring 2011. :lol:
     
  20. Valkrionn

    Valkrionn The Hamster King

    Joined:
    May 23, 2008
    Messages:
    14,450
    Location:
    Crestview FL
    Eh. Yes and no. Was a long process; The earliest versions actually had square plots with every other row shifted slightly to approximate a hex setup. :lol:
     

Share This Page