Quick Reply
Search this Thread
Forum Resident
Original Poster
#1 Old 10th Apr 2020 at 4:54 AM
Default Overriding an objLua in the ObjectScripts.package ?
I'd like to redo/override one of the objLua objects found in the ObjectScripts package but there doesn't seem to be much information about doing that sort of thing in TS2 that I have been able to find.

1) Can it be done? If so, do I code my own Lua program and then what? I don't want to touch/change the original ObjectScripts.package file even if I could. Plus I haven't yet figured out how to make a Lua program into a package file, assuming that a package file could somehow override that one objLua in the ObjectScripts.package.

2) Is there a way to see exactly what the Maxis Lua script does? When viewing it in SimPE, the resource I want to override (Attraction) doesn't show its code. It shows Constants, Functions and Instructions, but not in a familiar way. If it is possible to override the Lua script, I want to ensure that I handle everything the original script does so I'd really need to see the actual code.

3) I've found a de-assembled "lst" file of the Attraction script but haven't found a viewer for that file which makes sense yet. (Any suggestions?) In another thread here, it was determined that the Attraction objLua resource could not be de-compiled, only de-assembled.

4) Is modding one (or more) of the BHAVs which call the Lua script where I need to be focusing instead? Letting the Lua script return its value(s) and then writing a whole lot of BHAV code to change values as I want them?

Has anyone actually over-ridden anything in the ObjectScripts.package before? Or is doing that just wishful thinking on my part?

All of my Conversions, Creations and Stories may be found here:
HobbesED's Conversions and Creations

My most recently shared items (with pictures) may also be found here:
HobbesED's Dreamwidth

Field Researcher
#2 Old 10th Apr 2020 at 9:48 AM
In the BHAV tutorials by AdidasSG6 there is a chapter about Lua here
Forum Resident
Original Poster
#3 Old 10th Apr 2020 at 1:57 PM
Thank you. I've been through that already. Unfortunately much of that is creating, compiling and assigning a new Lua script to an object and what I need to do is look at an existing already compiled script (where I haven't been able to find Maxis' Lua source code) and which isn't assigned to an object and over-ride it.

Plus AdidasSG6 admitted he didn't know how to run external objLua files without placing them in the ObjectScripts.package file which is why I asked here. Creating a mod which requires users to replace their ObjectScripts.package file is not a good option in my opinion since that package's contents and location changes based upon what EPs the user has installed.

All of my Conversions, Creations and Stories may be found here:
HobbesED's Conversions and Creations

My most recently shared items (with pictures) may also be found here:
HobbesED's Dreamwidth

Forum Resident
#4 Old 7th Aug 2026 at 2:13 PM
I know this was ages ago, but HobbesED, did you ever have any luck trying to mod the ObjectScripts.package? There's something in there that I think is key to what I want to do if only I can edit it... but I'm not sure how.
Top Secret Researcher
#5 Old 7th Aug 2026 at 2:55 PM
I would write a new lua script as minimal as possible to fetch the "hidden" data and process the results in BHAV as normal. Usually a script is limited to one or a few places in the game where it is used. Then you can make an attraction, shopping, snowball fight, or some such mod that leans heavily on lua data. The new uncompiled script can be contained in any Text List in the description field. Globals can use a different number other than 130 to stay compatible.

Since the original scripts are compiled to bytecode, reading and editing them is hard. I suppose you could replace one constant number with a different number in place (all 64-bit float), but then it has to go back into ObjectsScripts.package.
Forum Resident
Original Poster
#6 Old 8th Aug 2026 at 1:17 PM
Quote: Originally posted by KittyCarey
I know this was ages ago, but HobbesED, did you ever have any luck trying to mod the ObjectScripts.package? There's something in there that I think is key to what I want to do if only I can edit it... but I'm not sure how.

No, I did not. I ended up calling the script and then checking and manipulating the results afterwards in the way I needed. (Number 4 in my original post.)

All of my Conversions, Creations and Stories may be found here:
HobbesED's Conversions and Creations

My most recently shared items (with pictures) may also be found here:
HobbesED's Dreamwidth

Forum Resident
#7 Old 8th Aug 2026 at 2:21 PM
Thank you both for your advice. I've done Lua code directly in another package before, and I think that's where I need to focus my efforts - the Lua in ObjectScripts I was looking at seems to be unused anyway, so editing it probably doesn't help.
Back to top