Jump to content


Photo

Question about battles


  • Please log in to reply
21 replies to this topic

#1 Zwolf

Zwolf
  • Member
  • 13 posts

Posted 17 July 2009 - 08:47 AM

Is it possible to change the game in a way the characters don't take 3 seconds before they decide to move when the player give them an attack order and they get stuck in another character?
Any way to improve the AI also? At the moment the only thing the basic AI seems to do is engaging the characters in counterattacking when they are attacked.

Edited by Zwolf, 17 July 2009 - 08:48 AM.


#2 Displacer

Displacer
  • Member
  • 42 posts

Posted 17 July 2009 - 10:41 AM

Is it possible to change the game in a way the characters don't take 3 seconds before they decide to move when the player give them an attack order and they get stuck in another character?
Any way to improve the AI also? At the moment the only thing the basic AI seems to do is engaging the characters in counterattacking when they are attacked.


I was about to post about the party AI. Most party scripts do just that, counterattack. They are 1 or 2 lines long. One exception is Grace's script which was fleshed out better to make use of healing. Unfortunately her script is flawed, as you no doubt find out in a major battle. The reason is that her healing commands are backwards. She is set to heal the least injured party member with the least powerful healing spell first, so she usually runs into battle at the slightest scratch trying to heal, which really mucks things up. I rewrote her script so she now goes after the most injured first with the most powerful healing spells. She will also cast bless at the start of every battle, and go into combat if she is not healing, or a player needs help.

Anyway I was going to ask if this would be considered a fix, or a tweak and then upload it. I haven't worked on any other party members scripts, as I usually find its better to control them yourself, but if asked I could probably come up with a full set.
Decimal is for the weak

#3 nevill

nevill
  • Member
  • 87 posts

Posted 17 July 2009 - 10:54 AM

You might want to check this up first.

#4 Displacer

Displacer
  • Member
  • 42 posts

Posted 17 July 2009 - 06:33 PM

You might want to check this up first.


Yes, I've seen that. What I want to do is more of a fix, as it is just for Grace's script, and it puts things in the proper order.
Decimal is for the weak

#5 nevill

nevill
  • Member
  • 87 posts

Posted 17 July 2009 - 11:15 PM

Cool. Maybe you'd want to look into the part which is responsible for running away when injured. Sometimes it doesn't work properly and sometimes the characters just slowly walk away, getting slaughtered in the process.

At the moment the only thing the basic AI seems to do is engaging the characters in counterattacking when they are attacked.

I found it useful when the script tried to change targets when the current enemy is down. Less pausing, less work for me. Now, if only my characters attacked first...

#6 Zwolf

Zwolf
  • Member
  • 13 posts

Posted 17 July 2009 - 11:23 PM

I won't go on using this as the only thing I really expect is the NPC react faster than in 3 seconds when they collide in something and auto attack when they are attacked but also when other team characters are attacked. Don't really want they cast special abilities and spells by themselves.

I didn't noticed the problem with Fall-for-Grace as I never play with her (I can't stand her horrible haircut). Always go for morte-dakkon-annah-vhailor team, I like to be the only pure spell caster of the group.

Totally out of subject but I'm really disappointed by Annah last word when I resurrect her at the end. So Fall-For-Grace gonna search me to Bator but Annah can't say anything interesting? Pitiful tiefflin I'd better let her dead.
This game really miss a sequel, the Blood War would be a fantastic campaign setting for any RPG. This annoying prime plane we explore in all other AD&D RPG is so conventional...

Edited by Zwolf, 17 July 2009 - 11:33 PM.


#7 Qwinn

Qwinn
  • Modder
  • 3092 posts

Posted 17 July 2009 - 11:28 PM

I dunno, Displacer. I agree that the order you want to put the heals in is probably more useful a majority of the time, but that's still an AI improvement in my mind, rather than a fix. Someone could prefer the way it stands because they want to conserve the bigger heals for manual use. If you found something like "it uses bigger heals for less wounded characters, and lesser heals on more wounded", then I'd agree that's a fix. But the way it stands just makes Grace use her smallest heals before her bigger heals, but it still targets the most damaged party member first. That is, I think, a matter of preference rather than a "bigger heals first, otherwise it's broken".

I'm okay with letting the G3 AI improvement tweak stand as the go-to mod for folks who want improved AI.

Qwinn

#8 Qwinn

Qwinn
  • Modder
  • 3092 posts

Posted 17 July 2009 - 11:30 PM

Now this other issue, of PC's reacting too slowly... that would essentially mean applying the RunningAttack fix to the PC AI scripts. I don't have a problem with that as a fix... if I'm making the opposing critters run, then your party's AI should be able to do that too.

I'm gonna have to check out that G3 AI mod and see if anything I'm doing would cause incompatibility.

Qwinn

#9 Qwinn

Qwinn
  • Modder
  • 3092 posts

Posted 17 July 2009 - 11:55 PM

Wow, okay, yeah, that tseries AI mod will seriously screw my mods up if it is installed after my mods. It'll deactivate banters and Morte's flirts in the mortuary. It -may- work okay if installed before my mods. This is because that mod simply overwrites the AI scripts, and those parts of my mods add to them.

The author states that he's okay with the mod being modified and redistributed if he and the guy he borrowed 'em from get credit, which I'm perfectly okay with. So, when I get some time (I'm deep in TBH atm), I will see about rewriting them to be compatible with my mods, and offer 'em as part of the tweak pack, with full credit given.

Qwinn

#10 Yovaneth

Yovaneth

    The newly-appointed Master Builder of Baldur's Gate

  • Modder
  • 3058 posts

Posted 18 July 2009 - 03:42 AM

If you install and patch PS:T, then install the tseries, then add your patches and fixpacks, it will all work okay (unless something in your append conflicts with anything in the tseries). When Cirerrek first built the tseries there was no need to (and no ability!) to append or extend scripts via Weidu - actually, there was no Weidu. As there is no ability to attach a particular script to a character as was provided in later versions of the Infinity Engine, overwrite was our only choice. And I don't need to tell you about the problems of scripting the PS:T IE!!! :devil:

-Y-

#11 Displacer

Displacer
  • Member
  • 42 posts

Posted 18 July 2009 - 04:50 AM

I dunno, Displacer. I agree that the order you want to put the heals in is probably more useful a majority of the time, but that's still an AI improvement in my mind, rather than a fix. Someone could prefer the way it stands because they want to conserve the bigger heals for manual use. If you found something like "it uses bigger heals for less wounded characters, and lesser heals on more wounded", then I'd agree that's a fix. But the way it stands just makes Grace use her smallest heals before her bigger heals, but it still targets the most damaged party member first. That is, I think, a matter of preference rather than a "bigger heals first, otherwise it's broken".

I'm okay with letting the G3 AI improvement tweak stand as the go-to mod for folks who want improved AI.

Qwinn


Like I said I didn't know if it would be considered a tweak or a fix. The healing problem wouldn't apply as you stated, the most powerful spells would not be used until the intended target would fall below 25 hit points, which is the way it was originally scripted. The problem was she went after the least injured first with the least powerful spells, which caused the badly hurt to die while she was fussing with the people with scratches. I just reversed the order so she now checks for badly injured PC's and tends to them first, but only using the powerful spells when they were below a certain number of hit points. I only added 2 things, the casting of bless at the start of combat, and resurrecting PC's at the very end of the script if they were killed. Other than that I just put the existing lines of code in the order they should have been in the first place. Another problem was she would run in to heal even as an enemy was chopping her to bits because the action to attack anyone that was attacking her was at the bottom, so she would go through the entire healing process of all PC's before she would defend herself. Again reversing the order brought this to the top making self preservation the top priority. I suppose if you removed the 2 things I added it would be a fix, leaving them in would be a tweak.
Decimal is for the weak

#12 Displacer

Displacer
  • Member
  • 42 posts

Posted 18 July 2009 - 06:00 AM

Thought of a better way to explain why the original script is wrong, these are not actual scripting commands, just using them for clarity.

Using Grace's original script we have:

If see someone with less than 90% hit points
cast cure light wounds

If see someone with less than 10% hit points
cast heal

if being attacked
fight back

Now the nature of scripts is if a block is executed, the script restarts from the top.

Now Nameless and Grace are in a fight. Someone is attacking nameless and he gets hit hard and knocks him down to 9% hit points. Grace's script fires at this point and the first block is executed. He is obviously below 90% so she runs over and casts cure light wounds and the script restarts. He is still less than 90% so she casts cure light wounds again. At this point someone attacks her, but since nameless is still below 90% she continues to cast cure light wounds until she runs out of them ignoring the attacker who is stabbing her to death. If nameless survives, and if she survives until she runs out of cure light wounds then she will cast heal, and lastly fight back. This is how the script in the vanilla game works.

Now if you reverse the order to:

if being attacked
fight back

If see someone with less than 10% hit points
cast heal

If see someone with less than 90% hit points
cast cure light wounds

she will see nameless is less than 10% hit points and cast heal, and then cure light wounds to bring him to full health. When she is attacked she will fight back instead of healing while she is being hacked to pieces, and if nameless has only a scratch she will not cast heal, but cast the appropriate cure light wounds.
Decimal is for the weak

#13 Qwinn

Qwinn
  • Modder
  • 3092 posts

Posted 18 July 2009 - 02:59 PM

I think her healing while under attack is more in-character and more useful. Grace's attack is puny (1-3, I believe), and she can't hit anything that requires +1 weapons or better to hit, which later in the game is just about everything. There is nothing more useless she can do than attack physically, and if healing sends her running from her attackers even for a moment, that's a good thing. It should be at the bottom of her script - a last act of desperation after she's used up all her other spells. Because that's about all her attacks are good for.

The problem was she went after the least injured first with the least powerful spells, which caused the badly hurt to die while she was fussing with the people with scratches.


I do not believe this is the case. She will heal the -most- injured first with the least powerful spells. Yes, she will use Cure Light Wounds until she runs out of them, but she will target the most injured party member first, whether they are at 80% health or 9% health. This is most obvious when there's two roughly equally wounded party members... she runs back and forth between them casting a CLW on one, then the other, back and forth. This is because she does recognize who between the two is most injured.

Qwinn

Edited by Qwinn, 18 July 2009 - 03:37 PM.


#14 Displacer

Displacer
  • Member
  • 42 posts

Posted 18 July 2009 - 04:05 PM

I think her healing while under attack is more in-character and more useful. Grace's attack is puny (1-3, I believe), and she can't hit anything that requires +1 weapons or better to hit, which later in the game is just about everything. There is nothing more useless she can do than attack physically, and if healing sends her running from her attackers even for a moment, that's a good thing. It should be at the bottom of her script - a last act of desperation after she's used up all her other spells. Because that's about all her attacks are good for.

The problem was she went after the least injured first with the least powerful spells, which caused the badly hurt to die while she was fussing with the people with scratches.


I do not believe this is the case. She will heal the -most- injured first with the least powerful spells. Yes, she will use Cure Light Wounds until she runs out of them, but she will target the most injured party member first, whether they are at 80% health or 9% health. This is most obvious when there's two roughly equally wounded party members... she runs back and forth between them casting a CLW on one, then the other, back and forth. This is because she does recognize who between the two is most injured.

Qwinn


Nope, the way the unaltered script is set up is she will target the first PC with less than 75% Hit Points, this could be 74% or 1%. If luck is on your side she will grab the most injured, but most of the time it will be the least injured. With the script in the proper order she will pick the most injured first every time and use the proper spell for the amount of damage that the character has as follows:

>10% Heal
>25% Cure Critical Wounds
>45% Cure Serious Wounds
>65% Cure Moderate Wounds
>75% Cure Light Wounds

So she would scan for anyone with less than 10% first. If none were found she would look for anyone with less than 25%, and so on until she got a match and then would use that spell on that PC.

The attack is debatable, it could probably go at the beginning or end, but the only way the healing is efficient, and even makes sense is the reverse of her default script. Standing there healing a few hit points at a time on someone who is only a few hit points above death while they have more powerful spells at their disposal is clearly not the way to go. Another problem with her script is she reacts to Nameless if he uses help(). Her reaction is to run to his aid but the way it was set up there was no distance specified, so if he was on the other side of the map and issued help, she would run across the entire map to wherever he was. I also set a limit on how far away she would respond to help.
Decimal is for the weak

#15 Qwinn

Qwinn
  • Modder
  • 3092 posts

Posted 18 July 2009 - 04:27 PM

Nope, the way the unaltered script is set up is she will target the first PC with less than 75% Hit Points, this could be 74% or 1%.


I interrupted my work to test this in game. You are incorrect. She will -invariably- target the more damaged PC with her Cure Light Wounds first. Whether the more injured is further away or closer. Whether the more injured is higher up on the party list or lower.

Please, seriously, test this in game yourself. It works. Turn Party AI off. Damage Annah down to around 20%, and Dak'kon to around 60%. Stand Annah farther away than Dak'kon from Grace. Turn Party AI on. She'll run right by Dak'kon and heal Annah first. Eventually, Annah will reach 61%+, at which point Grace will turn and heal Dak'kon until he's got more HP than Annah. Then she'll heal Annah again. Than Dak'kon again. Then Annah again. Because each heal changes who is the most damaged.

Then test the reverse. Heal everybody back up. Turn Party AI off. Damage Annah to 60% and Dak'kon to 20%. Turn Party AI back on, and watch what actually happens.

I'm not sure why you are arguing this so strenuously. Look at the script block:

IF
InParty(Myself)
Global("PartyScriptsActive","GLOBAL",1)
Global("CombatScriptsActive","GLOBAL",1)
HPPercentLT(MostDamagedOf(Myself),75)
HaveSpell(CLERIC_CURE_LIGHT_WOUNDS)
THEN
RESPONSE #100
Spell(MostDamagedOf(Myself),CLERIC_CURE_LIGHT_WOUNDS)
END


The command that selects her target is actually named MostDamagedOf. What makes you think it's targeting based on anything else?

I'm not saying that your reversing the order doesn't make her healing more -efficient-. I suspect in most cases it indeed would be. But your contention that she ignores more damaged party members in order to heal other party members with scratches is simply incorrect.

Qwinn

Edited by Qwinn, 18 July 2009 - 04:34 PM.


#16 Qwinn

Qwinn
  • Modder
  • 3092 posts

Posted 18 July 2009 - 04:39 PM

Looking at her original script some more, she actually DOES defend herself before healing. Unfortunately. Or at least the script is set up to do so, not sure if that first block will always work (the object [ENEMY] is rarely used), but that does seem to be the intent.

As for her crossing the area to help TNO when he calls for help, no, she doesn't. One of the triggers is Range(Player1,6). That means he has to be quite close for her to respond with that trigger block, and seeing as it's at the bottom, she'd have to have nothing to heal in order for her to actually do so.

Something you may not be aware of when reading these scripts: the script is run repeatedly. When it finds a block that it can actually run based on the triggers, it executes that block and then, unless it ends with the line "Continue()" (which the AI scripts don't), it restarts the script from the top. So as long as the Cure Light Wounds block triggers and runs, it doesn't keep going down the script, it starts back up from the top and will never hit the Moderate or Heal or "oh noes TNO called for help" blocks. The only way it'll ever progress beyond the Cure Light Wounds block is if no one is hurt below 75% or if she simply runs out of Cure Light Wounds spells.

Qwinn

Edited by Qwinn, 18 July 2009 - 04:48 PM.


#17 Displacer

Displacer
  • Member
  • 42 posts

Posted 18 July 2009 - 05:15 PM

Looking at her original script some more, she actually DOES defend herself before healing. Unfortunately. Or at least the script is set up to do so, not sure if that first block will always work (the object [ENEMY] is rarely used), but that does seem to be the intent.

As for her crossing the area to help TNO when he calls for help, no, she doesn't. One of the triggers is Range(Player1,6). That means he has to be quite close for her to respond with that trigger block, and seeing as it's at the bottom, she'd have to have nothing to heal in order for her to actually do so.

Something you may not be aware of when reading these scripts: the script is run repeatedly. When it finds a block that it can actually run based on the triggers, it executes that block and then, unless it ends with the line "Continue()" (which the AI scripts don't), it restarts the script from the top. So as long as the Cure Light Wounds block triggers and runs, it doesn't keep going down the script, it starts back up from the top and will never hit the Moderate or Heal or "oh noes TNO called for help" blocks. The only way it'll ever progress beyond the Cure Light Wounds block is if no one is hurt below 75% or if she simply runs out of Cure Light Wounds spells.

Qwinn


Ok, first I'm not trying to argue, or trying to make out like I'm right and the rest of the world is wrong, and if my argument comes of as too strong then I apologize.

That being said you are correct on the MostDamagedOf, I missed that apparently, but it doesn't change the fact that using cure light wounds on someone who is near death when you have access to heal is just plain wrong, and not the way to do things. The healing portion of the script is backwards, now whether or not this is a bug I guess is a matter of opinion.

I know completely about how the script is run, that was one of my arguments. I believe I stated a few posts back this is why she will cast cure light wounds until she runs out, even if she has a heal spell. Reversing the order will cause the spells to be used on the injured in the proper way, matching the spell to the amount of injury. If heal is not needed it falls through to the next spell without restarting, if that one is not needed then if falls through again, etc. The way it stands now is it will always use the least powerful spells on the most injured first.

Again Its not my intention to have a argument about this, I guess its technically my opinion about her script. If you like I can send you the new one and you can make your own decisions.
Decimal is for the weak

#18 Qwinn

Qwinn
  • Modder
  • 3092 posts

Posted 18 July 2009 - 05:24 PM

No worries. I'm not trying to argue anything with you in terms of opinion - in fact, I -do- agree with the opinion that reversing the blocks will, in most cases, lead to more -efficient- healing.

But the point of whether she might ignore more damaged party members in order to heal less damaged ones wasn't a matter of opinion, nor was it trivial. It's a matter of hard fact, and it was important to get it settled. If that really -had- been the case, then I would be pretty open to the notion that what we're talking about here would legitimately be a fix, not a tweak or matter of preference.

But it's not the case. She does heal the most damaged first. Is it more efficient to use her bigger heals first? Quite probably. On the other hand, I've often been pretty happy with the result... she throws her lighter heals around, but she saves her biggest heals for me to use manually or in case of dire emergency.

What you suggest will be more efficient healing over the short term, certainly, and might save a party member who would otherwise die earlier on... but quite often, the CLW's will suffice to keep everyone up, and then her script as it is will actually let her hold on to her bigger heals longer than otherwise, for really dire emergencies or manual use, and keep her useful somewhat longer before she -has- to rest.

So it's a matter of opinion and preference, I'd say, and doesn't constitute a fix. As a tweak, sure - anything that's a preference can be tweaked - but if someone's looking for really intelligent AI, shouldn't we go with something like the tseries?

Qwinn

Edited by Qwinn, 18 July 2009 - 05:25 PM.


#19 Qwinn

Qwinn
  • Modder
  • 3092 posts

Posted 18 July 2009 - 05:55 PM

Here, tell you what.

I'm currently thinking that I'll wind up devising my own set of AI scripts for my tweak pack. I'll go over the tseries and see what I can glean of use from them (and give credit, of course), but overall I think the tseries AI might be a bit TOO intelligent. As in, they'll use up items (which I personally wouldn't want), and spells, and so forth. I would be more inclined to want to use simpler AI scripts. Ones that let me control the big things, but take care of the details that PC's should be smart enough to do on their own.

One thing I'd add would be for PC's to flee when severely damaged. And I'd also reverse the healing blocks in Grace's script as you suggest. What else I would add, I'm not sure yet. I'll see what I like in tseries, and I'm happy to take other suggestions as well.

In terms of the original post of this thread: I will add the RunningAttack() fix in the Fixpack, so PC's shouldn't freeze for seconds when they run into something in combat and walk around everywhere. If I'm holding that enemies should be smart enough to run in combat as a fix, that logic certainly has to apply to party PC's as well.

For now, though, I really need to get back to work on TBH.

Qwinn

Edited by Qwinn, 18 July 2009 - 05:58 PM.


#20 Qwinn

Qwinn
  • Modder
  • 3092 posts

Posted 18 July 2009 - 06:05 PM

BTW, didn't mean to ignore your post, Yovaneth. The tseries scripts actually predate WeiDU? Wow. Scary to think that anything predates WeiDU :D

Totally understood as to why it just replaces scripts then. And yeah, I agree that it -should- work if you install it prior to the Fixpack, or at least prior to UB/Tweak. It includes a fix to Annah's Buried Village script that my Fixpack already fixes, dunno if there'd be a conflict there, but overall it should work okay.

As I said, though, I think I will make my own set of scripts that aren't quite as comprehensive, just having them flee and improve the short term healing efficiency as Displacer would like, maybe some other minor things like buffing with strength spells (which last a LONG time). I'll look through tseries for any other good ideas that would be appropriate in a simpler AI.

Anyways, now back to work, srsly.

Qwinn

EDIT: Urf, no, they might actually not work even if you install 'em beforehand, though I should be able to fix that for the next version.

Edited by Qwinn, 18 July 2009 - 06:10 PM.