10 years ago
Accessing CAS modifiers from script
According to another post here on the forums, @SimGuruEugi has said that:
From what I've seen, you have to have a protocolbuffers-type object to deserialize a string into. Otherwise, you don't have an object or properties that you can access. I've never been able to find the protocolbuffer object that is available to modders for this purpose for the genetic data or facial attributes.
On the protocolbuffers.DistributorOps_pb2.Operation, there is a SET_FACIAL_ATTRIBUTE and SET_SIM_GENETIC_DATA, but I've never seen a place in the core scripts that the actual attributes or genetic data are deserialized into an object anywhere. They only seem to be "copied" from one Sim to another for cloning purposes, for example.
I definitely am no expert on dealing with the serialization and deserialization of data so I could be missing something for sure in the scripts somewhere, but I was hoping I could maybe get a little more guidance on how the facial_attributes and genetic_data could be deserialized.
Thanks!
You should be able to access all of the CAS modifiers via facial_attributes and genetic_data. Those are stored on SimInfo as binary strings. You'll have to deserialize them, perform any modifications, and then reserialize them before setting them.
From what I've seen, you have to have a protocolbuffers-type object to deserialize a string into. Otherwise, you don't have an object or properties that you can access. I've never been able to find the protocolbuffer object that is available to modders for this purpose for the genetic data or facial attributes.
On the protocolbuffers.DistributorOps_pb2.Operation, there is a SET_FACIAL_ATTRIBUTE and SET_SIM_GENETIC_DATA, but I've never seen a place in the core scripts that the actual attributes or genetic data are deserialized into an object anywhere. They only seem to be "copied" from one Sim to another for cloning purposes, for example.
I definitely am no expert on dealing with the serialization and deserialization of data so I could be missing something for sure in the scripts somewhere, but I was hoping I could maybe get a little more guidance on how the facial_attributes and genetic_data could be deserialized.
Thanks!