Forum Discussion
10 years ago
"simmythesim;14487333" wrote:
...Do I have to pass in any arguments for it to work?
To answer myself, no. It seems that that the game just wasn't throwing an error when I didn't import itertools. Anyway, thanks for the help!
EDIT: Here's a script which changes the value of a selected slider for a sim. All you have to do is input the SimModifier resource value to be edited, and the amount to change it to. Values are 0.0 to 1.0, You have to input a float for the amount.
from protocolbuffers import PersistenceBlobs_pb2
from server_commands.argument_helpers import get_optional_target, OptionalTargetParam, OptionalSimInfoParam
import services
import sims4.commands
import random
import itertools
@sims4.commands.Command('cas.randomize_facial_attributes', command_type=sims4.commands.CommandType.Live)
def randomize_facial_attributes(slider:str, amount:float, opt_sim:OptionalSimInfoParam=None, _connection=None):
sim_info = get_optional_target(opt_sim, target_type=OptionalSimInfoParam, _connection=_connection)
if sim_info is None:
return False
facial_attributes = PersistenceBlobs_pb2.BlobSimFacialCustomizationData()
facial_attributes.MergeFromString(sim_info.facial_attributes)
if amount is not None:
for modifier in itertools.chain(facial_attributes.face_modifiers, facial_attributes.body_modifiers):
if str(modifier.key) == slider:
modifier.amount = amount;
sim_info.facial_attributes = facial_attributes.SerializeToString()
return True
About The Sims 4 Mods & Custom Content
Find expert tips, troubleshooting help, tutorials for mods and custom content, and The Sims 4 patch files in our forum.15,680 PostsLatest Activity: 2 hours ago
Community Highlights
Recent Discussions
- 2 hours ago
- 3 hours ago
- 3 hours ago