Skip to content

Improved scripts for your BG/BG2 playing experience

2»

Comments

  • sarevok57sarevok57 Member Posts: 5,975
    Blaec wrote: »
    Hello! New to the forums and reviewed this thread with interest as I have been looking for better AI Scripts! From what I am reading, these are exactly what I am looking for - thank you for your efforts!

    There are a LOT of posts in the forum and sorting through them isn't the easiest, but I have been trying to find out how to actually add the new scripts to the game and if they can be added to an existing installation (with saved games) or only new installations? If there is an existing thread with how install the file, that would be great (I am playing in Windows and currently unmodded - very little experience with modding).

    did you install the game via steam, gog or beamdog launcher? because what you need to do is find the game directory and put the scripts into the script folder ( going to "my documents" wont work )

    so for example if you installed it on steam your directory path will look something like this:

    Local Disk (C:) \ Program Files (x86) \ Steam \ steamapps \ common \ Baldur's Gate Enhanced Edition

    the above is based on if you installed it to the main hard drive, if your steam library is on another hard drive then you could probably just start with Steam, that is, again if you are using steam

    in either case once you find the baldur's gate directory ( where the game is actually installed ) there is a folder called "scripts" that is where you put them, and they will appear in game regardless if the game is new or old
  • BlaecBlaec Member Posts: 2
    Thank you for the quick response. I used the Beamdog Launcher and found the script folder and copied them over. I am looking forward to testing them out.

    I am embarrassed to say I didn't realize the .rar file was an archive. Everything became clear once I extracted the archive.

    Thanks again!
  • sarevok57sarevok57 Member Posts: 5,975
    no problemo :)
  • FixTesteRFixTesteR Member Posts: 8
    Hi! Do you still follow comments here? I am using your scripts and had a couple of questions :) Cheers.
  • sarevok57sarevok57 Member Posts: 5,975
    FixTesteR wrote: »
    Hi! Do you still follow comments here? I am using your scripts and had a couple of questions :) Cheers.

    yup
  • FixTesteRFixTesteR Member Posts: 8
    edited October 2020
    Great!
    What I'm doing right now is testing which spells the casters use and which they don't. I haven't got a complete list yet because I wanted to check if you're up to talk about it first. Now that I see you are, I'll continue my project and will ask for your insights. Because maybe you deliberately left some spells out.
    A Druid never uses any of the regeneration spells. Is that on purpose?
    A Cleric never uses the Cure Moderate Wounds. He uses all the rest though. Purposefully?
    Also, a Cleric casts Circle of Protection from Evil twice in a row. As if the first one doesn't go into effect quickly enough and he doesn't realize it's been cast already.
    Does a Cleric ever Turn Undead on his own?
    There is a problem with Time Stop. A Mage targets an enemy with this spell which makes that enemy unit free to move for the duration of the spell, while everyone else, including the casting Mage, is frozen in time. Which is a big detriment to your party, thus it's risky having a Time Stop memorized.
    For now I'll stop here but would love to talk about other findings I get while playing. :) I'm testing all these in ToB, with EET installed, and a bunch of mods. Maybe those interfere with the script? I don't know.
  • sarevok57sarevok57 Member Posts: 5,975
    druid regeneration;

    from what i remember i dont recall how that spell is scripted, my guess is that i have it set that if you are using a defense script it would either cast on yourself if your HP was at 50% or lower or when an enemy is sighted, could be possible that i forgot to put that spell in as well

    cleric cure moderate wounds;
    this could be a mistake for it not working

    i just checked cure moderate wounds and regeneration and both are supposed to be cast on a character that is 50% HP or less

    perhaps your mods *might* be getting in the way, hard to say

    the protection from evil 10' radius one has always been tricky, i have that one set so it checks to see if all 6 party members have it ( or 6 closest creatures on your team ) have it on, and if its not on then they will cast it until the closest party members have it

    sometimes it works as intended sometimes the cleric will just keep casting it over and over even though everyone is protected, luckily in SoA/ToB the duration is long enough that you pretty much only ever need one on, but unfortunately at the moment i don't know how to script it better to make it work better

    i don't have it so that a cleric will use turn undead on their own

    i was also having problems with time stop, except what happened on my side was that the mage would cast time stop then improved alacrity and then just blow through all the time stops until there was no more, i found that having one memorized worked well, but for some reason the global timers i set aren't working as intended

    the only spells that i did not include for bg1/bg2 for these scripts were the demon summoning spells and the mage's elemental summoning spells, since they can be real risky in combat if you dont have protection from evil cast or if you fail on the "control" elemental check

    in theory, if the right script is used every other spell ( even abilities ) should go off when appropriate

    i also noticed ( since i made these around the time when v2.0 was out ) that when v2.5 came in, it kind of messed up some of the scripts as well ( like figthers burning through all of their enrages even though they didn't in 2.0 but for some reason do in 2.5 )
  • HaLLuC1NaTiOnZzHaLLuC1NaTiOnZz Unconfirmed, Member Posts: 1
    edited November 2020
    nvm lmao
    Post edited by HaLLuC1NaTiOnZz on
  • IgamsIgams Member Posts: 3
    edited December 2020
    @sarevok57 First of all thank you so much for these scripts! I haven't played through the BG series in many years and now I'm playing through EET for the first time and it's so much more enjoyable since I started using your scripts. I tried basically every custom script I could find but I like yours the most. They're seriously great!

    I've also been reading up on scripting myself a bit and I had a few questions if you don't mind giving me some tips.

    1) I noticed you use the function InParty(Myself) frequently and from what I know that just checks if the character is in the players party. But since these are party member scripts shouldn't they only be on party members in the first place, or is that meant to prevent something? Sorry if that's a dumb question this is my first time messing with scripts for this game.

    2) How do you figure out what states or objects are placed on a character from a spell. Mainly for use with the CheckStatLT() and StateCheck() functions? Do you basically just use a combination of EE Keeper and Near Infinity and dig through files looking for references to the spells script name? Or is there another program to assist with this?



    @FixTesteR Not sure if you're still playing but it sounds like you use the Spell revision mod. I use that mod to. The base game has Cure Medium Wounds (which Sarevok's scripts account for) but the spell revision mod has Cure Moderate Wounds.

    More specifically base games cure spells go like this:
    lvl 1: Cure Light Wounds (Script name: CLERIC_CURE_LIGHT_WOUNDS)
    lvl 2: Cure Medium Wounds (Script name: CLERIC_CURE_MEDIUM_WOUNDS)
    lvl 3: Cure Serious Wounds (Script name: CLERIC_CURE_SERIOUS_WOUNDS)
    lvl 4: Cure Critical Wounds (Script name: CLERIC_CURE_CRITICAL_WOUNDS)

    But the spell revision mod changes things to:
    lvl 1: Cure Light Wounds (Script name: CLERIC_CURE_LIGHT_WOUNDS)
    lvl 2: Cure Moderate Wounds (Script name: CLERIC_CURE_MODERATE_WOUNDS)
    lvl 3: Cure Serious Wounds (Script name: CLERIC_CURE_MEDIUM_WOUNDS)
    lvl 4: Cure Critical Wounds (Script name: CLERIC_CURE_SERIOUS_WOUNDS)
    lvl 5: Cure Mortal Wounds (Script name: CLERIC_CURE_CRITICAL_WOUNDS)

    They replaced Cure Medium Wounds with Cure Moderate Wounds which has a new script, and then they repurposed the existing Cure Wound scripts by bumping them all up a spell lvl and attaching them to the new revised spells. Actually this is very easy to "fix" since Sarevok's scripts already account for the Cure Light/Medium/Serious/Critical scripts so you only need to add in the block of lines for CLERIC_CURE_MODERATE_WOUNDS so it uses the new Cure Moderate Wounds spell.

    Basically just go to whatever DIV/or BOTH scripts you want to change and find where the CLERIC_CURE_MEDIUM_WOUNDS blocks are. Copy that block of code and then paste it BELOW it, and in the pasted copy change the 2 instances of MEDIUM to MODERATE. So there will be 2 uses of CLERIC_CURE_MODERATE_WOUNDS in each block, one in the IF statement at the top of the block and the second in the THEN statement at the bottom.

    For example In the DIVMDSO and DIVRDSO scripts there are two locations where the CLERIC_CURE_MEDIUM_WOUNDS block is used, at line 2542 and then again at line 6125. In the BOTHRXDSO and BOTHMXDSO scripts there's only one spot where the CLERIC_CURE_MEDIUM_WOUNDS block is used, at line 4438.

    As far as I can tell all the other Cleric healing spell scripts work fine with the mod, since they don't change the script names just the effect of the spells. Aid, Mass Cure, Regeneration etc. However the reason the druid Regeneration spells aren't working are because those are new specific non-Cleric spells.

    New Druid/Ranger/Shaman specific Regeneration spells:
    lvl 1: Regenerate Light Wounds (Script name: REGENERATE_CURE_LIGHT_WOUNDS)
    lvl 2: Regenerate Medium Wounds (Script name: REGENERATE_CURE_MODERATE_WOUNDS)
    lvl 3: Regenerate Serious Wounds (Script name: REGENERATE_CURE_SERIOUS_WOUNDS)
    lvl 4: Regenerate Critical Wounds (Script name: REGENERATE_CURE_CRITICAL_WOUNDS)
    lvl 5: Mass Regenerate Wounds (Script name: CLERIC_MASS_REGENERATE)
    lvl 6: Regenerate (Script name: CLERIC_REGENERATION_DRUID_VERSION)

    This is a bit trickier to add in since I'm not sure what states/objects these apply to the character. Personally this is low priority for me since I use the Regeneration spells manually for out of combat healing, or for buffing up the party right before a big fight. But with that said if you figure out the names of the states caused by the spells it should be easy to add in just by copying Sarevok's default Regeneration spell script.
    Post edited by Igams on
  • TressetTresset Member, Moderator Posts: 8,264
    @Igams your post here was caught by the forum's automated spam filter. I have restored it and verified you so that this should not happen again.
  • IgamsIgams Member Posts: 3
    Tresset wrote: »
    @Igams your post here was caught by the forum's automated spam filter. I have restored it and verified you so that this should not happen again.

    Whoops! I didn't realize I was getting caught in the spam filter and submitted the same post a whole bunch of times. Please ignore the rest. Thanks and sorry about that!
  • sarevok57sarevok57 Member Posts: 5,975
    edited December 2020
    ah i was wondering why i was getting messages from @Igams and nothing was showing up

    1) this is more from just copy and pasting from existing scripts, no real reason other than that if im not mistaken

    2) i use the .ids files in near infinity for references, especially statmod, state, splstate, trigger and perhaps even action
  • IgamsIgams Member Posts: 3
    sarevok57 wrote: »
    1) this is more from just copy and pasting from existing scripts, no real reason other than that if im not mistaken

    2) i use the .ids files in near infinity for references, especially statmod, state, splstate, trigger and perhaps even action

    Ok then I'll include it in scripts just to be safe. Ah ok I see now the ids files have what I'm looking for. Thanks for the help!
  • FixTesteRFixTesteR Member Posts: 8
    edited February 2021
    Hello!

    @Igams , Thanks for your explanation. I am indeed using Spell Rev and a whole bunch of other mods. Are you improving on the scripts yourself? What have you changed? I am somewhat interested in tinkering, but I have no knowledge and little time to do it. I guess sarevok's post from earlier in this thread is a good place to start. Then you also need imagination on how to set the right conditions for a spell to go off. In the later stages of the game it would be most beneficial to have a script that would do all the pre-buffing for you. I forgot if this script is capable of doing that.

    @sarevok57 , I've finished ToB using your scripts. I guess the Five are just too difficult to beat relying on scripts, so for the last few hours of the game the scripts had to be turned off. While using your scripts, I paid close attention to spells that didn't work or didn't work properly. I will list them here, and would be happy, if you could respond and comment on this long endeavour of mine. It's quite possible that the main reason for some of them not working is Spell Rev Mod. And remedies are possibly my own tinkering, right?

    Priest Spells that never went off:
    1: animal summoning 1, sunscorch, protection from evil, cause light wounds, strength of stone
    2: animal summoning 2, barkskin, know opponent, chant, find traps, fire trap, resist elements, cause moderate wounds
    3: magic fang, dispel magic, icelance, animal summoning 3, pixie dust, invisibility purge, miscast magic, hold person or animal, spike growth
    4: death ward, negative plane protection
    5: animal growth, protections from fire/cold/elec/acid, pixie dust, champion's strength
    6: wondrous recall, conjure air/earth elemental, fire elemental is ok, animate skeleton warrior, banishment
    7: chaos (possibly), shield of the archons (possibly), holy word, regeneration, summon death knight, sunray, symbol of death/stunning/weakness, unholy word, animal summoning 7, creeping doom, summon shambling mound (possibly), nature's beauty (possibly)

    Wizard Spells that never went off:
    1: mage armor, monster summoning 1, prot from evil, prot from petrif
    2: vocalize?, battering ram, luck, invisibility, ms2
    3: ghost armor, invisibility sphere, icelance, dispel magic
    4: enchanted weapon, vitriolic sphere
    5: spell shield multicast do konca, phantom blade, mestil's acid sheath
    6: improved haste,
    9: larloch's energy drain, aegis, black blade of disaster, death field, conjure magic golem, shapechange

    Spells that didn't work as intended:
    Neutralize poison is cast upon blindness, but doesn't help it so it's wasted.
    Remove paralysis is cast upon a character that was held by chaos, but it doesn't remove the paralysis so it's wasted.
    L5 Priest spell Magic resistance is reapplied until all memorized instances are depleted.
    L7 Wizard spell Spell shield is multicast until depletion.
    Call woodland beings is summoned way beyond the allowed number of summons, it somehow bypasses the limit and doesn't stop being cast one after another until depletion.
    Summons like deva and planetar don't attack on their own, as if their AI are bugged.
    Wizard goes into melee range, even though he has a ranged weapon equipped, and then shoots the target from that melee range.

    My party consisted of a Skald, a Wizard Slayer, a Swashbuckler, a Totemic Druid, and a Conjurer. That was the limit of my tests, so there might be other areas of exploration still, if ever you'd need someone to test it.

    Thanks for all your inputs and suggestions. Maybe I should do some tinkering myself, but it's hard to come up with useful ideas for conditions under which spells are to be cast. Thoughts?
  • morpheus562morpheus562 Member Posts: 250
    edited November 2021
    FixTesteR wrote: »
    Hello!

    @Igams , Thanks for your explanation. I am indeed using Spell Rev and a whole bunch of other mods. Are you improving on the scripts yourself? What have you changed? I am somewhat interested in tinkering, but I have no knowledge and little time to do it. I guess sarevok's post from earlier in this thread is a good place to start. Then you also need imagination on how to set the right conditions for a spell to go off. In the later stages of the game it would be most beneficial to have a script that would do all the pre-buffing for you. I forgot if this script is capable of doing that.

    @sarevok57 , I've finished ToB using your scripts. I guess the Five are just too difficult to beat relying on scripts, so for the last few hours of the game the scripts had to be turned off. While using your scripts, I paid close attention to spells that didn't work or didn't work properly. I will list them here, and would be happy, if you could respond and comment on this long endeavour of mine. It's quite possible that the main reason for some of them not working is Spell Rev Mod. And remedies are possibly my own tinkering, right?

    Priest Spells that never went off:
    1: animal summoning 1, sunscorch, protection from evil, cause light wounds, strength of stone
    2: animal summoning 2, barkskin, know opponent, chant, find traps, fire trap, resist elements, cause moderate wounds
    3: magic fang, dispel magic, icelance, animal summoning 3, pixie dust, invisibility purge, miscast magic, hold person or animal, spike growth
    4: death ward, negative plane protection
    5: animal growth, protections from fire/cold/elec/acid, pixie dust, champion's strength
    6: wondrous recall, conjure air/earth elemental, fire elemental is ok, animate skeleton warrior, banishment
    7: chaos (possibly), shield of the archons (possibly), holy word, regeneration, summon death knight, sunray, symbol of death/stunning/weakness, unholy word, animal summoning 7, creeping doom, summon shambling mound (possibly), nature's beauty (possibly)

    Wizard Spells that never went off:
    1: mage armor, monster summoning 1, prot from evil, prot from petrif
    2: vocalize?, battering ram, luck, invisibility, ms2
    3: ghost armor, invisibility sphere, icelance, dispel magic
    4: enchanted weapon, vitriolic sphere
    5: spell shield multicast do konca, phantom blade, mestil's acid sheath
    6: improved haste,
    9: larloch's energy drain, aegis, black blade of disaster, death field, conjure magic golem, shapechange

    Spells that didn't work as intended:
    Neutralize poison is cast upon blindness, but doesn't help it so it's wasted.
    Remove paralysis is cast upon a character that was held by chaos, but it doesn't remove the paralysis so it's wasted.
    L5 Priest spell Magic resistance is reapplied until all memorized instances are depleted.
    L7 Wizard spell Spell shield is multicast until depletion.
    Call woodland beings is summoned way beyond the allowed number of summons, it somehow bypasses the limit and doesn't stop being cast one after another until depletion.
    Summons like deva and planetar don't attack on their own, as if their AI are bugged.
    Wizard goes into melee range, even though he has a ranged weapon equipped, and then shoots the target from that melee range.

    My party consisted of a Skald, a Wizard Slayer, a Swashbuckler, a Totemic Druid, and a Conjurer. That was the limit of my tests, so there might be other areas of exploration still, if ever you'd need someone to test it.

    Thanks for all your inputs and suggestions. Maybe I should do some tinkering myself, but it's hard to come up with useful ideas for conditions under which spells are to be cast. Thoughts?

    I might be able to field some of these questions since I ran into a lot of these issues and had to custom add spell states to many spells in order to track properly. SRR, from the author's own mouth, doesn't do the best job of updating spell states and state checks for the characters. That's why the spells keep casting over and over using regular scripts because there is no way to write the script to track it without manually creating and applying new spell states to the spells. This is across the board for multiple spells. Additionally, the way SRR handles invisibility and non-detection, makes it more difficult than vanilla spells to script targeting enemies with spells. I went down that rabbit hole, stopped, was prodded into going down the rabbit hole again.

    Edit: Going back and reading my verbiage, I really did not like the tone I had. As my understanding of spells and applying op-codes increased, it made what I wrote seem antiquated. SRR is an amazing mod, but it can cause issues with ai scripts unless the ai scripts are specifically written for SRR.
    Post edited by morpheus562 on
  • sarevok57sarevok57 Member Posts: 5,975
    as morpheus562 says, its the use of spell revisions messing things up, especially if spell revisions changes spell script names then those spells just won't work period, or if they didn't exist in the base game then of coarse they will not work ( since i didn't use any spell revision scripts ) also spell revisions could change the behavior of some spells ( like neutralize poison for example in the base game cures blindness and deafness )
  • morpheus562morpheus562 Member Posts: 250
    edited November 2021
    I tried, I really tried to write ai scripts for spell revisions (srr). It doesn't work. Without proper spell state and state tracking, scripts can't be made. Srr is a great idea, but has a long way to go. This does not apply. Feel free to delete my comment.
    Post edited by morpheus562 on
  • FixTesteRFixTesteR Member Posts: 8
    Okay. Thanks guys for your answers.
    @morpheus562 what about just the buffing SR(R) spells? Those should work.
  • morpheus562morpheus562 Member Posts: 250
    edited November 2021
    FixTesteR wrote: »
    Okay. Thanks guys for your answers.
    @morpheus562 what about just the buffing SR(R) spells? Those should work.

    They don't though. A lot of the spells act completely differently than the original spell, so the behavior and what is being tracked are different. Mage Armor originally reduces someone's AC to 6 (can't remember exact); however, SR(R) reduces it by a set amount based on player level. There is no stat tracking this is done because the original game goes off the 6 AC that the original spell uses. This causes you to cast unlimited Mage Armors. Another example is Spell Immunity. In the original game it updated a Spell State depending on the type of immunity it was conferring to the player. SR(R) completely removes Spell Immunity and replaces it with Dispelling Screen. What should happen is Dispelling Screen should set a spell state similar to how the original game does for SI: Abjuration; however, no spell state changes occur. This leaves scripts constantly casting Dispelling Screen since it never registers as being cast. Just be aware there can be some nuance when running scripts with mods that alter/change existing spells.
    Post edited by morpheus562 on
  • Emardon_LareousEmardon_Lareous Member Posts: 60
    Hi @sarevok57, thought I'd ask as you may have encountered it. If you have a script that makes you look for traps etc if you can't see enemies, do you know how you can make it not activate modals whilst interacting with containers?
  • jacklhowardjacklhoward Member Posts: 14
    @sarevok57
    hi dear sarevok57,
    does this script package work on classic baldurs gate trilolgy? thank you.
Sign In or Register to comment.