- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- Would it be possible to make a condition based off if the target sim is BF/GF?
- > Discussion on file formats, research and other modding information pertaining to the Sims 3.
Replies: 15 (Who?), Viewed: 345 times.
#1
21st Jun 2022 at 11:49 PM

Posts: 71
Thanks: 8 in 1 Posts

Code:
Also is it possible to create custom relationships? If not it is no big deal. I will most likely use moodlets to accomplish these custom relationships. Any help would be appreciated thanks.
private static void AddExampleBuff(Sim Target, Sim Actor) { if (Actor.IsInRomanticRelationshipWith(Target)) && Actor.SimDescription.Partner(Target)) { ulong buffGuid = BuffExample.StaticGuid; Target.BuffManager.AddElement(buffGuid, Origin.None); } }
Advertisement
#2
22nd Jun 2022 at 1:52 AM

Posts: 396
Thanks: 4280 in 22 Posts
"Partner" is a property, which is a special kind of method that is used like a simple value. In other words, to check if the Sim's partner is the target, you'd just use an equality comparison like:
My guess is probably not, though I admit I'm not the most qualified to speak on the topic.
Code:
Actor.SimDescription.Partner == Target.SimDescription
Quote:
Originally Posted by MonocoDoll
Also is it possible to create custom relationships? If not it is no big deal. I will most likely use moodlets to accomplish these custom relationships.
|
"The Internet is the first thing that humanity has built that humanity doesn't understand, the largest experiment in anarchy that we have ever had." - Eric Schmidt
If you enjoy the mods I put out, consider supporting me on patreon: www.patreon.com/Gamefreak130
If you enjoy the mods I put out, consider supporting me on patreon: www.patreon.com/Gamefreak130
#3
22nd Jun 2022 at 3:15 AM

Posts: 71
Thanks: 8 in 1 Posts
Quote:
Originally Posted by gamefreak130
"Partner" is a property, which is a special kind of method that is used like a simple value. In other words, to check if the Sim's partner is the target, you'd just use an equality comparison like:
Code:
My guess is probably not, though I admit I'm not the most qualified to speak on the topic.Actor.SimDescription.Partner == Target.SimDescription |
#4
22nd Jun 2022 at 4:06 PM

Posts: 71
Thanks: 8 in 1 Posts
I have another question. Is there a way to apply a condition if the two sims are friends or not? for example something similar to.
Code:
Actor.SimDescription.AreFriends == Target.SimDescription
#5
22nd Jun 2022 at 6:52 PM

Posts: 740
Thanks: 875 in 20 Posts
There ought to be a way to retrieve the relationship value between two sims and then compare it to the minimum value for friendship. I believe it's called LTR (long-term relationship). Sorry for the vagueness. My computer with my code on it is still out for repair.
Echo Weaver's Simblr: http://echoweaver.tumblr.com/
A portrait in stubbornness - Playing the same legacy since 2009
Sample a Brave Legacy: http://sims3sample.illation.net
Echo Weaver's Simblr: http://echoweaver.tumblr.com/
A portrait in stubbornness - Playing the same legacy since 2009
Sample a Brave Legacy: http://sims3sample.illation.net
#6
22nd Jun 2022 at 10:49 PM

Posts: 396
Thanks: 4280 in 22 Posts
The liking value would probably work, but you can also do the following:
This will check whether the Target shows up as any variation of "friend" in the Actor's relationship panel, including Old Friend and Distant Friend.
Code:
Relationship relationship = Relationship.Get(Actor, Target, false); if (relationship != null && relationship.AreFriends()) { // Code you want to run if friends }
This will check whether the Target shows up as any variation of "friend" in the Actor's relationship panel, including Old Friend and Distant Friend.
"The Internet is the first thing that humanity has built that humanity doesn't understand, the largest experiment in anarchy that we have ever had." - Eric Schmidt
If you enjoy the mods I put out, consider supporting me on patreon: www.patreon.com/Gamefreak130
If you enjoy the mods I put out, consider supporting me on patreon: www.patreon.com/Gamefreak130
#7
23rd Jun 2022 at 7:24 PM

Posts: 757
Thanks: 7870 in 18 Posts
I would suggest something like
The RelashionshipTypes Enum has all possible relationships Sims can have:
Undefined,
Stranger,
Acquaintance,
Disliked,
DistantFriend,
Friend,
GoodFriend,
BestFriend,
OldFriend,
BestFriendsForever,
RomanticInterest,
ExSpouse,
Ex,
Enemy,
OldEnemies,
Partner,
Fiancee,
Spouse,
Default,
All
"Partner" is Bf/Gf, "Spouse" is husband/wife
Code:
var rel = Actor.SimDescription.GetRelationship(Target.SimDescription, false); if (rel != null && rel.LTR.CurrentLTR == Sims3.UI.Controller.LongTermRelationshipTypes.Partner) { // code to run if BF/GF }
The RelashionshipTypes Enum has all possible relationships Sims can have:
Undefined,
Stranger,
Acquaintance,
Disliked,
DistantFriend,
Friend,
GoodFriend,
BestFriend,
OldFriend,
BestFriendsForever,
RomanticInterest,
ExSpouse,
Ex,
Enemy,
OldEnemies,
Partner,
Fiancee,
Spouse,
Default,
All
"Partner" is Bf/Gf, "Spouse" is husband/wife
#8
24th Jun 2022 at 12:08 AM

Posts: 71
Thanks: 8 in 1 Posts
Thank you everyone. I will put these lovely methods to use. Also, I just realized I increased my rank to Lab assistant. How did that happen lol?
#9
24th Jun 2022 at 1:57 AM

Posts: 396
Thanks: 4280 in 22 Posts
Quote:
Originally Posted by MonocoDoll
Thank you everyone. I will put these lovely methods to use. Also, I just realized I increased my rank to Lab assistant. How did that happen lol?
|
That title changes the more you post here on the site. I've been stuck on "Field Researcher" for what seems like forever, but I quite like it.
"The Internet is the first thing that humanity has built that humanity doesn't understand, the largest experiment in anarchy that we have ever had." - Eric Schmidt
If you enjoy the mods I put out, consider supporting me on patreon: www.patreon.com/Gamefreak130
If you enjoy the mods I put out, consider supporting me on patreon: www.patreon.com/Gamefreak130
#10
24th Jun 2022 at 6:12 AM

Posts: 71
Thanks: 8 in 1 Posts
Quote:
Originally Posted by gamefreak130
That title changes the more you post here on the site. I've been stuck on "Field Researcher" for what seems like forever, but I quite like it.
|
Oh, that is neat. Can't believe I rank up for asking questions lol.
#11
24th Jun 2022 at 6:14 AM

Posts: 71
Thanks: 8 in 1 Posts
Speaking of questions would anyone know if it is possible to make buffs invincible? correct me if I am wrong, but I could have sworn I saw an invicible buff before while using Nrass. Apparently the buff would increase skill gains from the best of my memory. But, at the moment I am simply interested in making a buff invincible.
#12
24th Jun 2022 at 6:41 PM

Posts: 740
Thanks: 875 in 20 Posts
Well, that's a new tidbit to me! Is it in code snippets?
Will this detect partner relationships or just variants of friend? I.e. if you check against the LTR value, you should get sims who have any type close relationship, whether their status is some sort of friend, romantic interest, partner, etc. I'm pretty sure different types of relationships can have the same value. So it might depend on whether you're trying to test for just being emotionally close or whether you specifically want friends but not romantic interests.
Echo Weaver's Simblr: http://echoweaver.tumblr.com/
A portrait in stubbornness - Playing the same legacy since 2009
Sample a Brave Legacy: http://sims3sample.illation.net
Will this detect partner relationships or just variants of friend? I.e. if you check against the LTR value, you should get sims who have any type close relationship, whether their status is some sort of friend, romantic interest, partner, etc. I'm pretty sure different types of relationships can have the same value. So it might depend on whether you're trying to test for just being emotionally close or whether you specifically want friends but not romantic interests.
Quote:
Originally Posted by gamefreak130
The liking value would probably work, but you can also do the following:
Code:
Relationship relationship = Relationship.Get(Actor, Target, false); if (relationship != null && relationship.AreFriends()) { // Code you want to run if friends } This will check whether the Target shows up as any variation of "friend" in the Actor's relationship panel, including Old Friend and Distant Friend. |
Echo Weaver's Simblr: http://echoweaver.tumblr.com/
A portrait in stubbornness - Playing the same legacy since 2009
Sample a Brave Legacy: http://sims3sample.illation.net
#13
25th Jun 2022 at 2:09 AM

Posts: 396
Thanks: 4280 in 22 Posts
Quote:
Originally Posted by echoweaver
If you check against the LTR value, you should get sims who have any type close relationship, whether their status is some sort of friend, romantic interest, partner, etc. I'm pretty sure different types of relationships can have the same value. So it might depend on whether you're trying to test for just being emotionally close or whether you specifically want friends but not romantic interests.
|
Correct, AreFriends() will be false if the Sims are romantically involved (or if they're exes), whereas an LTR value threshold would include such relationships if they're on good terms.
"The Internet is the first thing that humanity has built that humanity doesn't understand, the largest experiment in anarchy that we have ever had." - Eric Schmidt
If you enjoy the mods I put out, consider supporting me on patreon: www.patreon.com/Gamefreak130
If you enjoy the mods I put out, consider supporting me on patreon: www.patreon.com/Gamefreak130
#14
28th Jun 2022 at 1:04 PM

Posts: 3,615
Thanks: 6595 in 35 Posts
Oh this is quite helpful! Initially, I checked Romantic Interests in this very convoluted and arguably weird way
Reading over it after having gone through the options here, I just realised it's very prone to return mistakes (In case you're curious
Thank you for sharing this!


Code:
public static bool AreRomanticallyInvolvedButNotMarriedOrWhatever(Sim actor, Sim target) { if (actor.Partner == target.SimDescription) { return false; } if (actor.Partner != null && actor.Partner != target.SimDescription) { return false; } if (target.Partner != null && target.Partner != actor.SimDescription) { return false; } MiniSimDescription miniSimDescription = MiniSimDescription.Find(actor.SimDescription.SimDescriptionId); if (miniSimDescription != null && (miniSimDescription.HasPartner || miniSimDescription.IsMarried)) { return false; } miniSimDescription = MiniSimDescription.Find(target.SimDescription.SimDescriptionId); if (miniSimDescription != null && (miniSimDescription.HasPartner || miniSimDescription.IsMarried)) { return false; } return true; }
Thank you for sharing this!

#15
28th Jun 2022 at 10:11 PM

Posts: 757
Thanks: 7870 in 18 Posts
@Lyralei
Oh that's the code you discarded? I started reading it and thought "uhm wait, this is weird"
Oh that's the code you discarded? I started reading it and thought "uhm wait, this is weird"
#16
30th Jun 2022 at 2:19 PM

Posts: 3,615
Thanks: 6595 in 35 Posts
Lol yeah! I actually copied it from EA funnily enough, although in that use case it made sense since it was straight from a social interaction (which already came with checks in the XML against what LTR they are)
Who Posted
|