Replies: 2 (Who?), Viewed: 4144 times.
#1
29th Nov 2012 at 4:51 AM


Basically 'Wrestle' is just a fight interaction which will function just like a regular fight interaction between sims. But, 'Wrestle' will be a friendly interaction (without decreasing relationships) , and will raise fun. That's the basic idea.
I also have an expanded idea where this interaction will raise more fun for Athletic, Brave, Diciplined and Daredevil sims. While a sim with Coward, Couch Potato and Slob sim will always refuse this interaction.
So any idea where can I start? I have been reading this tutorial ( http://simswiki.info/wiki.php?title...ripting_Modding ) and this one ( http://nene.modthesims.info/showthread.php?t=491875 ) to gain more understanding.
Advertisement
#2
30th Nov 2012 at 7:29 AM

To add a social interaction you will need to load a custom SocialData and SocializingActionAvailability xml. Otherwise, you'll have to deal with social jigs and what not.
I use this code to load social interactions in one of my mods. Below is an adapted version, so you get and idea of how this works. LoadSocialData and LoadSocializingActionAvailability are triggered once the world load is finished. These methods will read two xml files (which I'll explain below) and add the interaction to the pie menu. IncreaseFunAfterWrestle is triggered once the wrestle interaction is finished. It increases the fun motive by 10 (or 15 if the Sim is Daredevil, Athletic, Disciplined, or Brave). TestWrestle checks if the target Sim has the Coward, Slob or Couch Potato trait. If they have any of those traits, the interaction won't display in the pie menu.
The SocialData XML contains the information of the social interaction: what happens before and after the interaction, which Sims can participate, under which pie menu should the interaction appear, etc. Add a new XML resource to your package (type _XML 0x0333406C) and make sure its instance is the FNV64 hash referenced in the script. In the script above, LoadSocialData tries to load "SocialData_Wrestle" (instance 0x03DB8DA9FE62CD65).
The SocializingActionAvailability xml defines in which types of "short term context" an interaction is available. For example, Sims cannot Make Out if their context isn't alluring, Sims cannot Tell Jokes if the context isn't Hilarious, etc.
I hope this helps you. Feel free to ask more questions in case I failed to explain something clearly.
I use this code to load social interactions in one of my mods. Below is an adapted version, so you get and idea of how this works. LoadSocialData and LoadSocializingActionAvailability are triggered once the world load is finished. These methods will read two xml files (which I'll explain below) and add the interaction to the pie menu. IncreaseFunAfterWrestle is triggered once the wrestle interaction is finished. It increases the fun motive by 10 (or 15 if the Sim is Daredevil, Athletic, Disciplined, or Brave). TestWrestle checks if the target Sim has the Coward, Slob or Couch Potato trait. If they have any of those traits, the interaction won't display in the pie menu.
Code:
namespace emino.Socializing { public class Wrestle { [Tunable] protected static bool kWrestle = false; static Wrestle() { World.OnWorldLoadFinishedEventHandler += new EventHandler(OnWorldLoadFinished); } private static void OnWorldLoadFinished(object sender, EventArgs e) { Wrestle.LoadSocialData("SocialData_Wrestle"); Wrestle.LoadSocializingActionAvailability("SocializingActionAvailability_Wrestle"); } public static void LoadSocialData(string spreadsheet) { XmlDocument root = Simulator.LoadXML(spreadsheet); bool isEp5Installed = GameUtils.IsInstalled(ProductVersion.EP5); if (spreadsheet != null) { XmlElementLookup lookup = new XmlElementLookup(root); List<XmlElement> list = lookup["Action"]; foreach (XmlElement element in list) { CommodityTypes types; XmlElementLookup table = new XmlElementLookup(element); ParserFunctions.TryParseEnum<CommodityTypes>(element.GetAttribute("com"), out types, CommodityTypes.Undefined); ActionData data = new ActionData(element.GetAttribute("key"), types, ProductVersion.BaseGame, table, isEp5Installed); ActionData.Add(data); } } } public static void LoadSocializingActionAvailability(string spreadsheet) { XmlDbData xdb = XmlDbData.ReadData(spreadsheet); if (xdb != null) { try { if (xdb.Tables.ContainsKey("SAA")) { SocialManager.ParseStcActionAvailability(xdb); } } catch (Exception exception) { Exception(exception); } } } public static bool IncreaseFunAfterWrestle(Sim actor, Sim target, string interaction, ActiveTopic topic, InteractionInstance i) { float increase = 10f; if (actor.TraitManager.HasAnyElement(new TraitNames[] { TraitNames.Daredevil, TraitNames.Disciplined, TraitNames.Athletic, TraitNames.Brave }) { increase += 5f; } actor.Motives.SetValue(CommodityKind.Fun, actor.Motives.GetValue(CommodityKind.Fun) + increase); increase = 10f; if (target.TraitManager.HasAnyElement(new TraitNames[] { TraitNames.Daredevil, TraitNames.Disciplined, TraitNames.Athletic, TraitNames.Brave }) { increase += 5f; } target.Motives.SetValue(CommodityKind.Fun, actor.Motives.GetValue(CommodityKind.Fun) + increase); return Sims3.Gameplay.Socializing.SocialCallback.AfterFight(actor, target, interaction, topic, i); } public static bool TestWrestle(Sim actor, Sim target, ActiveTopic topic, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { return target.TraitManager.HasAnyElement(new TraitNames[] { TraitNames.Coward, TraitNames.CouchPotato, TraitNames.Slob }); } } }
The SocialData XML contains the information of the social interaction: what happens before and after the interaction, which Sims can participate, under which pie menu should the interaction appear, etc. Add a new XML resource to your package (type _XML 0x0333406C) and make sure its instance is the FNV64 hash referenced in the script. In the script above, LoadSocialData tries to load "SocialData_Wrestle" (instance 0x03DB8DA9FE62CD65).
Code:
<?xml version="1.0"?> <Social> <Action key="Wrestle" com="Friendly"> <Text key="Wrestle" pvt="Wrestle" /> <!-- Active and passive localization keys, e.g., "Talk About Art" and "Listen" Localization key: "Gameplay/Excel/Socializing/Action:Wrestle" --> <AD val="0x000C0009"> <!-- Action data bits: DisallowedIfPregnant = 0x00000001 DisallowWhileCarryingChild = 0x00000008 DisallowWhileCarryingMinorPet = 0x00040000 IsAllowedWhileCarryingUmbrella = 0x00080000 + ------------ 0x000C0009 More data bits can be found in "Sims3.Gameplay.Socializing.ActionData.ActionDataBits" --> <Misc ITLA="70" /> <!-- Interestingness to look at Examples: Chat 10 Talk About Art 20 Tell Joke 30 Compliment Appearance 40 Argue 50 Kiss 60 Break Up 70 Accuse of Cheating 80 Have Private Wedding 90 --> </AD> <AA> <AGE x="T,Y,A,E" y="T,Y,A,E" /> <!-- Allowed age groups. x is your Sim, y is the target --> <ALTR min="40" max="100" /> <!-- Minimum and maximum long term relationship between Sim x and y --> <ATR val="Coward,CouchPotato,Slob" /> <!-- Traits that restrict the interaction for Sim x --> <ATE val="Daredevil,Athletic,Brave,Disciplined" /> <!-- Traits that encourage the interaction for Sim x --> <Available auto="False" udo="True" /> <!-- Whether the interaction is autonomous or user-directed only --> <AWT val="Base,Downtown" /> <!-- Allowed type of world, in this example, the interaction won't be available in vacation worlds --> <ProcTest key="emino.Socializing.Wrestle,eminoWrestle,TestWrestle" /> <!-- The procedural test that is called before displaying the interaction in the pie menu. To use an existing EA method, look for the method in "Sims3.Gameplay.Socializing.SocialTest." If you want to use a method of your own, specify your class name with full namespace, the assembly of your assembly and the method. --> </AA> <Jazz> <Graph val="social_fight" data="BaseGame" x="Bad" y="Bad" jig="SocialJigTwoPerson" /> <!-- The animation script that will be used in the interaction --> <LS state="Fight" min="1" max="3" /> <!-- The loop state, Sims should repeat 1, 2 or 3 times the fighting animation --> </Jazz> <Rules> <RHS com="Friendly" state="Steamed"> <Anim /> <Buff x="AdrenalineRush" y="AdrenalineRush" remX="" remY="" /> <!-- Moodlet that will be added or removed after the interaction --> <RPROC pebu="DecideWinnerOfFight" peau="emino.Socializing.Wrestle,eminoWrestle,IncreaseFunAfterWrestle" /> <!-- Procedural effect before and after the interaction, you can use custom or EA methods --> <TUN /> <Trait x="Athletic,Brave,Daredevil,Disciplined" y="Athletic,Brave,Daredevil,Disciplined" /> <!-- Traits that will be learned after the interaction --> <Topic /> </RHS> </Rules> </Action> </Social>
The SocializingActionAvailability xml defines in which types of "short term context" an interaction is available. For example, Sims cannot Make Out if their context isn't alluring, Sims cannot Tell Jokes if the context isn't Hilarious, etc.
Code:
<?xml version="1.0"?> <SocializingActionAvailability> <SAA> <Cat></Cat> <Gr></Gr> <FPA></FPA> <SPA></SPA> </SAA> <SAA> <Cat>Ok</Cat> <!-- Type of shorterm context type --> </SAA> <SAA> <Gr>Default</Gr> <!-- Type of longterm relationship that will be associated to the previous context --> </SAA> <SAA> <Gr>Acquaintance</Gr> <!-- This type of longterm relationship will also be associated with the Ok context --> </SAA> <SAA> <Gr>BestFriend</Gr> <!-- This one too and so on --> </SAA> <SAA> <Gr>BestFriendsForever</Gr> </SAA> <SAA> <Gr>Ex</Gr> </SAA> <SAA> <Gr>ExSpouse</Gr> </SAA> <SAA> <Gr>Friend</Gr> </SAA> <SAA> <Gr>GoodFriend</Gr> </SAA> <SAA> <Gr>OldFriend</Gr> </SAA> <SAA> <FPA>Wrestle</FPA> <SPA>Wrestle</SPA> <!-- Key of the social interaction that will be associated with the previous context. In the Ok context, Sims can wrestle if they are acquaintances, best friends, BFFs, exes, friends, old friends, or good friends. --> </SAA> <SAA> <Cat>Friendly</Cat> <!-- Another type of shorterm context type --> </SAA> <SAA> <Gr>Default</Gr> <!-- Type of longterm relationship associated with the Friendly context --> </SAA> <SAA> <Gr>Acquaintance</Gr> </SAA> <SAA> <Gr>BestFriend</Gr> </SAA> <SAA> <Gr>BestFriendsForever</Gr> </SAA> <SAA> <Gr>Ex</Gr> </SAA> <SAA> <Gr>ExSpouse</Gr> </SAA> <SAA> <Gr>Friend</Gr> </SAA> <SAA> <Gr>GoodFriend</Gr> </SAA> <SAA> <Gr>OldFriend</Gr> </SAA> <SAA> <Gr>Partner</Gr> </SAA> <SAA> <Gr>RomanticInterest</Gr> </SAA> <SAA> <FPA>Wrestle</FPA> <SPA>Wrestle</SPA> <!-- As you may have noticed, Sims cannot wrestle with their romantic interest or partner unless the context is friendly. --> </SAA> <SAA> <Cat>VeryFriendly</Cat> </SAA> <SAA> <Gr>Default</Gr> </SAA> <SAA> <Gr>Acquaintance</Gr> </SAA> <SAA> <Gr>BestFriend</Gr> </SAA> <SAA> <Gr>BestFriendsForever</Gr> </SAA> <SAA> <Gr>Ex</Gr> </SAA> <SAA> <Gr>ExSpouse</Gr> </SAA> <SAA> <Gr>Friend</Gr> </SAA> <SAA> <Gr>GoodFriend</Gr> </SAA> <SAA> <Gr>OldFriend</Gr> </SAA> <SAA> <Gr>Partner</Gr> </SAA> <SAA> <Gr>RomanticInterest</Gr> </SAA> <SAA> <Gr>Fiancee</Gr> </SAA> <SAA> <Gr>Spouse</Gr> </SAA> <SAA> <FPA>Wrestle</FPA> <SPA>Wrestle</SPA> <!-- As you may have noticed, Sims cannot wrestle with their fiancee or spouse unless the context turns Very Friendly. --> </SAA> </SocializingActionAvailability>
I hope this helps you. Feel free to ask more questions in case I failed to explain something clearly.

#3
30th Nov 2012 at 10:36 PM

Posts: 226
Thanks: 604 in 4 Posts
Awesome, that's an excellent barebones. I've been studying twallan's SAA/SocialData injectors and trying to muster up the courage to get cracking on it, but this definitely gives me a leg up since NRaas certainly isn't the simplest framework to learn off of. =)
Who Posted
|