Skip to content

Can I write an AI script using LUA?

I've googled around and read that I need to use something like Near Infinity to write AI scripts. Is this the only tool available or is there a way to use LUA scripts?

Comments

  • sarevok57sarevok57 Member Posts: 5,975
    I don't think near infinity is the only tool that is out there that can write scripts, although that is the one I use, I find it to be relatively easy

    what is LUA and what type of scripts do you want to make?
  • KahenrazKahenraz Member Posts: 70
    LUA is a general purpose scripting language. I read that Baldur's Gate uses it for things but I don't know if it can be used for AI scripts.
  • sarevok57sarevok57 Member Posts: 5,975
    ah I see
  • BubbBubb Member Posts: 999
    edited April 2017
    @Kahenraz
    LUA cannot be used for AI scripts. Baldur's Gate (and all the Infinity Engine games) use their own type of scripting language. You can learn a lot about modding in general from the following website; it has been put together by the community after many years of research:

    https://gibberlings3.github.io/iesdp/
    After entering, you would want to look at the sections under "Scripting"

    Technically, you don't have to use Near Infinity to write AI scripts. The AI "source code" is just text; you could write it in notepad if you really wanted. The problem is that you have to compile these source code files (.BAF) into their compiled variant (.BCS) for the game to read them. Near Infinity handles this for you, and has some handy compile-error checking built in. There are other ways to compile these source files, such as using WeiDU from the command line; but I find Near Infinity to be the easiest out of all the options.

    If you are looking to learn how to write AI scripts, I would say the best way to do this would be to look at the already existing scripts in Near Infinity, and to scan over the IESDP. There are also a ton of scripting tutorials scattered around the interwebs.

    Sidenote: The only place I know of where the Infinity Engine uses LUA is the UI.MENU file. (defines and controls all of the graphical interfaces of the game)

    Edit: Grammar is a nice thing to use.
    sarevok57islandking
  • argent77argent77 Member Posts: 3,431
    edited April 2017
    As already mentioned, there are several ways to add combat scripts to the game. Near Infinity provides a script compiler (which is even more powerful than before in the most recent version). This is a good choice if you want to create scripts for yourself.

    If you plan to distribute the scripts I would recommend to use WeiDU instead. Compiled scripts are partially dependent on the game installation, so it makes sense to compile them on the target system (which can be easily done with WeiDU scripts).

    If you want to write scripts outside of Near Infinity I would recommend to use Notepad++ with a syntax highlighter for game scripts. It will make writing scripts much easier.
Sign In or Register to comment.