SP Tutorial Module System Adding permanent defeat/death in 2 easy steps

Users who are viewing this thread

Hi all,

Well this was just a simple thing I did to spice up my game play a little, but after sharing it and getting a positive response I thought I'd post something here, as I couldn't find any posts on it. I basically just took the permanent damage snippet already in the game and redirected to the retirement screen. The changes were made in the module system files, but were simple enough to make that I thought more people might have an interest. There were 2 snippets of code I played with (if I remember what I did right...), both in module_game_menus.py.

The main one was the redirect in "permanent_damage." By default the end of the script reads:

Code:
       "{s0}",
       [
         (try_begin),
           (eq, "$g_next_menu", -1),
           (leave_encounter),
           (change_screen_return),
         (else_try),
           (jump_to_menu, "$g_next_menu"),  #<---------
         (try_end),
         ]),
      ]

I simply changed the line marked by the arrow to:

Code:
(start_presentation,"prsnt_retirement"),

which is a simple trigger to jump off to the retirement screen.

The second part was in the "total_defeat" snippet right above it. The section changed was the number '100' on the marked line:

Code:
   (try_begin),
            (neq, "$g_player_surrenders", 1),
            (store_random_in_range, ":random_no", 0, 100), #<---------
            (ge, ":random_no", "$g_player_luck"),
            (jump_to_menu, "mnu_permanent_damage"),
          (else_try),

In my game I changed number to 300. If I understood things correctly this is the roll against the players luck, which defaults at the start of the game to 200. Setting the number to 300 gave me a 1/3 chance of bringing up the retirement screen upon losing a battle (in which I was obviously knocked out in as well). The chance of course is modified by any changes in the players luck over the course of the game; which isn't something I have a great understanding of unfortunately. Still putting an extremely large number here would pretty much guarantee a 'game over' scenario. 

There's more you can do there of course. There's several dialog strings already present that you can use to rewrite your ending as you see fit (maybe saying your battle ended in death, disabling injury, sold to a Ransom Broker and never ransomed, etc). The retirement screen does give you the option to keep playing after seeing it of course (if you should happen to change your mind about this whole permanent end thing), and there's already stat penalties in place there as well, which has plenty of fun potential.

Anyway nothing too amazing, but a fun little way to make the game more interesting nonetheless.

Edit: I should also add these code snippets are present in many mods out there (and present unchanged in many of them as well). So if Floris or Diplomacy is more your flavor, and you'd like a bit more spice there, this change may well work in other mods where you have access to the python code as well (I'm actually playing Diplomacy 4.2 with these changes at the moment).
 
heydiddlediddle said:
The chance of course is modified by any changes in the players luck over the course of the game; which isn't something I have a great understanding of unfortunately. Still putting an extremely large number here would pretty much guarantee a 'game over' scenario. 
It's reduced by one every 180 hours in module_simple_triggers.py
 
Back
Top Bottom