Sign in to follow this  
Jolee_Enjoyer

KotOR1 Autobalance

Recommended Posts

A total noob question. From what I understand, the first game  has a switch that makes the enemies tougher upon reaching level 15 (I think). That makes mods seeking to slow down your leveling less effective in upping the difficulty. Is it possible to make it so the game always gives you harder opponents (say, change the level requirement to 1 instead of 15)? Could one somehow "fool" the game by using the savegame editor or other tool for this? If so, does anyone know where to look for it?

  • Like 1

Share this post


Link to post
Share on other sites

I'm not aware of any universal scaling across all creatures, but there is the k_def_buff script that gets called in 51 OnSpawn scripts across the game for various significant fights (for example, Dark Jedi, Terentateks, etc.). Over half of those are on Korriban, the rest primarily on Kashyyyk and Tatooine. From the script's comment block:

    Buffs the target object based on the level of the main PC.

    Jedi (class) will get the following:
    Player Level 12+: +4 to Wisdom, +4 to Charisma, +50 Force Points, +50 Vitality Points.
    Player Level 15+: +6 to Wisdom, +6 to Charisma, +100 Force Points, +100 Vitality Points.

    Beasts (subrace) will get the following:
    Player Level 12+: +6 strength, +60 Vitality points.
    Player Level 15+: +10 strength, +120 Vitality points.

    Droids (race) will get the following:
    Player Level 12+: +6 Dexterity, +60 Vitality points.
    Player Level 15+: +10 Dexterity, +100 Vitality points.

    Scoundrel, Soldier, Scout (class):
    Player Level 12+: +4 Dexterity, +4 Strength, +50 Vitality points.
    Player Level 15+: +6 Dexterity, +6 Strength, +100 Vitality points.

Since those instances all call the script externally via ExecuteScript, modifying it would affect all those cases without needing to edit the individual OnSpawns. The script does a GetHitDice check on the PC to determine their level, then applies the appropriate effects to the target creature. It could be changed so that rather than checking if the PC is between levels 12 and 14 or level 15+ and then applying one of two static buffs it could dynamically scale the buffs incrementally for each PC level. Since K1CP makes a minor edit to this script, I'd suggest using that as the starting point.

There are possibly other OnSpawns (or other scripts) that apply buffs directly. If so those would need to be dealt with on a case-by-case basis. For example, there's the k_inc_generic function GN_ActivateResistances, which is used in OnSpawns with the spawn-in condition SW_FLAG_RESISTANCES_APPLIED. That makes a creature activate the Resist Elements and Resist Force abilities if the PC is level 15+ (or if they are using the Boss AI). Those would require recompiling the individual OnSpawns with a modified k_inc_generic if you wanted to change that.

Edit: So this is the vanilla k_def_buff behaviour:

k_def_buff_Vanilla.jpg.4ebf83ea3f244fbad2d2cc6a66ca9d61.jpg

Since it applies the first set of buffs in a 3 level block, I was thinking you could follow that same pattern to expand the buffs, something like this:

k_def_buff_Expanded.jpg.f6debc04405ffd6494dc0d30c0b4dd19.jpg

Here levels 12-14 and 15-17 keep their vanilla values. New values have been added for 3-5, 6-8, 9-11, and 18-20. Level 1 remains unbuffed and level 2 is mostly as well aside from a minor HP increase for beasts and droids. I kind of just made the numbers up as I went, so I have no idea if they are any good or not. And I used the existing buffs as a baseline, so if those aren't considered difficult enough then you'd need to scale them all according to taste.

Regardless of what the actual values you wanted are, it would be pretty easy to adjust k_def_buff to add them in for all levels. You could also consider editing any OnSpawns to add the use of the buff script that don't already do so. Here's a list of all the existing OnSpawns that use it that I am aware of, as I noted above. You can find decompiled versions on the Community Patch Vanilla Script Source Github repository.

Data\scripts.bif\k_pkas_freyyspwn.nss
Modules\M17AA_Tatooine_Anchorhead_tat_m17aa\k_ptat_bossspawn.nss
Modules\M17AA_Tatooine_Anchorhead_tat_m17aa\k_ptat_jedispwn.nss
Modules\M18AA_Tatooine_Dune_Sea_tat_m18aa\k_ptat_sambspwn.nss
Modules\M18AA_Tatooine_Dune_Sea_tat_m18aa\k_ptat_sandboss.nss
Modules\M18AA_Tatooine_Dune_Sea_tat_m18aa\k_ptat_sandpspwn.nss
Modules\M18AC_Tatooine_Eastern_Dune_Sea_tat_m18ac\k_ptat_sandpbuff.nss
Modules\M20AA_Tatooine_Sand_People_Enclave_tat_m20aa\k_def_sandbuff.nss
Modules\M20AA_Tatooine_Sand_People_Enclave_tat_m20aa\k_ptat_cheifspwn.nss
Modules\M22AB_Kashyyyk_The_Great_Walkway_kas_m22ab\k_pkas_bossspawn.nss
Modules\M22AB_Kashyyyk_The_Great_Walkway_kas_m22ab\k_pkas_jedispwn.nss
Modules\M22AB_Kashyyyk_The_Great_Walkway_kas_m22ab\k_ptat_bossspawn.nss
Modules\M22AB_Kashyyyk_The_Great_Walkway_kas_m22ab\k_ptat_jedispwn.nss
Modules\M23AD_Kashyyyk_Chieftains_Hall_kas_m23ad\k_def_wookspn.nss
Modules\M23AD_Kashyyyk_Chieftains_Hall_kas_m23ad\k_pkas_chuunspwn.nss
Modules\M24AA_Kashyyyk_Upper_Shadowlands_kas_m24aa\k_pkas_gorhench.nss
Modules\M24AA_Kashyyyk_Upper_Shadowlands_kas_m24aa\k_pkas_gorspawn.nss
Modules\M25AA_Kashyyyk_Lower_Shadowlands_kas_m25aa\k_pkas_drdspawn.nss
Modules\M25AA_Kashyyyk_Lower_Shadowlands_kas_m25aa\k_pkas_mandinvis.nss
Modules\M27AA_Manaan_Sith_Base_manm27aa\k_pman_boss_9.nss
Modules\M33AA_Korriban_Dreshdae_korr_m33aa\k_pkor_spn_adb.nss
Modules\M33AA_Korriban_Dreshdae_korr_m33aa\k_pkor_spn_adgrn.nss
Modules\M33AA_Korriban_Dreshdae_korr_m33aa\k_pkor_spn_adnpc.nss
Modules\M33AA_Korriban_Dreshdae_korr_m33aa\k_pkor_spn_dak.nss
Modules\M33AA_Korriban_Dreshdae_korr_m33aa\k_pkor_spn_murdr.nss
Modules\M33AA_Korriban_Dreshdae_korr_m33aa\k_pkor_spn_thgld.nss
Modules\M33AA_Korriban_Dreshdae_korr_m33aa\k_pkor_spn_zone.nss
Modules\M33AB_Korrban_Sith_Academy_Entrance_korr_m33ab\k_pkor_spn_belay.nss
Modules\M34AA_Korriban_Shyrack_Caves_korr_m34aa\k35_spn_thalia.nss
Modules\M34AA_Korriban_Shyrack_Caves_korr_m34aa\k_pkor_spn_adbss.nss
Modules\M34AA_Korriban_Shyrack_Caves_korr_m34aa\k_pkor_spn_adnpc.nss
Modules\M34AA_Korriban_Shyrack_Caves_korr_m34aa\k_pkor_spn_monst.nss
Modules\M35AA_Korriban_Sith_Academy_korr_m35aa\k_pkor_spndthbss.nss
Modules\M35AA_Korriban_Sith_Academy_korr_m35aa\k_pkor_spnhrtbss.nss
Modules\M35AA_Korriban_Sith_Academy_korr_m35aa\k_pkor_spn_ahbff.nss
Modules\M35AA_Korriban_Sith_Academy_korr_m35aa\k_pkor_spn_boss.nss
Modules\M35AA_Korriban_Sith_Academy_korr_m35aa\k_pkor_spn_buff.nss
Modules\M35AA_Korriban_Sith_Academy_korr_m35aa\k_pkor_spn_hrtbf.nss
Modules\M35AA_Korriban_Sith_Academy_korr_m35aa\k_pkor_spn_lasho.nss
Modules\M36AA_Korriban_Valley_of_Dark_Lords_korr_m36aa\k_pkor_spndthbss.nss
Modules\M36AA_Korriban_Valley_of_Dark_Lords_korr_m36aa\k_pkor_spn_dthbf.nss
Modules\M36AA_Korriban_Valley_of_Dark_Lords_korr_m36aa\k_pkor_spn_hrtbf.nss
Modules\M36AA_Korriban_Valley_of_Dark_Lords_korr_m36aa\k_pkor_spn_lasho.nss
Modules\M37AA_Korriban_Tomb_of_Ajunta_Pall_korr_m37aa\k37_spn_freedon.nss
Modules\M37AA_Korriban_Tomb_of_Ajunta_Pall_korr_m37aa\k_pkor_spn_dbbff.nss
Modules\M38AA_Korriban_Tomb_of_Marka_Ragnos_korr_m38aa\k38a_spn_rguedrd.nss
Modules\M38AA_Korriban_Tomb_of_Marka_Ragnos_korr_m38aa\k_pkor_spn_buff.nss
Modules\M38AB_Korriban_Tomb_of_Tulak_Hord_korr_m38ab\k_pkor_spndthbss.nss
Modules\M39AA_Korriban_Tomb_of_Naga_Sadow_korr_m39aa\k_pkor_spndthbss.nss
Modules\M39AA_Korriban_Tomb_of_Naga_Sadow_korr_m39aa\k_pkor_spn_ddb.nss
Modules\M39AA_Korriban_Tomb_of_Naga_Sadow_korr_m39aa\k_pkor_spn_teren.nss

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Thank you, that's definitely gonna help. I know that aside from stats, also the number and type of enemy creatures can vary with the PC's level, but I guess that modifying this would require to modify each individual OnSpawn.

Share this post


Link to post
Share on other sites

An OnSpawn can't change a creature's type, it simply sets some of its basic AI parameters. All that type of thing has to be pre-defined in a UTC, stored either in the module or globally. The game doesn't have any provision for dynamically creating creatures from scratch. And aside from basic buffs like those above, K1 is extremely limited in what aspects of a creature it can alter via script. Something Obsidian improved on for TSL, adding a number of new script functions.

For completely different numbers and/or types of creatures to be spawned based on player level would generally require a module OnEnter or trigger OnEnter, depending on how/when they need to appear. Possibly also a script fired by a DLG or a door/placeable in some cases. Actual module OnEnters that do it should be pretty limited. I know the constant respawns for the Wraids on Tatooine do this (see here), but I can't remember any other examples off-hand.

There are also encounters (UTEs), but I think they only have the ability to randomly spawn from a predefined list, not do anything based on player level.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this