Page 1 of 1
A way to bind an LUA Function to a key?
Posted: Fri Jun 01, 2012 8:09 pm
by SleepKiller
Hello GameToast,
I am currently searching for away to bind an LUA Function so it activates when a key is pressed. I know LUA doesn't have this function built in, but I was wondering if anyone had found a function in SWBFII that yielded the same results.
I did use the search function and got, either something to do with combos or No Suitable Matches Were Found.
Any help would be much appreciated. (I am starting to suspect it is impossible myself. I just thought I would ask to be sure.)
Re: A way to bind an LUA Function to a key?
Posted: Fri Jun 01, 2012 10:16 pm
by [RDH]Zerted
There's two ways to sort-of do it. The first is use the command keys. Those are the F keys you use to give the AI commands. See the scripting guide in the mod tool's documentation for the functions that let you use them (I don't have that doc on this laptop, so I can't give you any more details right now).
The second way is to put a transparent IFScreen (window) over the entire display. I don't think that's what you want. You can add keyboard commands to any window (map screen, pause menu, etc...). If you're using v1.3 it would be easiest to add in custom FakeConsole commands. Would that work for what you have planned? You didn't say what you wanted the key bindings to do.
Re: A way to bind an LUA Function to a key?
Posted: Fri Jun 01, 2012 11:02 pm
by SleepKiller
[RDH]Zerted wrote:There's two ways to sort-of do it. The first is use the command keys.
The second way is to put a transparent IFScreen (window) over the entire display. I don't think that's what you want. You can add keyboard commands to any window (map screen, pause menu, etc...). If you're using v1.3 it would be easiest to add in custom FakeConsole commands. Would that work for what you have planned? You didn't say what you wanted the key bindings to do.
Yes I suppose I should explain in as much detail as possible what I want them to do.
I want it so that while you are playing when you press 1, 2, 3, 4, etc It runs this command.
ReadDataFileIngame("");
To load up a new set of textures to change i.e. a clone legion on the fly. (It works I have tested it.)
So how exactly does one go about making an invisible screen? Then how to you go about adding the bindings?
Re: A way to bind an LUA Function to a key?
Posted: Sat Jun 09, 2012 5:11 pm
by [RDH]Zerted
Try getting it working with the F keys first. The scripting guide that comes with the mod tool's documentation has a section on it (the AI commands). You program it just like an OnEnterRegion
Re: A way to bind an LUA Function to a key?
Posted: Sat Jun 09, 2012 7:15 pm
by Teancum
Specifically you can find info on this in /BF2 Tools/Documentation/Battlefront2_scripting_system.doc under the section "CharacterIssueAICommand".
