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!
Quick Reply
Search this Thread
Forum Resident
Original Poster
#1 Old 2nd Jul 2012 at 12:27 AM
Default .DLL Help for Objects
The new object the Wishing Well has an option to turn a frog into a new love interest for your sim. It however (apparently) just creates any old random sim, with no rational as to the age or gender to match your sims preference. I guess that this behavior is in the DLL? I took a peak into it and found a "create romantic interest" tree/tab but I have no clue how to read what's inside. Is there a way to make the object create a sim that matches your sims age and preference to gender? I've attached the .dll if someone wants to take a gander at it.

Here's the create romantic interest info:
Quote:
.method public hidebysig instance class [Sims3GameplaySystems]Sims3.Gameplay.CAS.SimDescription
CreateRomanticInterest(class [Sims3GameplaySystems]Sims3.Gameplay.Actors.Sim actor) cil managed
{
// Code size 230 (0xe6)
.maxstack 4
.locals init (valuetype [SimIFace]Sims3.SimIFace.CAS.CASAgeGenderFlags[] V_0,
valuetype [SimIFace]Sims3.SimIFace.CAS.CASAgeGenderFlags V_1,
valuetype [SimIFace]Sims3.SimIFace.CAS.CASAgeGenderFlags V_2,
class [Sims3GameplaySystems]Sims3.Gameplay.CAS.SimDescription V_3,
class [mscorlib]System.Collections.Generic.List`1<class [Sims3GameplaySystems]Sims3.Gameplay.CAS.Household> V_4,
class [Sims3GameplaySystems]Sims3.Gameplay.CAS.Household V_5,
valuetype [SimIFace]Sims3.SimIFace.WorldName V_6,
valuetype [SimIFace]Sims3.SimIFace.CAS.CASAgeGenderFlags[] V_7)
IL_0000: ldc.i4.3
IL_0001: newarr [SimIFace]Sims3.SimIFace.CAS.CASAgeGenderFlags
IL_0006: stloc.s V_7
IL_0008: ldloc.s V_7
IL_000a: ldc.i4.0
IL_000b: ldc.i4.s 64
IL_000d: stelem.i4
IL_000e: ldloc.s V_7
IL_0010: ldc.i4.1
IL_0011: ldc.i4.s 32
IL_0013: stelem.i4
IL_0014: ldloc.s V_7
IL_0016: ldc.i4.2
IL_0017: ldc.i4.s 16
IL_0019: stelem.i4
IL_001a: ldloc.s V_7
IL_001c: stloc.0
IL_001d: ldloc.0
IL_001e: call !!0 [Sims3GameplaySystems]Sims3.Gameplay.Core.RandomUtil::GetRandomObjectFromList<valuetype [SimIFace]Sims3.SimIFace.CAS.CASAgeGenderFlags>(!!0[])
IL_0023: stloc.1
IL_0024: ldarg.1
IL_0025: callvirt instance class [Sims3GameplaySystems]Sims3.Gameplay.CAS.SimDescription [Sims3GameplaySystems]Sims3.Gameplay.Actors.Sim::get_SimDescription()
IL_002a: callvirt instance valuetype [SimIFace]Sims3.SimIFace.CAS.CASAgeGenderFlags [Sims3GameplaySystems]Sims3.Gameplay.CAS.SimDescription::get_Age()
IL_002f: ldc.i4.8
IL_0030: bne.un.s IL_0034
IL_0032: ldc.i4.8
IL_0033: stloc.1
IL_0034: call bool [Sims3GameplaySystems]Sims3.Gameplay.Core.RandomUtil::CoinFlip()
IL_0039: brtrue.s IL_0042
IL_003b: ldc.i4 0x1000
IL_0040: br.s IL_0047
IL_0042: ldc.i4 0x2000
IL_0047: stloc.2
IL_0048: ldarg.1
IL_0049: callvirt instance class [Sims3GameplaySystems]Sims3.Gameplay.CAS.SimDescription [Sims3GameplaySystems]Sims3.Gameplay.Actors.Sim::get_SimDescription()
IL_004e: ldloc.2
IL_004f: callvirt instance bool [Sims3GameplaySystems]Sims3.Gameplay.CAS.SimDescription::NotOpposedToRomanceWithGender(valuetype [SimIFace]Sims3.SimIFace.CAS.CASAgeGenderFlags)
IL_0054: brtrue.s IL_006b
IL_0056: ldloc.2
IL_0057: ldc.i4 0x2000
IL_005c: beq.s IL_0065
IL_005e: ldc.i4 0x2000
IL_0063: br.s IL_006a
IL_0065: ldc.i4 0x1000
IL_006a: stloc.2
IL_006b: ldloc.1
IL_006c: ldloc.2
IL_006d: call valuetype [SimIFace]Sims3.SimIFace.WorldName [SimIFace]Sims3.SimIFace.GameUtils::GetCurrentWorld()
IL_0072: ldc.i4.m1
IL_0073: call class [Sims3GameplaySystems]Sims3.Gameplay.CAS.SimDescription [Sims3GameplaySystems]Sims3.Gameplay.CAS.Genetics::MakeSim(valuetype [SimIFace]Sims3.SimIFace.CAS.CASAgeGenderFlags,
valuetype [SimIFace]Sims3.SimIFace.CAS.CASAgeGenderFlags,
valuetype [SimIFace]Sims3.SimIFace.WorldName,
uint32)
IL_0078: stloc.3
IL_0079: ldloc.3
IL_007a: brtrue.s IL_007e
IL_007c: ldnull
IL_007d: ret
IL_007e: ldloc.3
IL_007f: call void [Sims3GameplaySystems]Sims3.Gameplay.CAS.Genetics::AssignRandomTraits(class [Sims3GameplaySystems]Sims3.Gameplay.CAS.SimDescription)
IL_0084: call class [mscorlib]System.Collections.Generic.List`1<class [Sims3GameplaySystems]Sims3.Gameplay.CAS.Household> [Sims3GameplaySystems]Sims3.Gameplay.CAS.Household::GetTownieHouseholds()
IL_0089: stloc.s V_4
IL_008b: ldloc.s V_4
IL_008d: callvirt instance int32 class [mscorlib]System.Collections.Generic.List`1<class [Sims3GameplaySystems]Sims3.Gameplay.CAS.Household>::get_Count()
IL_0092: ldc.i4.0
IL_0093: ble.s IL_00aa
IL_0095: ldloc.s V_4
IL_0097: call !!0 [Sims3GameplaySystems]Sims3.Gameplay.Core.RandomUtil::GetRandomObjectFromList<class [Sims3GameplaySystems]Sims3.Gameplay.CAS.Household>(class [mscorlib]System.Collections.Generic.List`1<!!0>)
IL_009c: stloc.s V_5
IL_009e: ldloc.s V_5
IL_00a0: brfalse.s IL_00aa
IL_00a2: ldloc.s V_5
IL_00a4: ldloc.3
IL_00a5: callvirt instance void [Sims3GameplaySystems]Sims3.Gameplay.CAS.Household::Add(class [Sims3GameplaySystems]Sims3.Gameplay.CAS.SimDescription)
IL_00aa: ldloc.3
IL_00ab: callvirt instance class [Sims3GameplaySystems]Sims3.Gameplay.CAS.Household [Sims3GameplaySystems]Sims3.Gameplay.CAS.SimDescription::get_Household()
IL_00b0: brtrue.s IL_00bd
IL_00b2: call class [Sims3GameplaySystems]Sims3.Gameplay.CAS.Household [Sims3GameplaySystems]Sims3.Gameplay.CAS.Household::get_NpcHousehold()
IL_00b7: ldloc.3
IL_00b8: callvirt instance void [Sims3GameplaySystems]Sims3.Gameplay.CAS.Household::Add(class [Sims3GameplaySystems]Sims3.Gameplay.CAS.SimDescription)
IL_00bd: call valuetype [SimIFace]Sims3.SimIFace.WorldName [SimIFace]Sims3.SimIFace.GameUtils::GetCurrentWorld()
IL_00c2: stloc.s V_6
IL_00c4: ldloc.3
IL_00c5: ldloc.3
IL_00c6: callvirt instance bool [Sims3GameplaySystems]Sims3.Gameplay.CAS.SimDescription::get_IsMale()
IL_00cb: ldloc.s V_6
IL_00cd: call string [Sims3GameplaySystems]Sims3.Gameplay.CAS.SimUtils::GetRandomGivenName(bool,
valuetype [SimIFace]Sims3.SimIFace.WorldName)
IL_00d2: callvirt instance void [Sims3GameplaySystems]Sims3.Gameplay.CAS.SimDescriptionCore::set_FirstName(string)
IL_00d7: ldloc.3
IL_00d8: ldloc.s V_6
IL_00da: call string [Sims3GameplaySystems]Sims3.Gameplay.CAS.SimUtils::GetRandomFamilyName(valuetype [SimIFace]Sims3.SimIFace.WorldName)
IL_00df: callvirt instance void [Sims3GameplaySystems]Sims3.Gameplay.CAS.SimDescriptionCore::set_LastName(string)
IL_00e4: ldloc.3
IL_00e5: ret
} // end of method WishForLove::CreateRomanticInterest
Attached files:
File Type: zip  StoreObjectsWishingWell.zip (19.5 KB, 10 downloads) - View custom content
Advertisement
Field Researcher
#2 Old 2nd Jul 2012 at 7:49 AM Last edited by MDM : 2nd Jul 2012 at 9:17 AM. Reason: Correction
What it does there is : it creates a list of age flags, specifically Young Adult, Adult and Elder, then it picks a random one (that's how it works in this case, it apparently can't just pick one directly). If the sim is a Teen then only Teens get chosen, obviously. Then it "flips a coin" whether the sim should be male or female, based on the gender preference, which means that both can happen as long as there is even a minimum value for a gender. After this, a sim gets randomly created, gets assigned random traits and gets added to a random household in town. Random name follows as well.

To answer your question, yes, instead of choosing a random flag, the script could be changed to choose exactly the same age as the sim wishing for love, while for the other one, gender preferences have values and the script could be set to choose the one with the higher value. Still, the rest would be random, so IMHO the best approach here, would be to insert a dialog prior to each choice where the user inputs the age, then the gender preference. Still, you could choose to randomize them if you want, something like : Select gender preference (M - F - Random).

That's basically it

EDIT : Mind you, it can happen that both gender preferences have the same value, this should be considered, in that case the "higher value" method wouldn't work, if you chose to go with it, that is why I suggested a direct choice from the user. As for Teens, only Teens should be assigned to, unless you want to anger the game XD

Nothing's real. Nothing's unreal either.
The frontier between true and untrue is a shady fuzzy line.
Destiny, or maybe the long flight's time-span, shall decide the issue.
Instructor
#3 Old 2nd Jul 2012 at 8:25 AM
If you can download vistual studio 2008 express you could open the visual studio project source that I have attached.

There is an #error directive in the CreateRomanticInterest method that will direct you to where you would need to make your edits.

You could edit the code and recompile .. then import your dll into a .package file using S3PE.

Digitalchaos

PS: you can thank .net reflector for the exporting the code from the dll you uploaded!!!
Attached files:
File Type: zip  StoreObjectsWishingWell-VisualStudio2008-project.zip (6.23 MB, 9 downloads) - View custom content
Description: Visual studio 2008 Proiject for WishingWell Class

All TS2 Downloads Link
All TS3 Downloads: Link
All Other downloads: Link
Skyrim SKSE 1.6.x gamepad key support: Link
Forum Resident
#4 Old 2nd Jul 2012 at 10:32 AM Last edited by nonamena : 2nd Jul 2012 at 10:50 AM.
Go download ILSpy, it will make it easier for you to read the script (and it's free).

Code:
CASAgeGenderFlags cASAgeGenderFlags = RandomUtil.CoinFlip() ? CASAgeGenderFlags.Female : CASAgeGenderFlags.Male; 
if (!actor.SimDescription.NotOpposedToRomanceWithGender(cASAgeGenderFlags)) 
   { 
        cASAgeGenderFlags = ((cASAgeGenderFlags == CASAgeGenderFlags.Female) ? CASAgeGenderFlags.Male : CASAgeGenderFlags.Female); 
   }


This is the code you are looking for. However, it already takes into account your sim's gender preference.

First it does a "coin flip," but then look at the next line:

!actor.SimDescription.NotOpposedToRomanceWithGender(cASAgeGenderFlags)

! means not. If the actor is not NotOppossedToRomanceWithGender, i.e. if the actor IS opposed to romance with the gender from the coin flip, then the the script will now continue to the conditional operator "?:" (Read explanation of ?: operator). The ?: operator is essentially an if-else statement.

So it works like this: Actor = Gay = Male. Coin Flip = Female
->
Actor is opposed to romance with Female gender.

cASAgeGenderFlags == CASAgeGenderFlags.Female is true, so script will use the first expression: CASAgeGenderFlags.Male

I.e. If your sim is gay, and your coin flip returns Female, then cASAgeGenderFlags == CASAgeGenderFlags.Female is true, so the script will use the first expression: CASAgeGenderFlags.Male

If your sim is lesbian, and the coin flip returns Male, then cASAgeGenderFlags == CASAgeGenderFlags.Female is false, so the script will use second expression: CASAgeGenderFlags.Female

If your sim is a straight female, and the coin flip returns female, the script will return CASAgeGenderFlags.Male.

If your sim is a straight female and the coin flip returns male, then the sim is NotOpposedToRomanceWithGender, so the if statement is skipped.

Etc.

I have not played around enough with the wishing well (working on other stuff), but I think the problems people are seeing might be related to people playing newly created sims that either have a gender preference the player is not expecting, or do not yet have a gender preference.

My Mod Index | My Mods at Simlogical | My Blog: Nona's Sims | Fix Your Premium Content

Please do not PM me with questions about modding. Please post in an appropriate forum and PM me a link to the thread if you would like me to try and help.
Field Researcher
#5 Old 2nd Jul 2012 at 11:35 AM Last edited by MDM : 2nd Jul 2012 at 11:44 AM. Reason: typo
That's exactly the problem, the code, as it is, just evaluates if a specific gender is acceptable for romance, which is right basically, but what if you don't want your sim to be gay? Also, if the 2 values are the same, then there's no gender preference, that's why EA used this generic approach, to bypass the "no gender preference" occurrence. It's a matter of taste actually, if you're fine with it then keep the code as it is, but if you want to better define which gender should be assigned, then the safest solution is to leave the decision to the player. The latter will solve all the problems

Nothing's real. Nothing's unreal either.
The frontier between true and untrue is a shady fuzzy line.
Destiny, or maybe the long flight's time-span, shall decide the issue.
Forum Resident
#6 Old 2nd Jul 2012 at 12:46 PM
Yes. I did mention the no gender preference thing. I was not aware that the goal of this is to make it so players choose the gender of the sim.

My Mod Index | My Mods at Simlogical | My Blog: Nona's Sims | Fix Your Premium Content

Please do not PM me with questions about modding. Please post in an appropriate forum and PM me a link to the thread if you would like me to try and help.
Field Researcher
#7 Old 2nd Jul 2012 at 1:02 PM
Quote: Originally posted by nonamena
Yes. I did mention the no gender preference thing. I was not aware that the goal of this is to make it so players choose the gender of the sim.


You weren't aware cos it's not mentioned, that's what the OP will have to decide, we just provided our personal explanations and point of views, plus DigitalChaos provided a project and you detailed the whole process step by step, there's plenty to go from there

Nothing's real. Nothing's unreal either.
The frontier between true and untrue is a shady fuzzy line.
Destiny, or maybe the long flight's time-span, shall decide the issue.
Forum Resident
#8 Old 2nd Jul 2012 at 1:04 PM
Oh, I see!

My Mod Index | My Mods at Simlogical | My Blog: Nona's Sims | Fix Your Premium Content

Please do not PM me with questions about modding. Please post in an appropriate forum and PM me a link to the thread if you would like me to try and help.
Mad Poster
#9 Old 2nd Jul 2012 at 7:34 PM
In the Wishing Well stuff is an ITUN called WishingWell+ExploreUndergroundCaves, but there is no pie menu option to do this, at least I have not seen any such option. I was wondering if someone looking at the script might have a look for it; or might this be new functionality added to the Well later on, together with Supernaturality, for example?

MedievalMods and Sims3mods: Dive Cave Reset Fix, Resort Revamp, Industrial Oven Revamp, Will O' Wisp fix, UI Sounds Disabled, No Cars, Gnome Family Planner, Townies Out on the Town, No Martial Arts Clothes, Fast Skilling, etc. http://simsasylum.com/tfm/
Forum Resident
#10 Old 2nd Jul 2012 at 8:00 PM
Yes, it requires a game object called hotSpringClassic to be on the lot, in order for the interaction to appear. I think it will be another store object, though.

My Mod Index | My Mods at Simlogical | My Blog: Nona's Sims | Fix Your Premium Content

Please do not PM me with questions about modding. Please post in an appropriate forum and PM me a link to the thread if you would like me to try and help.
Forum Resident
Original Poster
#11 Old 2nd Jul 2012 at 8:13 PM
This part of modding is all new to me so what you're telling me is this:

It does check preference but with new sims without preferences it is random, or if the sim is equally gay/straight it's random? If that's how it's intended to work that's fine by me, I did actually only play around with fresh sims. But the idea of adding pie menu options to choose age and gender sounds cool too, I just don't think that's something I'd be able to do, at least as of right now, I'd have to do some studying first on the topic.

@Shimrod - I've notices they do that, include iTuns for stuff that doesn't exist. (yet?) The deep fryer has an itun for changing the oil and an included oil bottle accessory, but the chance to do so never happens in game.
Forum Resident
#12 Old 2nd Jul 2012 at 11:10 PM
Quote: Originally posted by omegastarr82
This part of modding is all new to me so what you're telling me is this:

It does check preference but with new sims without preferences it is random, or if the sim is equally gay/straight it's random? If that's how it's intended to work that's fine by me, I did actually only play around with fresh sims. But the idea of adding pie menu options to choose age and gender sounds cool too, I just don't think that's something I'd be able to do, at least as of right now, I'd have to do some studying first on the topic.


Yeah, that's pretty much it.

My Mod Index | My Mods at Simlogical | My Blog: Nona's Sims | Fix Your Premium Content

Please do not PM me with questions about modding. Please post in an appropriate forum and PM me a link to the thread if you would like me to try and help.
Back to top