Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Test Subject
Original Poster
#1 Old 20th Apr 2019 at 9:57 PM
Default Changing strings when a trait is present -- can someone tell me if this is viable?
I’ve made a very simple xml mod that changes some text strings in the game. It works perfectly well, but I’d love to make a scripting mod that made these strings ONLY change when the sims the player is currently controlling has a certain trait (or buff, or other testable quality, if that makes a significant difference).

Is it possible to check for something like this in a script mod and then only use the string override if the test passes? Or to achieve the same effect purely through scripting? Are there any mods that do something like this, or which would otherwise be especially worth peeking at?

I realize the more common approach would be to just include multiple versions of whatever thing you want to conditionally change the text for, but assume this is for something that can’t be trivially added. I do have some familiarity with Python.

Huge thanks in advance to anyone who can chime in here.
Advertisement
Deceased
#2 Old 22nd Apr 2019 at 12:14 AM Last edited by scumbumbo : 22nd Apr 2019 at 12:24 AM.
Don't need to look at another mod and you don't need to use any scripting just regular XML modding. There's plenty of interactions in the game that do tests to override various text strings. Look at phone_Chat (13784) for instance, you can see a display_name_overrides section which tests for a buff to see if the sim is grounded. It actually sticks the display name of the existing interaction using a parent_name tuning, but you can do any form of test (e.g. traits) and assign a new_display_name instead of using parent_name, or put it into a new pie menu category, or any number of things. Look for the display_name_overrides in the interaction tuning description and there's literally thousands of examples (3,356 by my count) in the game you can check out, although many are probably not very interesting...

computer_TrollForum (13240) for instance, changes the icon of the pie menu selection for one test, and the rest of the tests inexplicably change the display name to what the display name was anyway. Weird.
Test Subject
Original Poster
#3 Old 22nd Apr 2019 at 5:03 PM
Oh, this is perfect, thank you.

Oddly enough, I had failed to consider the fact that interactions do this because I was thinking interactions would be asking "does the sim doing this interaction meet condition X?" rather than "does the sim the player is currently controlling meet condition X?" (the latter being what I'm aiming for). But thinking it through, I can see how the active sim would arguably not yet be an "actor" in an interaction at the point where the player is still perusing menus. And either way, it makes sense that there'd be an affordance for this somewhere.

Can't wait to start digging.
Deceased
#4 Old 22nd Apr 2019 at 5:41 PM
Yup, the active Sim is considered the actor even prior to the interaction actually being a running one. By the same token, the object or Sim that is clicked on becomes the target object for this kind of pre-testing.
Back to top