Jump to content

Recommended Posts

I have a modded character who swaps between different 'characters' when he equips different masks.

I'm in the process of adding a new mask to his mod who speaks in all caps, like WX.

I accomplished this by adding this to the mask's OnEquip function:

Quote

owner.components.talker.mod_str_fn = string.utf8upper

However, I then realised I don't know how to reset the character's dialogue back to normal when the mask is removed.

I tried looking at util.lua and trying some things I saw there, but they all either seem to be modifiers to the default text that aren't fit for my purpose, or just crash the game. I'm not good enough at coding to actually understand what is happening in the file to attempt to engineer a solution myself.

Does anyone know if it is possible to do something like this? I've found my character tends to create problems that are much harder to solve than they appear so I am hoping I am missing something extremely obvious.

Edited by Chesed
22 minutes ago, Chesed said:

I have a modded character who swaps between different 'characters' when he equips different masks.

I'm in the process of adding a new mask to his mod who speaks in all caps, like WX.

I accomplished this by adding this to the mask's OnEquip function:

However, I then realised I don't know how to reset the character's dialogue back to normal when the mask is removed.

I tried looking at util.lua and trying some things I saw there, but they all either seem to be modifiers to the default text that aren't fit for my purpose, or just crash the game. I'm not good enough at coding to actually understand what is happening in the file to attempt to engineer a solution myself.

Does anyone know if it is possible to do something like this? I've found my character tends to create problems that are much harder to solve than they appear so I am hoping I am missing something extremely obvious.

Just save the original font:

owner.components.talker.original_font = owner.components.talker.mod_str_fn -- Save the original font
owner.components.talker.mod_str_fn = string.utf8upper -- Put the new font
...
-- When you need to back to the original font:
owner.components.talker.mod_str_fn = owner.components.talker.original_font

When you adding attributes to an entity, components, or any class, you are not "modifying" the class, i mean, you cannot break it by adding attributes , so, add whatever you want and need.

  • Like 1
11 minutes ago, FerniFrenito said:

you are not "modifying" the class

I meant modifier in the literal sense and don't understand what that means, but regardless the solution you provided works, so thank you in any case.

Edited by Chesed
17 minutes ago, Chesed said:

I meant modifier in the literal sense and don't understand what that means, but regardless the solution you provided works, so thank you in any case.

I mean that by adding variables, as long as they do not have the same name as any other, you will not interfere in any way with the original functioning of the class.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...