Page 1 of 4
AI Scriptiing
Posted: Mon May 14, 2001 12:00 pm
by Cloak
Hi, I am looking for a good AI Scripting tool. I downloaded the one from teambg, but it doesn't work, and yes I did install the VB5 files required in order to run it.
So If anyone could tell me whats the best tool to use, and where I can find one, I would be very gratefull.
Thanks.
Posted: Mon May 14, 2001 12:15 pm
by Cloak
bump
Posted: Mon May 14, 2001 8:13 pm
by Cloak
bump again
Posted: Mon May 14, 2001 9:09 pm
by velvetfreak
Hi,
I don't have anything I can refer you to, sorry. I've always gotten by just fine with the tools provided with the game. I started with some scripting guides ([url="http://waterdeep.homeip.net/potenciusnet/"]resource[/url]) and had a look at the existing scripts and went from there.
I'm very proud of my custom thief script, based on Thief4 (ranged) but performs Find Traps if not doing anything, and will not attack (or Find Traps) if Hiding in Shadows. I've opened it up a couple of times to tweak the range/melee distances. But having a thief that Finds Traps all the time without having to ask is sweeeet.
Posted: Mon May 14, 2001 9:21 pm
by Cloak
Ok thanks. I am a little embrasshed that I never thought to check to see if bioware had provided tools to create scripts.
Thanks again.
Posted: Mon May 14, 2001 9:35 pm
by KensaiRyu
I dont know if you are a member or not, but if you are not here is a link to BGScripts.
[url="http://groups.yahoo.com/group/bgscripts/files/"]http://groups.yahoo.com/group/bgscripts/files/[/url] They offer excellant advice, and will help you with anything you need to know.
For a good script writing tool, I highly recommend either the AI scriptor found here on this site or the context editor (theres a link to it in the links area). Also if you have any questions about scripting feel free to email me and I can probably help you out. (check out my improved creature AI folder in the files area).
Astrobouncer@Aol.com
Posted: Tue May 15, 2001 1:10 am
by velvetfreak
Heh... in the BG2 directory, in a subfolder called script compiler, no less! Includes a scripting guide document from John Winski of Bioware.
Here's my precious Thief script:
IF
ActionListEmpty()
!ModalState(DETECTTRAPS)
!See([ENEMY])
!StateCheck(Myself,STATE_INVISIBLE)
THEN
RESPONSE #100
FindTraps()
END
IF
ActionListEmpty()
AttackedBy([ANYONE],DEFAULT)
Range(LastAttackerOf(Myself),5)
THEN
RESPONSE #100
EquipMostDamagingMelee()
AttackReevaluate(LastAttackerOf(Myself),30)
END
IF
ActionListEmpty()
See(NearestEnemyOf(Myself))
!Range(NearestEnemyOf(Myself),5)
Range(NearestEnemyOf(Myself),8)
THEN
RESPONSE #100
RunAwayFrom(NearestEnemyOf(Myself),30)
END
IF
ActionListEmpty()
See(NearestEnemyOf(Myself))
!Range(NearestEnemyOf(Myself),8)
THEN
RESPONSE #100
EquipRanged()
AttackReevaluate(NearestEnemyOf(Myself),30)
END
IF
ActionListEmpty()
See(NearestEnemyOf(Myself))
Range(NearestEnemyOf(Myself),5)
THEN
RESPONSE #100
EquipMostDamagingMelee()
AttackReevaluate(NearestEnemyOf(Myself),30)
END
...And I was incorrect about not attacking if Hidden in Shadows, but I could put the !StateCheck(Myself,STATE_INVISIBLE) condition in all of the combat commands for that.
vf
Posted: Tue May 15, 2001 1:22 am
by KensaiRyu
Also if you wanted your thief to backstab with AI on, heres a snippet from Sarkyns g-series thief:
// * STEALTH ATTACK
IF
ActionListEmpty()
!CombatCounter(0) // if combat has started (thus I'm not out scouting on my own)
OR(2)
StateCheck(Myself,STATE_INVISIBLE) // and I'm invisible
StateCheck(Myself,STATE_IMPROVEDINVISIBILITY) // or I'm improved invisible
!InParty(LastSeenBy()) // target is not in party
Range(LastSeenBy(),8) // target is reachable range, and no area effects are likely
THEN
RESPONSE #100
EquipMostDamagingMelee() // equip melee weapon
MoveToObject(LastSeenBy()) // move to the target
DisplayStringHead(Myself,8549) // "Die you bastard!"
Attack(LastSeenBy()) // whack them hard
MoveToObject(StrongestOf())
Posted: Tue May 15, 2001 3:52 pm
by velvetfreak
KensaiRyu, can you tell me more about that DisplayStringHead command? What's the 8549 value?
Posted: Tue May 15, 2001 5:26 pm
by KensaiRyu
The display string head command displays text above the characters head thus making it look like the character is saying something (like Firkagg in the CC when he has an offer for you, or Lilacor also alot of enemies use this Action). However the drawback is you have to know the Dialog tlk string reference # in order to use this.You can use Infinity Explorer to look at the numerous Dialog tlk files and see their string reference numbers. If you dont have Infinity Explorer get it here: [url="http://infexp.sourceforge.net/"]http://infexp.sourceforge.net/[/url] . You can learn alot from the numerous in game scripts once you have IE.
DisplayStringHead(Myself,8549) // "Die you bastard!" this string reference (8549) displays the text "Die u bastard!"
Posted: Wed May 16, 2001 2:40 am
by velvetfreak
@KensaiRyu, excellent! But more information please.
I've hunted through InfExp but not having any luck yet...
Posted: Wed May 16, 2001 7:10 am
by KensaiRyu
OK heres some important information about the infinty games scripts.
The .ids files are what control the scripts. this is where the scripts look to access the commands used in them. Action.ids has all of the action commands like movetoobject, start dialogue, anything deemed an action.
These commands appear exactly as they would be found in the script minus the names (ie instead of object it would be Sw1h29 etc).
To see how they are used goto the section in IE labeled scripts and check those out.
You will see numerous examples of scripts in use by the game engine.If you have any ques dont hesitate to email me at
Astrobouncer@Aol.com and if I dont know the answer I will get it to someone who does.
Posted: Wed May 16, 2001 3:50 pm
by velvetfreak
Hey... I've just stumbled across a couple of entries that have a dialog command that I can't find a string reference for.
But what's more interesting is the format:
DisplayStringHead(Myself,'Try this out for dental floss, creep!')
The quote goes in single inverted commas, with the target as the first variable. I wonder if you could get your victim to wail in terror by using (Target of(Myself)). Ooh, the possibilities...
Haven't tried it out yet but you can bet I will...
Posted: Wed May 16, 2001 6:54 pm
by KensaiRyu
Sorry I forget to mention that... because of a mistake in the way IE explores and displays the files, the DisplayStringHead command shows only the string reference text and not the numberin IE. So in your script,if you try to put text in there I believe you will have an error or it wont compile. However in place of text you can use an object (like LastSeenBy) check the object.ids for all the different listings you can use.
Heres a script I been meaning to try that displays the last seen by, I got this from a member of BGscripts:
Try this one(works better)
IF
OR(2)
See([ENEMY])
ActionListEmpty()
THEN
RESPONSE #100
DisplayString(LastSeenBy(Myself),541)
END
[ 05-17-2001: Message edited by: KensaiRyu ]
Posted: Fri May 18, 2001 1:12 am
by KensaiRyu
No new questions? I have a few for you.
How comfortable are you with writing scripts now?
Have you joined BGscripts?
Some of the information found there is priceless to a scriptor, both David Gaider and another Bioware developer are members...
Plus take a look at Sarkyns G-series scripts for party members, they are about 100 times bigger (at least) than the scripts for the players Bioware developed, they utilize much better targeting and advanced healing routines. Those scripts are the Formula 1 of scripts.
Posted: Fri May 18, 2001 2:35 am
by velvetfreak
Yep. Having a look now. Thanx for your help KR
Didn't get any of the DisplayString or DisplayStringHead commands to work yet, still tinkering.
I did find that the search function with InfExp will search for a StrRef - which is handy - but it seems the only available browsing methods are by entering one number after the other, or drilling down through all the dialog trees. Gets a bit boring, not to mention spoiler-ish.
Those "F1" scripts you mention - any impact on performance?
Posted: Fri May 18, 2001 6:37 am
by KensaiRyu
Sarkyn rewrote them so they dont slow too bad however I have a dinosaur computer (pentium 200) and they do affect the performance some for me, however you dont have to do anything except tell the characters where to move.
Sarkyn's scripts have advanced threat recognition (recognizes at least five different threat levels and numerous monsters including beholders,lichs, dragons, mindflayers,and trolls some that i know of) and are outstanding.
Once you have beaten the game and dont want to control as much, I suggest run those scripts, you wont have to handle any of the battles except maybe Kangaxx (the script might have a snippet for fighting him in it), as the scripts will take care of the rest.
If you are further interested in script writing, maybe you would be interested in writing scripts to improved the enemy AI.
As far as I know only me and Beige Tangerine
have done that so far.
Posted: Tue May 22, 2001 3:02 am
by KensaiRyu
Also I forget to mention in the files area of BGscripts we have a file that has all the String Text reference #'s of less than 50 words listed in Alphabetical order. Might help some.
Posted: Tue May 22, 2001 3:09 am
by KensaiRyu
The file is called Dialog_Text.zip in the System files folder.
How is your scripting coming along?
Have you gotten Display String head to work yet?
Posted: Tue May 22, 2001 6:01 am
by Kaerdhal
I've been reading this thread this morning with great interest. I dabble in programming and am amazed at what tools are available to make this wonderful game, that much better! I look forward to playing with some scripts (thief of course).
However, I do have one more question (slight tangent and much easier to answer): how do I change the voice files? I know how to "CHANGE" them, but I don't know how to figure out which voice files produce which phrases so that I can map them out and rerecord them!! Also, is there a repository of avitar art? I plan to customize my characters, but have come up empty so far, and didn't necessarily want to take the long road in finding all this info on my own.
Any help would be greatly appreciated!!
Thanks!