Please note that new user registrations disabled at this time.

Smart Beholders now available!

This forum is to be used for all discussions pertaining to BioWare's Baldur's Gate II: Shadows of Amn.
User avatar
Xyx
Posts: 3104
Joined: Mon Jun 04, 2001 10:00 pm
Location: The Netherlands
Contact:

Post by Xyx »

Originally posted by spork:
<STRONG>Is anyone thinking about a way to fix the dumb "chase the nearest party member in circles while the rest of the party pumps you full of arrows" behavior?</STRONG>
That, too, has been a part of this discussion. :) And is next in line, as far as I am concerned. I'll try my hand at modifying some of the most basic default scripts that are used by nearly all enemies. The problem, however, is that enemies with more complicated scripts (that would be anything with any kind of special power, such as spellcasting) derrive their actions from the scripts that deal with those powers instead... In short, that means that probably only the really dumb enemies will benefit.
Originally posted by Catcher:
<STRONG>*Wish I knew how to grab those quote things :o *</STRONG>
Try the quote-shaped thingy next to the 'edit post' and 'private message' icons. :)
Originally posted by Catcher:
<STRONG>they were not, to the best of my knowledge charmed.</STRONG>
I'll have a look into it. The Power Word spells need fixing as well, so there will be an update soon anyway.
[url="http://www.sorcerers.net/Games/BG2/SpellsReference/Main.htm"]Baldur's Gate 2 Spells Reference[/url]: Strategy, tips, tricks, bugs, cheese and corrections to the manual.
User avatar
spork
Posts: 78
Joined: Sun Jul 08, 2001 10:00 pm
Location: New York, USA
Contact:

Post by spork »

Xyx, I'm very happy you're working on this. I spent the last two days playing with scripts, but I made no real progress. You probably would know: Do scripts compiled for BG2 works exactly the same way in ToB? Maybe my own scripts just suck (well, no--I know they do) so it's no surprise they don't do what they're supposed to. But even the character scripts written by Bioware don't work right. For example, the "fighter2" script designed for rangers never does the switch to a ranged weapon, even when I have one in my weapons slot. In general, all the scripts work sporadically.

I've read all the docs that come with the program and looked at a couple of actual scripts (including yours, which are very nice). What I need now a scripting HowTo. Do you know of one?

I am especially interested in combat scripts (smart choice of weapons, smart targetting, scripted party attack coordination and smart retreating). Because the conditionals in these scripts don't allow nesting I started playing with the idea of using scripts to call other scripts, but there are still some basics that I don't quite get, so I won't produce anything fancy soon.

Any advice would be useful. Also, Xyx and other people can probably do this in a minute; I guess I'm too dumb to get something even this simple to work correctly:

My main fighter has two weapons in his w. slots: the Axe of the Unyielding (AX1H15) and K'logarath +4 (AX1H16). The latter is a throwing axe so it's a ranged weapon. Here's the script that I can't seem to be able to write:

When I see an enemy I attack with K'logarath (which may or may not have been equipped when the enemy was first seen), and keep attacking with it as long as there is no enemy within range 5. If there is, I switch to the other axe and attack the nearest enemy in melee.

This should be a very easy script, but I can't get the EquipRanged() command to switch to the throwing axe. EquipMostDamagingMelee() does correctly switch to the vorpal axe.

Sorry for all the dumb questions,

spork
User avatar
spork
Posts: 78
Joined: Sun Jul 08, 2001 10:00 pm
Location: New York, USA
Contact:

Post by spork »

OK, I got my simple melee/ranged switching script to work, not by referring to the weapons themselves, or their role (melee/ranged) but rather the slot which they occupy. So to get the throwing axe in slot0 to work right I did:

SelectWeaponAbility(SLOT_WEAPON0,RANGED)

and it works now.

Hooray, I win the special olympics scripter's medal, right! :rolleyes: No, but seriously, this behavior would be useful in monsters too. I know not all have ranged weapons, but in the case of my script, if I don't have a ranged weapon in a slot it just attacks with what I do have, so at worst the monsters will do what they do now.

I also noticed that Xyx's scripts don't have deterministic reactions to certain situations (for example, a kobold might melee but every few seconds there is a chance it will flee.) This sort if indeterminacy alone, it it were implemented more globally, would make cheesy combat more difficult. For example, there should always be a 20% chance that a monster will not Attack(NearestEnemy) but instead change to Attack(SecondNearestEnemy), or, maybe even better, Attack(MostDamagedEnemy) (I know that's not a command). ;)

I also think it should not attack, or at least be less likely to attack, party members who are not targetting it or one of its friends. This way it wouldn't chase after decoys. About the problem of changing its mind too quickly about whom to attack, maybe the right command is

AttackReevaluate(LastAttackerOf(Myself),30)

This means, if I understand it right, that it would attack whomever filled that condition for 30 seconds. Well, I can already see problems with this, but hey, what do you expect from a guy who taught himself scripting yesterday?

By the way, Xyx, it's all because of some of the stuff you posted that I started messing around with scripts in the first place! You and your smart Beholders!
:mad: ;)
User avatar
Xyx
Posts: 3104
Joined: Mon Jun 04, 2001 10:00 pm
Location: The Netherlands
Contact:

Post by Xyx »

Originally posted by spork:
<STRONG>What I need now a scripting HowTo. Do you know of one?</STRONG>
Try [URL=http://groups.yahoo.com/group/bgscripts/files/Goran%27s%20Scripting%20Guide/]Goran's Scripting Guide. Worked for me. :) The group it's on (BGScripts) has since migrated to BWScript (in my sig). It's a very newbie-friendly place with all sorts of experienced, helpful individuals around.
Originally posted by spork:
<STRONG>I also think it should not attack, or at least be less likely to attack, party members who are not targetting it or one of its friends. This way it wouldn't chase after decoys.</STRONG>
That's certainly a good idea to keep in mind. :)
Originally posted by spork:
<STRONG>AttackReevaluate(LastAttackerOf(Myself),30)</STRONG>
That one has been tested quite extensively by others. Bottom line was that it simply doesn't re-evaluate ever. There are some ways to get around it, though.
Originally posted by spork:
<STRONG>By the way, Xyx, it's all because of some of the stuff you posted that I started messing around with scripts in the first place! You and your smart Beholders!
:mad: ;) </STRONG>
That's good. ;)
[url="http://www.sorcerers.net/Games/BG2/SpellsReference/Main.htm"]Baldur's Gate 2 Spells Reference[/url]: Strategy, tips, tricks, bugs, cheese and corrections to the manual.
User avatar
Raven
Posts: 29
Joined: Fri Jul 06, 2001 10:00 pm
Location: Son
Contact:

Post by Raven »

I know it is a bit late, but you can script the enemies that they force the door whenever a partie openend and closed it. I don't know if it is possible but when the greatures force the door the always succeed.

Another idea, all enemies with an x number of intelligence can cast knock. And script the creatures that they only do that when they have seen their enemies.
User avatar
Xyx
Posts: 3104
Joined: Mon Jun 04, 2001 10:00 pm
Location: The Netherlands
Contact:

Post by Xyx »

Hmm... do enemies ever force doors at the moment? I've never seen it myself... Could you explain a bit more?

Knock would be a bit strange, wouldn't it? Seeing all kinds of weird non-Mage creatures casting Knock (which always shows up in the message window) would be more than a bit suspicious.
[url="http://www.sorcerers.net/Games/BG2/SpellsReference/Main.htm"]Baldur's Gate 2 Spells Reference[/url]: Strategy, tips, tricks, bugs, cheese and corrections to the manual.
User avatar
Raven
Posts: 29
Joined: Fri Jul 06, 2001 10:00 pm
Location: Son
Contact:

Post by Raven »

No they don't force doors, but when thet are stuck behind a door they force it instead of opening it.

And when the door already has been openend by an adventure partie.
The creatures move to the door, their they find out that the door is closed.
They attack the door, so it opens.

Xyx jij komt toch ook uit Nederland geloof ik. (ik kan het in het engels niet uitleggen).

Als een monster een door tegenkomt die al geopend is geweest door een "team".
Dan valen ze de deur aan (als ze hun tegenstander hebben gezien).
Ik weet niet hoe ik een script moet schrijven, maar dat je in plaats van het commando open deur het commando val deur aan.
En dan zou je eigenlijk moeten proberen het zo te doen dat ze altijd slagen.
User avatar
henhen
Posts: 46
Joined: Sun Mar 11, 2001 11:00 pm
Contact:

Post by henhen »

IIRC, monsters do open doors in TOB
User avatar
Xyx
Posts: 3104
Joined: Mon Jun 04, 2001 10:00 pm
Location: The Netherlands
Contact:

Post by Xyx »

The door problem is really complex...

In BG2 monsters can only deal with "named" doors, not "the nearest door". Making a script that deals with 100 different doors is a bit above my level of ambition. :p ;)

In ToB, there's the ability to work with the "nearest door", though I'm not sure if it even works. Still, some doors are locked and some are trapped. Monsters shouldn't go open all doors and set off traps.

Kensai Ryu has done extensive work on doors, and if he says it's no use... it's no use. :(
[url="http://www.sorcerers.net/Games/BG2/SpellsReference/Main.htm"]Baldur's Gate 2 Spells Reference[/url]: Strategy, tips, tricks, bugs, cheese and corrections to the manual.
User avatar
KensaiRyu
Posts: 622
Joined: Sat Feb 03, 2001 11:00 pm
Contact:

Post by KensaiRyu »

Also update on the NearestDoor() objects...They crash my game when used in scripts...Not sure why.

NearestDoor by itself used like this :

IF
See(NearestDoor)
OpenState(NearestDoor,FALSE)
THEN
RESPONSE #100
OpenDoor(NearestDoor)
END

does nothing. (I assume because the door is not specified, IE nearest door to what.)


This crashes my game:

IF
See(NearestDoor(Myself))
OpenState(NearestDoor(Myself),FALSE)
THEN
RESPONSE #100
OpenDoor(NearestDoor(Myself))
END

Tried it without the OpenState check, still crashes.

Also I tried having monsters attack doors, same problem occurs as if the door is plot locked. They freeze up attacking it and can be slaughtered by the party while they are 'stuck'.

Also as I said using open door WILL check the monsters STR vs the door so if they have high str they will force it open. But if its trapped or plot locked there will be problems.

My vamp AI I am still working on, it is proving to be quite a pain. I had to modify 30+ scripts (mostly Bodhi's minions) that were using other generic 'see nearest' scripts. Also having some problems getting the vamps to act right. Im getting weird 'stuck pauses' sometimes like they are getting issued an action they cant perform. I might have you take a look at it. Also working on redoing every mage and cleric generic monster scripts also. Since the vamps were misbehaving and I was getting frustrated I switched to working on that for a couple days.
Wizards Of Eregion Expansion Team Presents:
[url="http://www24.brinkster.com/manveru"]Dagor Laureland[/url]
[url="http://groups.yahoo.com/group/IEEAIS"]Infinity Engine Enemy AI Scriptors Council[/url]
User avatar
Xyx
Posts: 3104
Joined: Mon Jun 04, 2001 10:00 pm
Location: The Netherlands
Contact:

Post by Xyx »

Kensai Ryu,

I have been toying with the idea of editing creature files to assign different scripts to them, much the way Sarkyn has. Doing so would seriously facilitate scripting for them. Think of what would happen when you'd give a modified version of gMage to enemies... :D

This way you'd not have to update the generic default scripts each time you decide to improve a specific creature type's AI. CRE files aren't that big, so it would not be too much of a problem to distribute them. Do you know any other pros or cons to this approach?
[url="http://www.sorcerers.net/Games/BG2/SpellsReference/Main.htm"]Baldur's Gate 2 Spells Reference[/url]: Strategy, tips, tricks, bugs, cheese and corrections to the manual.
Post Reply