Discussion on SWBF2 mission scripts and Lua 5.0 (FAQ)

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Locked
Leviathan
Missing Jedi Admin
Posts: 3277
Joined: Fri Nov 12, 2004 2:54 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

RE: Discussion on SWBF2 mission scripts and Lua 5.0

Post by Leviathan »

In my opinion, this thread should be transformed into a sticky, as I think it might become rather useful soon... :wink:
Regarding your tries, Riley', I'd like to know if you have ever used LuaDC on SWBF's compiled *.LUA scripts...
Riley75

Post by Riley75 »

So far, LuaDec crashes on SWBF2's scripts.
And it can't be used on SWBF1's scripts, as LuaDec is only for Lua 5.0 (SWBF1 uses 4.0).

I could try building a decompiler for Lua 4.0 I suppose... Way back when, luck3y was considering doing so. I think Nimlot has considered it as well. But that's a matter for the SWBF1 modding forum. ;)

Really Late Edit:
Leviathan, when you said "LuaDC" I was thinking you meant LuaDec.
Yes, as Nimlot says, LuaDC is for 4.0. But as far I know, nobody was ever able to get it to work with SWBF1 scripts. It was built for Homeworld, I think, which I presume uses different settings (probably "double" instead of "float" for numbers). I don't think the source code for it was released, so we couldn't rebuild it with the proper settings.
Last edited by Riley75 on Wed Nov 09, 2005 8:18 pm, edited 1 time in total.
User avatar
Nimlot
Jedi Admin
Jedi Admin
Posts: 103
Joined: Wed Oct 20, 2004 9:35 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Contact:

Post by Nimlot »

LuaDC only works for Lua v4.0, so it would not work with SWBF2.
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11080
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Post by Teancum »

Ah, but as far as LUA goes, if we used this site and others to find documentation, we may be able to do a LOT more with the BF engine.
Riley75

Post by Riley75 »

Quick note: I'll be updating the original post in this thread periodically, if and when additional information is known.


I've tried looking into why LuaDec crashes on the SWBF2 scripts; and why "luac -l" generates "bad code" errors. It seems like certain instructions have operand values that are invalid. From the limited tests I've run, it seems some of the SUB and ADD instructions have a bad third parameter (the "C" parameter).
The best way I can describe this issue: I suspect that the Lua environment inside SWBF2 makes additional memory addresses available to its Lua code. If that's the case, I don't know how we can deal with that. I'd need to have a better understanding of how Lua byte-code operates, and of how it interacts with its environment.
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11080
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Post by Teancum »

I've been reading into the documentation you've posted, Riley, and I wonder if we can't add new eras to BF1.... I'm going to look into it over the next while.
User avatar
guru
Jawa Admin
Jawa Admin
Posts: 2390
Joined: Thu Oct 14, 2004 8:45 pm
Projects :: swbf 1 vanilla
Games I'm Playing :: any mobile rpg

Post by guru »

Mod tools out! Check download and main page! topic closed.
Locked