Jump to content


Photo

xParty 1.4 discussion

Discuss xParty 1.4 here

  • Please log in to reply
29 replies to this topic

#1 Xyx

Xyx
  • Member
  • 73 posts

Posted 06 April 2012 - 07:51 AM

This topic is for the discussion of xParty 1.4.

So, there it is! Many hours of work went into it, I'm really proud of it, and I wanted to share it with the world. I love it, and I use it all the time, but what do you think?

#2 Azazello

Azazello

    The Anti-Spammer

  • Member
  • 1846 posts

Posted 19 April 2012 - 02:04 PM

Congratulations!

I haven't looked at the details of the script yet, but will.

I'm curious about the development of the script. Give us the creation history.

Here's a few extra questions in the mix...
- Did you review & use precursors like eSeries, g(Series?), Kesley's, etc.?
- Any plans to incorporates spells from Divine Remix, TDD (has a few good ones, especially one for all-day buff), SpellPack, xyz?
- From the old days, I remember concerns about long player AI scripts causing slowdown or stuttering. I'm sure you haven't seen such effects, but is there any concerns one should have if they decide to extend your script, e.g. adding new code block for buffing or etc.?

You ever notice that "What the hell..." is the answer to just about everything?
================================================================
"Girls are like phones, they like to be held and talked too, but if you press the wrong button, you will be disconnected!" DJ Nikodemus
================================================================
Community Contributions
a directory of Mega-Installation Guides * Level 1 NPCs * gMinion: expanded TP2 for MegaInstalls * PSM (PSQM): expanded scripts for Melanthium * Weimer's-Tactics: revised TP2 for MegaInstalls * non-detectable Cloak of Non-Detection ?? * Shar Nadal (DSotSC-BGT) revision


#3 Xyx

Xyx
  • Member
  • 73 posts

Posted 20 April 2012 - 06:58 AM

I'm curious about the development of the script. Give us the creation history.

Well, since you asked...

I played through BG1Tutu without any custom scripting. I then started on BG2 and was immediately annoyed with the amount of clicking required for casting healing spells. Having recently played Pool of Radiance (the 1988 one) and Eye of the Beholder as well, I can say that this problem is systemic in AD&D games in general. I looked for a script to handle this tedium for me, but all I could find were gSeries, GBScript and their derivatives. These scripts are superb pieces of work and I have great respect for their authors, whom I learned much from back in the day. However, I don't like my scripts interfering with combat. If there's Haste or Horrid Wilting to be cast, I'll handle it myself. So I wrote my own script.

I started with healing spells, and got the taste of it. I had been rather involved in scripting in the past and I'm a sucker for nostalgia, so I didn't need much of an excuse to elaborate. I made a separate script for each of my party members (me, Ano, Jaheira, Jan, Immy and Aerie), and gradually started adding features. In went combat targeting (all try to target nearest enemy of the main character to focus fire) and automatic casting of Stoneskin, Iron Skins and whatnot.

The limitations of the scripting engine are such that I don't particularly trust any script to cast any spell at all save for some very specific exceptions. For example, at one time I had my script autocast the Kensai Kai ability, which I tend to completely forget about otherwise. Kai is completely expendable and I wouldn't mind if the script used it when it wasn't really needed. However, since characters can only cast one spell every 6 seconds, there were instances where I needed my character to use the Rod of Resurrection RIGHT NOW, and he would have to wait for another 4 or so seconds because he just used Kai. At that point I decided that no script should ever cast anything, no matter how expendable, unless it was essential. Kai is never essential, but Stoneskin is, so that is one of the few spells I let the script cast in combat.

The script originally included a hotkey that toggled arcane spellcasting, since you don't want the Cowled Wizards paying a visit if your stoneskins run out in a street fight. That worked, but I often forgot to turn off spellcasting while traveling back to Athkatla from Trademeet/Umar Hills/De'Arnise Keep/whatever, and the first thing my party would do after 12 hours of travel was alerting the Cowled Wizards by casting Stoneskin. So I did something that I am particularly proud of; I figured out exactly how the Cowled Wizards work (they only patrol the streets of the main district areas) and modified the script to only cast spells when it would not alert the Cowled Wizards. The script now knows which areas are patrolled, and will hold off casting arcane spells until you either get off the streets, pay the bribe, or defeat the last wave of the Cowled Wizards. After this, the arcane spellcasting toggle was no longer needed and its hotkey was re-appropriated for something else.

Another thing that I trust my script to do is cast Hold Person and Charm Person (or Animal). The script has insight into the saving throws, magic resistance and immunities of potential targets, so it is often far better qualified to cast these spells than the player. I further surrounded these spells with a bunch of checks to avoid complete overkill (such as "is it a mage?", "does the target have 100+ hit points?" and "are there at least three of them?"), and so far I have been very pleased with how the script handles these spells. Not only has it been very efficient in casting these spells only in the right situations, it even surprised me a bunch of times in fights with creatures that I expected to be immune (like Quasits) or that I thought had saving throws too high to bother disabling them.

Eventually I was sort of done, and quite pleased with the result, and I decided to share my work. Halfway through writing the ReadMe I realized that it was a right bother explaining which script was good for what (Ano for Clerics and Paladins, Jaheira for Druids, Jan/Immy for Thieves or Mages and whatnot), and I decided to integrate all six scripts into a single script. The reason I had not done so right away was that different characters needed different behavior. For instance, Immy had to keep her distance and use her bow, but Ano should tank, and there were a few things that only the main character should do. However, integrating the scripts proved a lot simpler than I feared, and after writing some more support for configurable combat style (archer, melee, etcetera) and adding a few "am I the main character?" checks it all worked wonderfully.

Around this time I also discovered that the Infinity Engine imposes horrendous penalties on characters using ranged weapons in melee. You suffer no less -8 to hit at point blank range and opponents get +4 to hit and +4 damage. It became all the more important that the party switched to melee weapons in time. I still want the party to use missile weapons at the start of an encounter, to avoid exposing enemies hidden in the fog of war and prematurely involving them in the fight. This isn't easy, since scripts can't tell whether they're using a ranged or melee weapon. Some guesswork is unavoidable.

By that time I had finished the game, but I still had a taste for scripting and decided to go through the game again with a completely different party. I had always considered Thieves to be rather underwhelming, and I had never bothered to backstab anything. So Thief it was, except of course it had to be a Kensai 13/Thief since I wanted to backstab real hard, so I took Yoshi along to see how Thieves played in the first half of Shadows of Amn while I worked on the Kensai levels. I learned a great deal about Thieves, and I am now convinced that a good backstabber (Kensai 13/Thief or Fighter/Thief multi) is disgustingly powerful. I wrote extensive support for Hide In Shadows, setting traps and later for the Staff of the Magi as well. For instance, a hidden character has to reveal himself to receive healing, and shouldn't try to hide while setting traps because it just spams up the text area.

Looking for ways to further perfect the script I noticed that many other scripts have the party pass around healing potions. This wasn't particularly important to me, but it looked like fun to script, so I did. It occasionally comes in handy, particularly in Throne of Bhaal where you can't take two steps without tripping over Potions of Extra Healing. However, those potions are super-valuable at the start of Shadows of Amn, and I didn't want the script wasting them when simple rest would have sufficed, so I made the type of potion that the script would be allowed to drink (if any) configurable.

After that I nearly ran out of stuff to do, but there were a few last characters that I never played with much, particularly Monks, Haer'Dalis and Cernd, so I started a third game. I added loads of support for Cernd, such as shapeshifting back and forth when ordered to heal, and I now consider him both easy to manage and a valuable asset. Haer'Dalis, however, is beyond redemption; Bards, and Blades in particular, require extensive micromanagement that no script is able to provide.

Various features came and went over the course of development, including autocasting Mirror Image when the Stoneskin defense failed, but that proved too clumsy. It also took me forever to get the combat styles sorted out. It is natural to want lots of configuration options, but the number of available hotkeys is rather limited and you don't want to have to press a key a dozen times to get to the desired setting. I also struggled with the level of interference that the script would be allowed. Preferably zero, but I really do want my archers to step back if they're engaged in melee, and my mages to keep their stoneskins up. Older versions were slightly more prone to interrupting the player (to the point where I would sometimes be unable to fire off the Rod of Resurrection in time), but I cut back hard on that and I believe that if the script interrupts you now, it almost certainly has a damn good reason for doing so.

And that's where I am now.

- Did you review & use precursors like eSeries, g(Series?), Kesley's, etc.?

Various flavors of gSeries, GBScript, and a few others that weren't nearly as impressive. I never heard of Kesley's. Any good?

- Any plans to incorporates spells from Divine Remix, TDD (has a few good ones, especially one for all-day buff), SpellPack, xyz?

Nope. I'm a purist, and while this may be odd coming from a modder, I just don't fancy mods. In fact, I never even installed Ascension until last week, and that actually contains some of my own work.

- From the old days, I remember concerns about long player AI scripts causing slowdown or stuttering. I'm sure you haven't seen such effects, but is there any concerns one should have if they decide to extend your script, e.g. adding new code block for buffing or etc.?

Not in the slightest. The script was written with performance in mind and is extremely efficient in what it does, but it hardly seems to matter. Nothing I did ever seemed to affect performance. Today's hardware is blazingly fast compared to that of a decade ago anyway.

#4 William Imm

William Imm

    Obsessive Penguin Lover

  • Member
  • 486 posts

Posted 20 April 2012 - 08:57 AM

About the "no angering Cowleds" component of these AI scripts - do you want to try it to support the SCSII component "Allow the Cowled Wizards to detect spellcasting in most indoor, above-ground areas in Athkatla"? I know you are not a big mod user - but can you allow your scripts to dectect that?
At this point, I'm not really doing much Baldur's Gate related. More focused on Skyrim modding and the Born of Legend tabletop roleplaying game. Don't expect much activity here.

#5 Azazello

Azazello

    The Anti-Spammer

  • Member
  • 1846 posts

Posted 20 April 2012 - 11:34 AM

Thanks very much for the responses.

Many here do not know that you're a grand-daddy of the BG community...

I first came to know of your scripting abilities from the Weimer's Tactics mod component 'Smarter Beholders'. (Which I later learned had been, ahem, modified past your original designs.) I admire your descriptions (found in the Tactics mod readme files) on how you developed that beholder AI.

After that, I learned that you were [(one of?) the persons] that recommended the Cast-and-Attack strategy in playing the game more effectively.

So I'm looking forward to playing and analyzing your newest scripts.


I have just a few extra comments--they're asides and afterthoughts, so no need to respond if you don't want to.
{I usually hate responding inline to replies but I think it fits well here...}

- Did you review & use precursors like eSeries, g(Series?), Kesley's, etc.?

Various flavors of gSeries, GBScript, and a few others that weren't nearly as impressive. I never heard of Kesley's. Any good?

All script mods are evolutionary--even yours. Kesley's AI scripts I think are extension of Weimer's Tactics mod - but I'm probably totally wrong.

In terms of which scripts are 'impressive' or not...It's before my time, but I think you were there, you remember the whole Mprilla script saga. I will NOT go there, so let's move on!...

- From the old days, I remember concerns about long player AI scripts causing slowdown or stuttering. I'm sure you haven't seen such effects, but is there any concerns one should have if they decide to extend your script, e.g. adding new code block for buffing or etc.?

Not in the slightest. The script was written with performance in mind and is extremely efficient in what it does, but it hardly seems to matter. Nothing I did ever seemed to affect performance. Today's hardware is blazingly fast compared to that of a decade ago anyway.

uhh, hmm, well... Xyx, you know better than many: What we now know is a misconception back from those earlier days-- game performance has almost nothing to do with the hardware specs, and almost everything with the way the game engine was designed--most likely due to optimization for older hardware. In fact, yet another software issue has been discovered (and partially/potentially solved), dealing with one of the best known frustrations of gameplay, formerly thought to be hardware-originated.

Lecture aside, I'm glad that you haven't seen performance issues, because I for-one plan to expand your scripts to incorporate mod-related content. Sincerely, in honor of your contribution!

- Any plans to incorporates spells from Divine Remix, TDD (has a few good ones, especially one for all-day buff), SpellPack, xyz?

Nope. I'm a purist, and while this may be odd coming from a modder, I just don't fancy mods.

I personally think this is a good stance to take for this kind of mod, scripts, because it'll make troubleshooting, and testing custom changes, easier.

I hope you're not as strict about custom modifications done purely within a player's own gaming environment -- especially if documented properly. Some of us like to expand and tinker with existing mods, and we discover some interesting perspectives.

Eventually, I plan to incorporate various mod-related content like spells, and see what the outcome is.

#6 Xyx

Xyx
  • Member
  • 73 posts

Posted 20 April 2012 - 01:59 PM

About the "no angering Cowleds" component of these AI scripts - do you want to try it to support the SCSII component "Allow the Cowled Wizards to detect spellcasting in most indoor, above-ground areas in Athkatla"? I know you are not a big mod user - but can you allow your scripts to dectect that?

If I were to support any mod at all, I'd have to install it, figure out how it works, and then write support for it and make sure the script still works without that particular mod installed. That sounds like an awful lot of trouble, so no, I do not want to try. However, if you're interested in doing the work yourself, I'd be happy to explain how the Cowled Wizard detection works in my script. I suspect it's just a matter of copy/pasting around a ginormous list of area checks.

you remember the whole Mprilla script saga. I will NOT go there, so let's move on!...

Oh, the memories! I had a quick google the other day for old times' sake, but it seems it really ended when it ended. Undoubtedly for the better, despite the exceedingly high entertainment value.

uhh, hmm, well... Xyx, you know better than many: What we now know is a misconception back from those earlier days-- game performance has almost nothing to do with the hardware specs, and almost everything with the way the game engine was designed--most likely due to optimization for older hardware.

Consider me lectured. Just 'cuz I is oldskool does not mean I knows all. Nevertheless, I played through Shadows of Amn 2.5 times and Throne of Bhaal 1.5 times with this script and noticed absolutely no slowdown.

I for-one plan to expand your scripts to incorporate mod-related content. Sincerely, in honor of your contribution!

I'm honored! I'd be happy to explain anything I wrote. I don't use mods myself (other than fixes and the occasional cosmetic tweak), but that doesn't make them any less awesome.

#7 William Imm

William Imm

    Obsessive Penguin Lover

  • Member
  • 486 posts

Posted 20 April 2012 - 02:32 PM


About the "no angering Cowleds" component of these AI scripts - do you want to try it to support the SCSII component "Allow the Cowled Wizards to detect spellcasting in most indoor, above-ground areas in Athkatla"? I know you are not a big mod user - but can you allow your scripts to dectect that?

If I were to support any mod at all, I'd have to install it, figure out how it works, and then write support for it and make sure the script still works without that particular mod installed. That sounds like an awful lot of trouble, so no, I do not want to try. However, if you're interested in doing the work yourself, I'd be happy to explain how the Cowled Wizard detection works in my script. I suspect it's just a matter of copy/pasting around a ginormous list of area checks.


SCSII = Sword Coast Stratagems II - a AI enhancement and tweak mod for BG2. I can modify your scripts to avoid angering the wizards in the modified areas in SCSII. A quick WeiDU component check can determine which script is used.

Still, "This is the best BG2 script in existance." Yes, I know I lifted one of Mprilla's lines, but it's quite a honest description of your work.
At this point, I'm not really doing much Baldur's Gate related. More focused on Skyrim modding and the Born of Legend tabletop roleplaying game. Don't expect much activity here.

#8 William Imm

William Imm

    Obsessive Penguin Lover

  • Member
  • 486 posts

Posted 20 April 2012 - 06:33 PM

Here's a modified version of your script that (hopefully) should be able to work - I did lump the Cowled Wizards check for each buff in one big one - if that's something I should avoid, let me know.

BTW - some mods (like Item Revisions) remove the invisiblity power of the Staff of the Magi - do you want to adjust your scripts for that?

OT: if you want to help me with a personal resurection project of a old subrace mod, that would be very helpful.

Attached Files


At this point, I'm not really doing much Baldur's Gate related. More focused on Skyrim modding and the Born of Legend tabletop roleplaying game. Don't expect much activity here.

#9 Xyx

Xyx
  • Member
  • 73 posts

Posted 21 April 2012 - 08:26 AM

Here's a modified version of your script that (hopefully) should be able to work - I did lump the Cowled Wizards check for each buff in one big one - if that's something I should avoid, let me know.

That won't work. You basically have this:

OR(2)
    not in area 1
    not in area 2

This OR statement is always true, since nobody can be in two areas at once. That's why the Cowled Wizards check needs five lines per area. However, with a list that long, it'd be more expedient to split the block in two; one for "unpatrolled" areas (not area 1, not area 2, etcetera), followed by one for the rest (the patrolled areas.)

some mods (like Item Revisions) remove the invisiblity power of the Staff of the Magi - do you want to adjust your scripts for that?

I don't really want to adjust my script for anything. Besides, the only thing that would break should be the Staff of the Magi style, so that should hardly be a problem.

If other modders want to adjust my script to work with their mod, then they're free to do so provided that they don't put the reputation of my work at risk. That means...
  • Testing their work to make sure that they aren't introducing any bugs, and taking full responsibility for any bugs that slip through. If the bug turns out to be mine after all, I want to know about it.
  • The modded script is distributed only as explicitly part of the mod. I wouldn't want anyone to mistakenly use the modded script in an unmodded game.
It'd also be nice if they let me know about it. Of course, if anyone wishes to modify the script for personal use only, then none of this applies.

if you want to help me with a personal resurection project of a old subrace mod, that would be very helpful.

I respectfully decline.

#10 William Imm

William Imm

    Obsessive Penguin Lover

  • Member
  • 486 posts

Posted 21 April 2012 - 09:16 AM


Here's a modified version of your script that (hopefully) should be able to work - I did lump the Cowled Wizards check for each buff in one big one - if that's something I should avoid, let me know.

That won't work. You basically have this:

OR(2)
	not in area 1
	not in area 2

This OR statement is always true, since nobody can be in two areas at once. That's why the Cowled Wizards check needs five lines per area. However, with a list that long, it'd be more expedient to split the block in two; one for "unpatrolled" areas (not area 1, not area 2, etcetera), followed by one for the rest (the patrolled areas.)

Here's my attempt at fixing the problem by adding a new local variable, W!NoCowled. (W! is my modder tag if you are curious)

Attached Files


Edited by William Imm, 21 April 2012 - 09:16 AM.

At this point, I'm not really doing much Baldur's Gate related. More focused on Skyrim modding and the Born of Legend tabletop roleplaying game. Don't expect much activity here.

#11 Xyx

Xyx
  • Member
  • 73 posts

Posted 21 April 2012 - 02:11 PM

Here's my attempt at fixing the problem by adding a new local variable, W!NoCowled.

I haven't tried it out, but it looks like this breaks the script. You added a block with a True() trigger and no Continue() action. The script will never execute past that.

Even if you added Continue(), I'm not a huge fan of this approach. You're trying to set a variable, but the script can't read variables that were set in the same script run. The script wouldn't see the variable updated to 1 until the next script run, which would be right after your mage casts Stoneskin upon traveling back to Athkatla.

If you wish to try again, make sure you test your solution before posting it. Go to the Druid Grove (or some other area that's at least 12 hours away from Athkatla), memorize several Stoneskins, then travel to Athkatla. The journey should take long enough to wear off your skins and trigger a recast.

If you're serious about scripting, you may want to check out the comments at the bottom of the script. There's a lot of documentation about the workings of the scripting engine there that I didn't see anywhere else.

#12 William Imm

William Imm

    Obsessive Penguin Lover

  • Member
  • 486 posts

Posted 21 April 2012 - 02:45 PM

God, IE scripting is more complicated than I thought - I admit, I've been trying to use Ding0's guide on spring and your advice..
At this point, I'm not really doing much Baldur's Gate related. More focused on Skyrim modding and the Born of Legend tabletop roleplaying game. Don't expect much activity here.

#13 Xyx

Xyx
  • Member
  • 73 posts

Posted 21 April 2012 - 03:19 PM

It can be quite obscure at times. The most important thing, in my experience, is to actually try stuff out to verify things. I wrote dozens of tiny scripts over the course of development, testing all sorts of stuff, often using DisplayStringHead() to show which blocks get executed. You probably noticed that my script is full of //DisplayStringHead() lines. Those were all used in testing.

#14 William Imm

William Imm

    Obsessive Penguin Lover

  • Member
  • 486 posts

Posted 21 April 2012 - 04:02 PM

I see. Do you know the best way to handle this situation?
At this point, I'm not really doing much Baldur's Gate related. More focused on Skyrim modding and the Born of Legend tabletop roleplaying game. Don't expect much activity here.

#15 Xyx

Xyx
  • Member
  • 73 posts

Posted 22 April 2012 - 12:43 AM

Paraphrasing...

// Stoneskin - Unpatrolled areas.
IF
	I want to cast Stoneskin
	I could cast Stoneskin
	I'm not in area 1
	I'm not in area 2
	I'm not in area 3
	Etcetera
THEN
	RESPONSE #100
		Cast Stoneskin
END

// Stoneskin - Patrolled areas.
IF
	I want to cast Stoneskin
	I could cast Stoneskin (but I didn't do it in the block above, so I must be in a patrolled area)
	OR(3)
		I beat the Cowled Wizards
		I paid the bribe
		I'm currently fighting the Cowled Wizards
THEN
	RESPONSE #100
		Cast Stoneskin
END


#16 William Imm

William Imm

    Obsessive Penguin Lover

  • Member
  • 486 posts

Posted 22 April 2012 - 06:23 AM

Here is a script that hopefully should not anger the Cowled Wizards.

Attached Files


At this point, I'm not really doing much Baldur's Gate related. More focused on Skyrim modding and the Born of Legend tabletop roleplaying game. Don't expect much activity here.

#17 Xyx

Xyx
  • Member
  • 73 posts

Posted 22 April 2012 - 01:08 PM

Yes, that looks fine. Mind that I haven't actually tried it. That's your job, and I assume you have SCSII installed.

I generally try to put the triggers that are most likely to fail near the top of the block. That way the script is less likely to waste time evaluating. For example, compare...

IF
	Ridiculously CPU-intensive calculation
	False()
THEN
	RESPONSE #100
		Blah
END

...to...

IF
	False()
	Ridiculously CPU-intensive calculation
THEN
	RESPONSE #100
		Blah
END

The first block wastes performance, the second does not.

In your case, I'm specifically referring to the initial Stoneskin block where you check the list of areas before checking more likely "disqualifiers" such as the alacrity timer.

Not that I think anyone would notice the difference anyway, mind you, but it's good practice to stay aware of these matters.

Note that all this assumes that the scripting engine is actually set up to avoid wasting performance like this. The way it handles targeting blocks leads me to suspect that it does, but that's not an actual guarantee.

#18 William Imm

William Imm

    Obsessive Penguin Lover

  • Member
  • 486 posts

Posted 22 April 2012 - 04:05 PM

Yes, that looks fine. Mind that I haven't actually tried it. That's your job, and I assume you have SCSII installed.

I generally try to put the triggers that are most likely to fail near the top of the block. That way the script is less likely to waste time evaluating. For example, compare...

IF
	Ridiculously CPU-intensive calculation
	False()
THEN
	RESPONSE #100
		Blah
END

...to...

IF
	False()
	Ridiculously CPU-intensive calculation
THEN
	RESPONSE #100
		Blah
END

The first block wastes performance, the second does not.

In your case, I'm specifically referring to the initial Stoneskin block where you check the list of areas before checking more likely "disqualifiers" such as the alacrity timer.

Not that I think anyone would notice the difference anyway, mind you, but it's good practice to stay aware of these matters.

Note that all this assumes that the scripting engine is actually set up to avoid wasting performance like this. The way it handles targeting blocks leads me to suspect that it does, but that's not an actual guarantee.

Did that in a new update.

Attached Files


At this point, I'm not really doing much Baldur's Gate related. More focused on Skyrim modding and the Born of Legend tabletop roleplaying game. Don't expect much activity here.

#19 FredSRichardson

FredSRichardson

    WeiDU Meddler

  • Member
  • 257 posts

Posted 03 July 2012 - 06:45 PM

Hey Xyx!

Wow, it's great to see you doing BG2 modding again! I too am deeply nostalgic and picked up BG2 again after quite a long time. It might have been the Baldur's Gate Enhanced Edition announcement that got me geared (BG2 on an iPad, Hmmm...)

-Fred
I gotta get rid of this friggin idiotic signature...

#20 -mbrowne-

-mbrowne-
  • Guest

Posted 04 October 2014 - 04:36 PM

Thanks for the great script.  It worked great for my BG1 Tutu game, but did not work when I imported the chars into BG2/TOB.  It does work fine for new chars created in BG2.  Any idea why imported chars would be a problem?  It seems to be only the casting that's broken.  Thanks.