Page 1 of 5 12345 LastLast
Results 1 to 20 of 93

Thread: Creating a World - Disasters and the add_events command

  1. #1
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

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

    Default Creating a World - Disasters and the add_events command

    I admit it - I love to drop the odd disaster on the unsuspecting player, nothing more satisfying then a malicious giggle while typing away at the script For like minded souls I have put my findings together in this thread.

    The basics
    Code:
    add_events
         event [event type] [custom message]
         date [ numerical value(s) ]
         position [ x, y ]
         region [region name]
         scale [1 - 9]
         movie [fmv directory\bik file - requires custom message]
    end_add_events
    The first and the last line 'wrap' the section within a monitor, other entries are as follows:
    • The event type entry can be any of the following:
    • volcano
    • earthquake
    • plague
    • fire
    • flood
    • storm
    • dustbowl
    • locusts
    • horde
    • emergent_faction [horde faction]
    • counter
    • historic
    • The custom message entry gets entered into data\text\historic_events.txt in the usual format. It also serves as event_counter which gets set to true ( 1 ) once the event fires and increases by 1 every consecutive time.
    • The date is a relative figure as it denotes how many years from the firing of the monitor the event takes places. Zero is an immediate firing, one is the next year etc. Two separate values indicate a range of years in which the event will randomly trigger, example: date 3 8
    • The position entry with the game's co-ordinates also enables the locator button.
    • The region entry requires the region's name as found in descr_regions
    • The scale entry governs the intensity of the disaster, where 4 seems to be the default. Only confirmed by testing the volcano event, it's not clear if tile distance plays a role.
    • The movie entry allows the playing of a movie provided the custom message is used by the event. The path starts in the fmv folder, eg event/black_death.bik


    Important note
    A note at the beginning regarding display of messages to factions: if a faction cannot see the event co-ordinate it will not receive a message, nor will the event take place or an event counter (for events with custom messages) be created. That can be a bit embarrassing if the event is meant for the player or the script relies on the event counter, as such it is advisable to use a visible co-ordinate. That can be either a player's settlement (which restricts this event to the player) or a quickly revealed and then covered tile (which fires the event for all factions pending other script conditions) as in this example:
    Code:
    monitor_event FactionTurnStart FactionIsLocal
        reveal_tile 223, 34
        add_events
             event volcano    vesuvius_erupts
             date 0
             position 223, 34
             scale [value]
        end_add_events
        hide_all_revealed_tiles
    end_monitor
    Scale (optional) defines the intensity of the damage, see this post by Callistonian for more details.
    The pictures underneath show the above script with an active, visible volcano near Alexandria when playing as England as well as the fire animation.


    Spoiler for for sizzling volcano pic
    Spoiler for fire animation


    Event details
    Volcano
    Apart from a volcano (doooh) it requires a co-ordinate which can be anywhere within the affected region. If you have multiple volcanoes only one will be activated according to the weird region count principle, top left is the starting point of that counting. I have not tested if you can activate multiple volcanoes in one region with multiple add_events that contain exact co-ordinates of the volcanoes.
    Spoiler for Remarks by Withwnar
    TATW has used this for ages but without a "scale" parameter. No message is shown, no deaths, just the animation. I added a scale and now there are deaths too and behaves in one of two ways:
    1) If a custom message is specified - event volcano {historic_event_name} - then the animation is the sparkle effect and no death numbers are displayed in that message though it still tells you if "important figures" were killed in a separate scroll(s?).
    2) If no custom message is specified - event volcano - then the animation is the smoke/lava effect and the default message is shown - disaster_volcano in event_titles/strings - which does contain character/soldier/citizen death numbers.
    Earthquake
    The animation for this event is centered around a small area of the settlement, using a co-ordinate of the settlement is advisable. This event uses the default message and a default locator button for the settlement. The animation isn't seen until the position button is clicked.

    Plague
    Regardless where the co-ordinate is it will only affect the settlement - forts or characters will not be infected. If multiple settlements are desired to be infected then multiple region entries can be used. One co-ordinate entry can be used when using region entries to provide a locator button but care is advised - the region of the co-ordinate will also be infected. Without a custom message the event takes place as well but no generic message is displayed.

    Fire
    Custom message is not displayed, but the event takes place anywhere according to co-ordinates but a generic message is not displayed either. This is a purely cosmetic disaster - nothing gets damaged\killed.

    Flood
    Works the same as earthquake but it's use is not recommended as it permanently prohibits the building of towers and forts and reduces movement points. Most mods disable it in descr_disasters.
    A very specific method to revert the effects is described here.

    Storm
    The character closes to the co-ordinate in that region will receive the animation, (stranded) ships will receive it by default. Recent tests have for some reason not been able to trigger the event.
    Update: scripted spawns and and the event on their co-ordinate have worked, target's contact to land mass appears to be essential.
    Spoiler for inland storm in Ireland
    Dustbowl, locusts and horde
    These events appear not to be enabled or require an unknown format

    Emergent_faction [horde faction]
    The event requires a valid horde faction - the mongols and timurids in vanilla work just fine, provided they have not settled. The event uses a default message with a locator button. Multiple region entries can be used from which one will be chosen randomly for the spawn.

    Counter
    This creates an event_counter set to true ( 1 ), no messages, nothing else. Will increase the event counter by 1 every time it fires.

    Historic
    This also creates an event_counter set to true ( 1 ) but also allows a message and co-ordinates for a locator button. This message will fire for every faction regardless if the co-ordinate is visible. Will increase the event counter by 1 every time it fires.

    Last edited by Gigantus; February 10, 2024 at 11:31 PM. Reason: flood update










  2. #2
    bitterhowl's Avatar Campidoctor
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    1,695

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

    It seems to me there is one more disaster - storm.

    As for historic events and event_counters I just use " historic_event abc_event" and "set_event_counter", nothing else, everything works fine. And plague event works without event message.

    My sister, do you still recall the blue Hasan and Khalkhin-Gol?
    Russian warship is winning. Proofs needed? Go find yourself!

  3. #3
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

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

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

    Not sure why I forgot storm - getting old I guess. Tested it right now and couldn't make it work - not over land or over sea, over settlements or ships, region or co-ordinate based. And I could have sworn I made it work before...

    You are right about plague - it does work without message but then there is absolutely no message, not even a generic one like with the earth quake.

    Updated the OP accordingly.
    Last edited by Gigantus; August 16, 2015 at 12:03 PM.










  4. #4
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

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

    Excellent. Didn't know about the need to make it visible to the player faction, nor the region parameter. Brilliant.

    There is also "fire". I could never get it to do any damage/killing but it does show the smoke animation which can be a handy visual effect. This works in script - can't recall if I've tried it in descr_disasters.

    "date" - I thought the value(s) are years, not turns.

    Also pretty sure that "historic" increments (adds 1 to) the associated event counter. So if you issue that historic event a second time then its counter will now be 2, unless you reset it back to 0 beforehand. historic_event certainly behaves that way but not sure about "event historic".

    Something else to bear in mind is that "date 0" doesn't work with some turns-per-year values: http://www.twcenter.net/forums/showt...ot-not-working I assume it's for all event types, not just historic.

  5. #5
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

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

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

    Updated the OP with the info. Tried fire and updated as well.

    You can also use seasons (summer \winter) in connection with the date according to the docudemons - will have to test that and will update.
    Last edited by Gigantus; August 17, 2015 at 01:16 AM.










  6. #6
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

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

    However, it still says that "date 1" will be next turn. And it's "range of years" not "range of turns". The actual turns depends on the mod's TPY. e.g. In 4TPY "date 1" = 1 year = 4 turns. (Tested and confirmed.) In vanilla "date 2" will be next turn, as vanilla is 2 years-per-turn (0.5 TPY). I don't know what happens if you use "date 1" in vanilla as that equates to half a turn. And, assuming that it doesn't accept decimal values, there's no way to make it for next turn in something like 4TPY because that would need it to be "date 0.25".

    Also confirmed: event historic does increment the event counter, just like historic_event does. It will always add 1 to whatever the event counter currently is, which of course means making it 1 on the first usage (but only if script has not already set that event counter to something else, in which case it will not be 1 but whatever it was + 1).

  7. #7
    bitterhowl's Avatar Campidoctor
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    1,695

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

    I discovered that plague doesn't appear in besieged city. I had a good idea for that, but now have to find a way to solve this issue for my goal.

    My sister, do you still recall the blue Hasan and Khalkhin-Gol?
    Russian warship is winning. Proofs needed? Go find yourself!

  8. #8
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

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

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

    Were you scripting to have a plague when a city gets besieged?










  9. #9
    Aneirin's Avatar of flowing verse
    Join Date
    Nov 2012
    Location
    Gododdin
    Posts
    2,734

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

    Well done!
    A decent tutorial!
    Proud son of Aikanár and brother of Iskar

  10. #10
    bitterhowl's Avatar Campidoctor
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    1,695

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

    I had an idea to force player for attack besieged city, and not maintain siege. I made sieging expensive 2.5k gold per turn and next idea is about epidemic factors - first I wanted to cast plague on besieging army if siege goes more than 4-5 turns (as it was in real history, not plague but in M2TW we have no other diseases), but it failed. Then I wanted to cast plague for besieged garrison after 4-5 turns of siege (they have no water and too many dead bodies inside settlement ) but it failed too.

    My sister, do you still recall the blue Hasan and Khalkhin-Gol?
    Russian warship is winning. Proofs needed? Go find yourself!

  11. #11
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

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

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

    The besieging army wold not be effected - the command only works for the settlement, not even for a fort. It is surprising however that the command doesn't work when the settlement is besieged.










  12. #12
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

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

    Quote Originally Posted by Gigantus View Post
    [Storm] Tested it right now and couldn't make it work - not over land or over sea, over settlements or ships, region or co-ordinate based. And I could have sworn I made it work before...
    I couldn't get it to work either and only just found this comment. Could the OP be updated with this until somebody figures out how to get it working?

    Some other findings...

    Volcano: TATW has used this for ages but without a "scale" parameter. No message is shown, no deaths, just the animation. I added a scale and now there are deaths too and behaves in one of two ways:
    1) If a custom message is specified - event volcano {historic_event_name} - then the animation is the sparkle effect and no death numbers are displayed in that message though it still tells you if "important figures" were killed in a separate scroll(s?).
    2) If no custom message is specified - event volcano - then the animation is the smoke/lava effect and the default message is shown - disaster_volcano in event_titles/strings - which does contain character/soldier/citizen death numbers.

    Earthquake: the animation isn't seen until the position button is clicked.

  13. #13
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

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

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

    Thanks for the detailed info - OP updated. Also added movie info\details.

    Tried once more with the storm event and it appears utterly randomly: used princess Cecilia's co-ordinates and causes a storm over Nottingham, but couldn't repeat it. Same with a character standing at the coast.

    Edit: eventually found out why the short cuts in the 'compare' plug-in of Notepad++ do not work (a tool I use frequently) - they conflict with shortcuts of the main menu (#158-161) in settings\shortcut mapper\main menu. I don't use that in the main menu so I cleared the entries there and all works fine in the compare add-in.
    Last edited by Gigantus; June 03, 2017 at 05:26 AM.










  14. #14
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

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

    Didn't know about the movie parameter. Nice. Useful if you have a movie to show and want a zoom/position button as well. historic_event can't provide that button.

    Storm: partially working then. Better than not at all I guess.

    Something else came to mind: the problem of this script (add_events) not working for "date 0" under some TPYs (e.g. 12tpy) is apparently also a problem on Linux (and Mac?) always. "date 0" doesn't work. Not for 4tpy at least, the only one I've tried. Not that I have Linux M2TW myself but one of our testers does and he wasn't seeing any of the historic events shown with this method, nor the volcano erupting (all using "date 0").

    We're also using the BC time period at some stage in the campaign and I found that "date 0" didn't work there either (Windows, 4tpy). That might be due to how we're using it though, so could be a false alarm.

  15. #15
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

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

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

    We had some weird stuff happen in EBII with events based in descr_events in the initial year and had to use regular, scripted historic events.










  16. #16
    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

    Im a little bit confused here, specially because english is not my manin language.
    Can the fire efct be permanently displayed from the start of the campaign?
    I just want a chimney, no need for messages, damage or storic events happening.

    Also, is there any thext file where we could edit the effect like we do to battlemap effects?

  17. #17
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

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

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

    I think the fire effect would have to be a repetitive script, and the effect only lasts for a minute or two.

    No idea how to do that on the battle map.










  18. #18
    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

    Im curious, in case I wanted to add lot of them and make them very frequent, such as the fires, would it possibly be delaying turn times or being too demanding of the performance?

    And btw, are you not missing "climate" and "warning" parameters, or those work only with generic events in descr_disasters?

    EDIT

    Though, does descr_disasters even work? Didnt manage to get stuff working in it (eventho they worked fine via deccr_events) Perhaps it only works for plague, and possibly stuff like floods/storms with only some parameters...
    Last edited by Jadli; January 26, 2021 at 08:08 AM.

  19. #19
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

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

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

    descr_disasters certainly works - it's just a matter of the frequency. climate and warning are not required for the script command - after all you can trigger a simple historic_event and then have a delayed disaster. And climate is of no use - you are defining the location of the event in the script version which would simply ignore that setting.
    Unlike in the descr_events file where it's a matter of random chance, there the warning makes sense and climate as well as region will restrict the location.










  20. #20
    bitterhowl's Avatar Campidoctor
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    1,695

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

    Seems that I dealed with storms - they're vital for my mod.

    Event fires only with one line of coordinates scripted + named_character near. The coordinates of storm and named character shouldn't match, he should be near by in same region.

    Doesn't fire with region condition. Doesn't fire with any other character instead. Doesn't fire with admiral only fleet (didn't tested with army aboard).

    My sister, do you still recall the blue Hasan and Khalkhin-Gol?
    Russian warship is winning. Proofs needed? Go find yourself!

Page 1 of 5 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
  •