Posts: 1,574
Thanks: 17313 in 57 Posts
26 Achievements
Object Invisible In Live Mode
Someone asked me, how to make an object become invisible in Live Mode and visible again in Build/Buy Mode. Good for OMSPs, kind of like my
Invisible Kitchen Surface.
This tutorial is for a non-recolorable object, or an object whose recolor doesn't matter to you. It'll just change material based on whether you're in Live Mode or not and ignore the recolor chosen by design tool.
You'll need
SimPE and some basic knowledge of it.
Create an invisible material- clone an existing TXMT
- on cMaterialDefinition tab, rename the material in Description field to something resembling invisibility
- copy-paste the new name to Filename field adding _txmt at the end
- change Type to Null
- fix TGI and Commit
Add both visible and invisible material names to text list #88- create this resource, if there isn't one in your package already:
- clone an existing text list, i.e. Model Names
- change its instance number from 85 to 88
- change its filename to Material Names or something like that
- remove model names or whatever text was written there
- copy-paste your visible and invisible material names to any two lines
- if the TXMT is custom, i.e. created by you, add ##0x1C050000! in front of the name
- if the TXMT is an in-game resource, don't add ##0x1C050000! (like maybe you're editing a Maxis object and using its original material for the visible state)
- Commit File
Add the subset name you want to become invisible to text list #87- create this resource, if there isn't one in your package already:
- clone an existing text list, i.e. Model Names
- change its instance number from 85 to 87
- change its filename to Subset Names or something like that
- remove model names or whatever text was written there
- write the subset name to any line (find it in GMDC -> Groups)
- Commit File
Create a BHAV named Function - Stop Live Mode- clone an existing BHAV, i.e. Function - Init
- change its instance number to a number that hasn't been used yet (say, there are BHAVs from 1000 to 1006 in your package, then use 1007)
- change Filename to: Function - Stop Live Mode
- delete all lines (Special Buttons -> Delete to end), it won't let you delete line 0, that's ok
- select line 0
- change OpCode to 2
- open raw entry box by clicking a quotes button
- if your object is 1-tile, copy-paste this: 00000B0000050A030000000000000000
- if your object is multi-tile, copy-paste this: 0000130000050A030000000000000000
- you should see: Expression (Stack Object ID := My object id) or Expression (Stack Object ID := My lead tile object ID)
- change True Target to 1
- change False Target to Error (using drop-down list)
- add a line (click Add)
- select the new line 1
- change OpCode to 6D
- click an X button to set all operands to zero
- copy-paste this to raw entry box: 00000000000A00000A00000000000000
- you should see: Change Material (Stack Object ID, Me ("something"), Me ("something"))
- open a wizard by clicking a wrench and axe button
- make sure you see the visible material name and the subset you want to toggle (if material name is long, place your cursor on it and click keyboard right arrow to go to the end)
- if material or subset is wrong, change index number until you see the right one (don't click fast forward buttons, they don't work)
- change True Target to Return True (using drop-down list)
- change False Target to also Return True
- Commit File
Create a BHAV named Function - Start Live Mode- clone the Stop Live Mode BHAV you've just finished
- change its instance number to an unused number (if there are BHAVs from 1000 to 1007 in your package, use 1008)
- change Filename to: Function - Start Live Mode
- select line 1
- open a wizard
- change material index number to the invisible one
- Commit File
Add the new functions to OBJf- open the OBJf, there's probalby at least one in your package
- select Start Live Mode
- click a play/triangle button next to Action BHAV field
- choose your Function - Start Live Mode
- Okay it and make sure it appeared in the Action BHAV field
- select Stop Live Mode and do the same for Function - Stop Live Mode
- Commit File
- if your object is multi-tile and has more OBJfs, you may have to do the same for them (actually, you might have to do it only for the lead tile's OBJf and leave the rest alone, but I'm not sure and I don't feel like testing, if you do it, tell me the results please :D)
Notes
In apartments, this method causes the object in hidden unit to show itself when not in Live Mode. If it bothers you, you could add checks for that to BHAVs.
For recolorable objects, if you want the game to respect the recolor chosen by design tool, it's a bit more complicated. You can do it the way clean and dirty material states are done, with additional MMATs and TXMTs and the right naming and flags and stuff. There's probably a tutorial somewhere on how to do clean and dirty states, just consider clean state as visible and dirty state as invisible. Basically, you'll have to add a dirty TXMT and MMAT to every recolor and rename all of them. The correct naming is important in this case. If your object already has clean and dirty states and you want to keep them, there's an option to use lit and unlit states for this purpose, but I haven't tried it. It'll probably multiply the amount of TXMTs and MMATs like crazy, if it even works. I don't recall any objects that have lit/unlit as well as clean/dirty states, it might not be doable.