Page 3 of 5 FirstFirst 12345 LastLast
Results 41 to 60 of 93

Thread: Creating a World - Disasters and the add_events command

  1. #41
    Jadli's Avatar The Fallen God
    Gaming Emeritus

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    8,528

    Default Re: Creating a World - Disasters and the add_events command

    The OP says the floods are bugged, as the halfed mp and inability to build forts/watchtowers remains permanent, though that is not entirely true.

    It is possible to unbug it. There is a "working" example from Westeros Total War (they use it for Moat Cailin region)

    Code:
    event        flood
    frequency    1
    winter        false
    summer        false
    ;warning        false
    position 74, 204
    position 64, 202
    position 61, 195
    position 73, 191
    position 70, 194
    position 81, 141
    climate        swamp
    ;climate        unused1
    min_scale    2
    max_scale    5
    Im not sure if they knew about the bug or not... its possible they knew, but they didnt mind if it happened, as Moat Cailin is supposed to very inhospitable.

    Anyway, as this flood disaster is very frequent (the mod has like 2 or 4 TPY, so it happens quite often), after a few turns it is going to happen at the same position again (each time the disaster happens, one of the positions is apparently randomly picked... though they are all in the same region, so seemingly not much changes, except the position of the visual flood, if you can see it).

    And when it happens again at the same position, it gets unbugged! After the second flood at the same position the movement points are restored, and you can build forts/watchowers again, I tested this .

    So I think the OP should change, as you can use floods just fine, but you always have to add a second flood shortly after (unless you want a specific region to be "inhospitable") at the same position. Of course, this happens only to the affected region.

    (A funny side note, how I came to testing this... in a hotseat we struggled with endless "storm" in WTW.. suddenly all ships lost half their mp, and it lasted for many turns... However, as the storms are disabled in WTW, I eventually found out it must be actually caused by a bugged flood... and indeed, the last position in the sample script I show above is supposed to be in a swamp, but its actually in a sea river, therefore in sea region. And hence the same bug applies, but only to the sea region this time... and it gets unbugged the moment the flood happens in the same sea location again)
    Last edited by Jadli; April 06, 2022 at 06:25 AM.

  2. #42

    Default Re: Creating a World - Disasters and the add_events command

    Good find Jadli. I tested and confirmed - the second flood at the same coordinates sends a message, causes fatalities, can kill characters, and clears the memory of the previous flood which restores move points and allows the construction of watchtowers/forts in the region. The scale doesn't change the memory clearing so you can use scale 0 for the second flood to reduce (or eliminate) fatalities although I think the probability of killing characters remains the same (I've only done a few tests so can't say for sure if this probability is based on scale or not). If you set the scale to 0 or 1 for a flood, you get this weird-looking vertical water column on the strat map, must be a bug in the algorithm for the flood visuals which correlate model size to event scale.

  3. #43
    Jadli's Avatar The Fallen God
    Gaming Emeritus

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    8,528

    Default Re: Creating a World - Disasters and the add_events command

    how did you get the message to show up?

    I added "warning true" but it still didnt show up...

  4. #44

    Default Re: Creating a World - Disasters and the add_events command

    I actually have commented out my entire descr_disasters files (both the one in data and the one in data/world/maps/base), so it must be using the vanilla settings. All I did in CS was:

    Code:
    add_events
       event flood
       date 0
       position <x>, <y>
       scale 0

  5. #45
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,123
    Blog Entries
    35

    Default Re: Creating a World - Disasters and the add_events command

    Was it the flood message (disaster_flood) or the fatalities (character_dies_disaster, family_report) message?










  6. #46

    Default Re: Creating a World - Disasters and the add_events command

    It's the disaster_flood message, you only get the character_dies_disaster message if a character dies.

  7. #47
    leo.civil.uefs's Avatar É nóis que vôa bruxão!
    Join Date
    Sep 2010
    Location
    Brazil
    Posts
    3,135

    Default Re: Creating a World - Disasters and the add_events command

    Quote Originally Posted by bitterhowl View Post
    Here's an example of Fire event used in combination with scripted damage to settlement.

    It requires settlement coordinates and a monitor for each settlement. You may set damage level by yourself - only core_building, or additional buildings, or population decrease.

    In my example event fires when Naffatun unit is inside settlement.

    can you please show us the script? Im curious to know how you did the building damage.

  8. #48
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,123
    Blog Entries
    35

    Default Re: Creating a World - Disasters and the add_events command

    It's a script: console_command set_building_health [settlement_name] [tree_name] [remaining percentage]










  9. #49

    Icon5 Re: Creating a World - Disasters and the add_events command

    Hey,

    I've been using this thread to help me script some disasters, and I finally got the volcano to work near Naples. Here is the script I used:

    monitor_event FactionTurnStart FactionIsLocal
    reveal_tile 157, 82
    add_events
    event volcano
    date 2
    position 157, 82
    region Naples_Province
    scale 5
    end_add_events
    hide_all_revealed_tiles
    end_monitor


    Because I use half turns so that each year has a summer and a winter, it appears that the number 2 for "date" stands for years since the disaster started on turn 5. It was spectacular! However, it just keeps going. Each turn it appears again and will soon reduce the population of Naples to zero, along with the soldiers and maybe my faction heir.

    Why is the volcano erupting every turn and why does it not damage buildings? Does anyone know why or know how to fix my script?

    Thanks for any help you can give me!

  10. #50
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,123
    Blog Entries
    35

    Default Re: Creating a World - Disasters and the add_events command

    date: that's beginning of the year, eg the turn from winter to summer. And counting starts with zero for the start of the game.
    no end: not sure as you use a date restriction, but I would suggest to terminate your monitor.
    damage: that is connected to 'scale' - try a larger value










  11. #51

    Default Re: Creating a World - Disasters and the add_events command

    Quote Originally Posted by Gigantus View Post
    date: that's beginning of the year, eg the turn from winter to summer. And counting starts with zero for the start of the game.
    no end: not sure as you use a date restriction, but I would suggest to terminate your monitor.
    damage: that is connected to 'scale' - try a larger value
    Hey! Thanks so much for responding!

    I realize I missed some things, like the console command function to create damage, which I am trying to script now using stuff from Alpaca's Tutorial. However, just to see if scale also meant years, I tried to play it out to turn 16, but the game crashed and I think it was because every man, woman, and child in Naples was killed long before that turn.

    Thanks for the terminate_monitor suggestion. I will try that immediately right now and see if that works.

  12. #52

    Default Re: Creating a World - Disasters and the add_events command

    Quote Originally Posted by Gigantus View Post
    date: that's beginning of the year, eg the turn from winter to summer. And counting starts with zero for the start of the game.
    no end: not sure as you use a date restriction, but I would suggest to terminate your monitor.
    damage: that is connected to 'scale' - try a larger value
    It worked!!!!


    Perfectly! Now I can add the console command to do some damage to some buildings in Naples and also lower they scale of the disaster (too many people lost at start of game). I also want it to be something that is random because the random disasters don't really work in this game except in vanilla.

    Does "terminate_monitor" mean that it cannot happen again? Can I add some additional date ranges to cover the course of the game? And how would that look? Here is my set-up right now:

    monitor_event FactionTurnStart FactionIsLocal
    reveal_tile 157, 82
    add_events
    event volcano
    date 2
    position 157, 82
    region Naples_Province
    scale 8
    end_add_events
    hide_all_revealed_tiles
    terminate_monitor
    end_monitor

    Thanks so much for your help with this problem! Alpaca did not mention "terminate_monitor" and I'm not a computer programmer, so this was new to me.

  13. #53

    Default Re: Creating a World - Disasters and the add_events command

    Just so you know, here are some things I learned from playing around with the two volcanoes on the map:

    1) It takes a level 5 event or higher for the volcano to smoke or erupt. Below that it just does nothing. You also get no message.

    2) A level 9 event will wipe out anyone or anything near the volcano, including an entire FLEET of ships! Just... gone.

    3) The disaster does not affect happiness among the population, which means you can raise taxes and make even more money than before on less people.

    4) Unless it is an historic event, no other faction will receive a message about the eruption.


    I'm still learning things about the volcanos, and I am wondering if I can place them on different parts of the map to create a chain of active volcanos. Is there a template for the volcano or does it have to be drawn from hand? I can't draw well on a computer, so I am hoping there is a template that can just be placed over a mountain hex using Geomod map maker.

    I also could not get the console command to work for destroying or damaging buildings inside the settlement, even though I followed the template given above by another poster. Don't know what the problem is yet. Hope to move onto storms next. Can't just rip Sicily apart only.
    Last edited by Nordlaender; October 14, 2023 at 02:46 PM. Reason: Grammatical

  14. #54

    Default Re: Creating a World - Disasters and the add_events command

    Well, I got "storm" to work on my first try. Here is a photo of it:

    Click image for larger version. 

Name:	Storm.jpg 
Views:	4 
Size:	455.2 KB 
ID:	369556


    Here is the code I used:

    monitor_event FactionTurnStart FactionIsLocal
    reveal_tile 150, 70
    add_events
    event storm
    date 1
    position 150, 70
    region the sea
    scale 5
    end_add_events
    hide_all_revealed_tiles
    terminate_monitor
    end_monitor

    I set the coordinates for Palermo, and I sailed my fleet to the port area before the storm, but only an army standing offshore was affected by the storm. This is way different from the Vanilla version where sailors are usually killed. I did not lose a single sailor or admiral, but a character (general) was killed and 40 men from each unit in his army were killed as well. No one died in Palermo. Very strange.

    I don't know if this information helps or not. I will experiment some more with it.

  15. #55

    Default Re: Creating a World - Disasters and the add_events command

    Well, it appears the storm will only function if a general character is standing near the shore. Admirals, sailors, townspeople, and other characters do not seem to be affected. The general character may or may not be killed, but he will lose 40 percent of his army if the storm is a level 5 one.

    Click image for larger version. 

Name:	Genoa Storm.jpg 
Views:	2 
Size:	556.7 KB 
ID:	369557

    This might be difficult to script and may not even work as a chance happening unless it can be triggered when a general stops near the shore during a time period when the storm might happen. Hmmm... need to test that.

  16. #56

    Default Re: Creating a World - Disasters and the add_events command

    Well, this time I did a date range from 1 to 4, but on turn one, I moved my general away from the shore and he was not there for the first chance (turn 3), then I moved him to the shore, but after that, the storm never occurred. All other characters were just standing there the whole time.

    Next game I left the general there the whole time of the date range and the storm occurred on turn 7. It killed the general character and a merchant and actually killed citizens in Genoa. Click image for larger version. 

Name:	Genoa Storm 2.jpg 
Views:	1 
Size:	477.5 KB 
ID:	369558

    I'm thinking the storm strikes only once on a chance date and if there is no general character standing near the shore, then nothing happens and there is no further chance of a storm unless a new, separate monitor is created for that area. Unless I'm missing something, that's not good.

  17. #57

    Default Re: Creating a World - Disasters and the add_events command

    Well, I finally got the console_command to work. Because it is a console_command, you must use quotes around the city name. Most people probably knew that. I forgot.

    Also, soldiers killed includes sailors, as I lost an admiral and many sailors, but not the whole the fleet (only level 6 eruption). A spy and princess also died nearby.


    Click image for larger version. 

Name:	Naples Volcano.jpg 
Views:	3 
Size:	518.1 KB 
ID:	369560

    There is so much good information in this thread that I am still slowly working my way through. I'm glad people posted this stuff.

  18. #58

    Default Re: Creating a World - Disasters and the add_events command

    "I've been testing some of the disaster events using a shortcut script to add the event repeatedly (there doesn't seem to be any limit on the number of disasters you can create in a turn). The volcano effects appears to have two modes depending on scale factor. For scale 1-4, there is no message (if you supply no custom), low casualties within a small radius of ~2 tiles. For scale 5-9, there is a generic message, high casualties, and a larger radius of ~6 tiles. From what I can tell, the actual value of the scale factor within those ranges doesn't matter, all the matters is which range it's in. Settlements can suffer civilian casualties if the settlement is within the radius. Buildings aren't damaged. Characters within the radius have a pretty high chance of dying that appears to depend somewhat on the scale but is pretty high even at low scales. At scale 9, characters are basically guaranteed to die.[/QUOTE]"


    Hey! I just learned a lot of this through my own testing. I wish I had read this paragraph first, though. I had the same results, but one thing has gone wrong with the volcano scenario: if I use console_command to create damage as a result of the volcano, that damage appears on the first turn of the game despite the volcano eruption date being 100 turns away. I don't know how to fix it. I followed the example given in this thread for console_command damage.

    I believe that the console_command lines must be separated by something after the end_add_events line, but I don't know what it might be. Do you?

    Thanks for any help you can give me with this.

  19. #59

    Default Re: Creating a World - Disasters and the add_events command

    Hi Nordlaender, glad to see someone is still investigating disasters, this is one area of M2 modding that is still relatively unexplored.

    It sounds like you want to have this volcano erupt randomly over the course of the campaign. Here is an example script. Note that anything after ';' is a comment which is not read by the game.

    Spoiler Alert, click show to read: 

    Code:
    set_event_counter volcano_cool_down 0
    
    monitor_event FactionTurnEnd FactionType slave
    if I_TurnNumber > 8 ;using a condition like this, instead of the 'date' param in the add_events call, to set the start date for your events ensures everything fires at the same time
    
     if I_EventCounter volcano_cool_down > 0 ;this counter prevents eruptions from happening back-to-back, even at 5% chance per turn it would otherwise feel like it happens all the time
      inc_event_counter volcano_cool_down -1
     end_if
    
     if I_EventCounter volcano_cool_down <= 0
     generate_random_counter volcano_dice 1 100
     if I_EventCounter volcano_dice <= 3 ;3% chance of minor eruption
      reveal_tile 157, 82
      add_events
       event volcano
       date 0
       position 157, 82
       region Naples_Province
       scale 1
      end_add_events
      hide_all_revealed_tiles
      console_command set_building_health Naples your_building 50 ;I don't know the name of the building chains you want to damage, I also don't remember what happens if you provide the name of a chain that doesn't exist in the settlement, but I think nothing happens so it's safe
      generate_random_counter volcano_cool_down 5 10
     end_if
     if I_EventCounter volcano_dice == 4 ;1% chance of major eruption
      reveal_tile 157, 82
      add_events
       event volcano
       date 0
       position 157, 82
       region Naples_Province
       scale 5
      end_add_events
      hide_all_revealed_tiles
      console_command set_building_health Naples your_building 25
      console_command damage_wall Naples gate
      generate_random_counter volcano_cool_down 10 20
     end_if
     if I_EventCounter volcano_dice == 5 ;1% chance of catastrophic eruption
      reveal_tile 157, 82
      add_events
       event volcano
       date 0
       position 157, 82
       region Naples_Province
       scale 9
      end_add_events
      hide_all_revealed_tiles
      console_command set_building_health Naples your_building 5
      console_command damage_wall Naples gate breach
      generate_random_counter volcano_cool_down 20 30
     end_if
     end_if
    
    end_if
    end_monitor


    Notice I didn't use terminate_monitor. I don't like that command, especially for things that need to recur continually over the course of a campaign (Vesuvius isn't going dormant any time soon). Your original script was simply calling the event every turn start once the 'date 2' condition was met. My example script uses a cool down to ensure the events can't happen back-to-back. If you do decide to get into scripting, remember that it is always better to have a smaller number of non-terminating monitors than a larger number of terminating monitors, your AI turns will be much shorter.

    Hope it helps!
    Last edited by Callistonian; October 15, 2023 at 10:39 PM.

  20. #60
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,123
    Blog Entries
    35

    Default Re: Creating a World - Disasters and the add_events command

    Appreciate all the feedback as well - this should prove helpful










Page 3 of 5 FirstFirst 12345 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •