- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- Modding questions
- Site Map >
- Modding and Creation >
- Sims 3 Creation >
- Modding Discussion >
- Modding questions
Replies: 1 (Who?), Viewed: 1566 times.
#1
8th Jun 2014 at 11:04 AM
Posts: 19
Modding questions
Hi everybodyI started to create some mods but my programming skills aren't very good so I stuck and need some help. I would be grateful if someone could help me.
1. I think it's very annoying when the weather stone appears again and again in spite of the fact I deleted it. I created a core mod, which doesn't allow the wather stone to spawn. My question is: is it possible to create a non-core mod which does the same? I tried it, but it doesn't let me override the original method because it's a static member. Do you know any method that allows me to override?
Code:
using System; using System.Collections.Generic; using Sims3.Gameplay; using Sims3.SimIFace; using Sims3.Gameplay.UI; using Sims3.Gameplay.Core; using Sims3.Gameplay.Objects.Environment; using System.Text; namespace Sims3.Gameplay.Objects.Environment.anagy_summoningmod { public class summonWeatherStone : Sims3.Gameplay.Objects.Environment.WeatherStone { static WeatherStone sInstance; public static void TrySpawnWeatherStone() { if (((ShouldSpawn && !GameUtils.IsAnyTravelBasedWorld() && ((!GameUtils.IsInstalled(ProductVersion.BaseGame))) && !Responder.Instance.TutorialModel.IsTutorialRunning()) && ((sInstance == null) || sInstance.HasBeenDestroyed))) { List<Lot> randomList = new List<Lot>(); foreach (Lot lot in LotManager.AllLotsWithoutCommonExceptions) { if (lot.IsCommunityLot && (lot.CommercialLotSubType != CommercialLotSubType.kEP10_Port)) { randomList.Add(lot); } } if (randomList.Count > 0) { bool flag = false; sInstance = GlobalFunctions.CreateObjectOutOfWorld("WeatherStone", ProductVersion.EP8) as WeatherStone; int num = 10; while ((!flag && (randomList.Count > 0)) && (num > 0)) { num--; Lot randomObjectFromList = RandomUtil.GetRandomObjectFromList<Lot>(randomList); Vector3 position = randomObjectFromList.Position; Vector3 forwardVector = randomObjectFromList.ForwardVector; FindGoodLocationBooleans constraints = FindGoodLocationBooleans.AllowOnSlopes | FindGoodLocationBooleans.LocatorMustBeOnGrassDirtOrSand | FindGoodLocationBooleans.Routable | FindGoodLocationBooleans.PreferEmptyTiles; World.FindGoodLocationParams fglParams = new World.FindGoodLocationParams(position, constraints); if (GlobalFunctions.FindGoodLocation(sInstance, fglParams, out position, out forwardVector)) { flag = true; Vector3 forward = position - randomObjectFromList.Position; forward = forward.Normalize(); if (forward == Vector3.Zero) { forward = forwardVector; } sInstance.SetPosition(position); sInstance.SetForward(forward); sInstance.AddToWorld(); break; } randomList.Remove(randomObjectFromList); } if (!flag) { sInstance.Destroy(); sInstance = null; } } } } } }
2. Connected to the previous mod I want to make the weather stone buyable. I made a recategoriser mod but when I want to place it, the object doesn't appear and I can't put it anywhere.
3. I made a mod which adds the "Buy Lotto Ticket" and the "Buy Winning Lotto Ticket" interactions to the general store register(WA). However, when I tested it the interaction didn't appear.
Code:
using System; using System.Collections.Generic; using System.Text; using Sims3.Gameplay.Objects.Register; using Sims3.SimIFace; using Sims3.Gameplay.Seasons; using Sims3.Gameplay.Core; using Sims3.Gameplay; using Sims3.UI; using Sims3.Gameplay.Interactions; using Sims3.Gameplay.Actors; using Sims3.Gameplay.Utilities; using Sims3.Gameplay.ActorSystems; using Sims3.Gameplay.Autonomy; namespace anagy_BuyLottoAtGeneral { public class AddInteractionBuyLottoTicket : Sims3.Gameplay.Objects.Register.GeneralStoreRegister { public void OnStartupShoppingRegister() { base.AddInteraction(BuyLottoTicket.BuyLottoSingleton); base.AddInteraction(BuyLottoTicket.BuyWinningLottoSingleton); } private sealed class BuyLottoTicket : Interaction<Sim, GeneralStoreRegister> { public static readonly InteractionDefinition BuyLottoSingleton = new Definition(false); public static readonly InteractionDefinition BuyWinningLottoSingleton = new Definition(true); [TunableComment("Buy Lotto period end"), Tunable] private static float kBuyLottoEnd = 18f; [Tunable, TunableComment("Buy Lotto period start")] private static float kBuyLottoStart = 20f; [Tunable, TunableComment("Duration in Sim Minutes that a Sim takes to buy a lotto ticket")] private static float kDurationToBuyLotto = 30f; [Tunable, TunableComment("Lotto ticket price")] private static int kLottoPrice = 10; private uint mLoopingAudio; public override void Cleanup() { if (this.mLoopingAudio != 0) { Audio.StopObjectSound(base.Target.ObjectId, this.mLoopingAudio); this.mLoopingAudio = 0; } base.Cleanup(); } public override void ConfigureInteraction() { TimedStage stage = new TimedStage(this.GetInteractionName(), kDurationToBuyLotto, false, false, true); base.Stages = new List<Stage>(new Stage[] { stage }); base.ConfigureInteraction(); } public bool InRabbitHole() { base.BeginCommodityUpdates(); this.mLoopingAudio = Audio.StartObjectSound(base.Target.ObjectId, "rhole_city_hall_future_lp", true); base.StartStages(); bool succeeded = base.DoLoop(~(ExitReason.Replan | ExitReason.MidRoutePushRequested | ExitReason.ObjectStateChanged | ExitReason.PlayIdle | ExitReason.MaxSkillPointsReached)); base.EndCommodityUpdates(succeeded); if (this.mLoopingAudio != 0) { Audio.StopObjectSound(base.Target.ObjectId, this.mLoopingAudio); this.mLoopingAudio = 0; } if (succeeded) { base.Actor.Household.ModifyFamilyFunds(-kLottoPrice); base.Actor.BuyLottoTicket(); Audio.StartObjectSound(base.Target.ObjectId, "rhole_grocery_oneshot", false); } return true; } private sealed class Definition : InteractionDefinition<Sim, GeneralStoreRegister, AddInteractionBuyLottoTicket.BuyLottoTicket> { private bool mIsWinningLotto; public Definition() { this.mIsWinningLotto = false; } public Definition(bool winningLotto) { this.mIsWinningLotto = winningLotto; } protected override string GetInteractionName(Sim actor, GeneralStoreRegister target, InteractionObjectPair iop) { if (this.mIsWinningLotto) { return AddInteractionBuyLottoTicket.LocalizeString("anagy/LottoAtGeneral/BuyWinningLottoTicket", new object[] { AddInteractionBuyLottoTicket.BuyLottoTicket.kLottoPrice }); } return GeneralStoreRegister.LocalizeString("anagy/LottoAtGeneral/BuyLottoTicket", new object[] { AddInteractionBuyLottoTicket.BuyLottoTicket.kLottoPrice }); } protected override bool Test(Sim actor, GeneralStoreRegister target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { if (this.mIsWinningLotto) { if (!actor.BuffManager.HasElement(BuffNames.InsiderTips)) { return false; } } else if (actor.BuffManager.HasElement(BuffNames.InsiderTips)) { return false; } float hour = SimClock.CurrentTime().Hour; bool flag = true; if (AddInteractionBuyLottoTicket.BuyLottoTicket.kBuyLottoStart > AddInteractionBuyLottoTicket.BuyLottoTicket.kBuyLottoEnd) { if ((AddInteractionBuyLottoTicket.BuyLottoTicket.kBuyLottoEnd < hour) && (hour < AddInteractionBuyLottoTicket.BuyLottoTicket.kBuyLottoStart)) { flag = false; } } else if ((hour < AddInteractionBuyLottoTicket.BuyLottoTicket.kBuyLottoStart) || (hour > AddInteractionBuyLottoTicket.BuyLottoTicket.kBuyLottoEnd)) { flag = false; } if (!flag) { int kBuyLottoStart = (int)AddInteractionBuyLottoTicket.BuyLottoTicket.kBuyLottoStart; int minutes = (int)((AddInteractionBuyLottoTicket.BuyLottoTicket.kBuyLottoStart - ((int)AddInteractionBuyLottoTicket.BuyLottoTicket.kBuyLottoStart)) * 60f); DateAndTime time2 = new DateAndTime(kBuyLottoStart, minutes, 0); greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(GeneralStoreRegister.LocalizeString("anagy/LottoAtGeneral/LottoNotAvailable", new object[] { time2 })); return false; } if (AddInteractionBuyLottoTicket.BuyLottoTicket.kLottoPrice > actor.Household.FamilyFunds) { greyedOutTooltipCallback = InteractionInstance.CreateTooltipCallback(GeneralStoreRegister.LocalizeString("anagy/LottoAtGeneral/NotEnoughFund", new object[0])); return false; } return true; } } public static string LocalizeString(string name, params object[] parameters) { return Localization.LocalizeString(sLocalizationKey + ":" + name, parameters); } } } }
4. I want to make a mod which adds custom loading screens for my own worlds. When I tried to build the solution I got an error: 'Sims3.UI.LoadingScreenController' does not contain a constructor that takes 0 arguments
Code:
using System; using System.Collections.Generic; using System.Text; using Sims3.UI; using Sims3.SimIFace; namespace worldloadingscrmod { public class newworldloadingscr : Sims3.UI.LoadingScreenController { public override void Init() { base.Init(); { this.mTriggerHandle = base.AddModalTriggerHook("OKCancelDialog", TriggerActivationMode.kPermanent, 0x65); sGameTips = null; if (sOverrideGameTipsFilename != string.Empty) { this.LoadGameTips(sOverrideGameTipsFilename); } else { this.LoadGameTips("GameTips"); foreach (uint num in Enum.GetValues(typeof(ProductVersion))) { if (GameUtils.IsInstalled((ProductVersion)num)) { string name = Enum.GetName(typeof(ProductVersion), num); string filename = "GameTips" + name; this.LoadGameTips(filename); } } } sInstance = this; this.mLoadBar = base.GetChildByID(0x6eb5200, true) as FillBarController; if (this.mLoadBar != null) { this.mLoadBar.Initialize(0f, 500f, sLoadValue); } this.mTipText = base.GetChildByID(0x6eb5201, true) as Text; base.Tick += new UIEventHandler<UIEventArgs>(this.OnTick); if (sChosenLoadScreen != -1) { UIManager.SetOverrideCursor(0); this.mCurrentFindableIndex = 0; this.mRandomOrder = new List<int>(sInteractiveLoadScreens[sChosenLoadScreen].mFindables.Count); for (int i = 0; i < sInteractiveLoadScreens[sChosenLoadScreen].mFindables.Count; i++) { this.mRandomOrder.Add(i); } if (!mDebugLoadScreen) { for (int k = 0; k < this.mRandomOrder.Count; k++) { int num4 = this.mRandomGenerator.Next() % this.mRandomOrder.Count; int num5 = this.mRandomOrder[k]; this.mRandomOrder[k] = this.mRandomOrder[num4]; this.mRandomOrder[num4] = num5; } } WindowBase childByID = base.GetChildByID(0x10136ee0, true); if (childByID != null) { childByID.Visible = false; } this.mFindText = base.GetChildByID(0xfdae9b0, true) as Text; this.mFindText.Caption = sInteractiveLoadScreens[sChosenLoadScreen].mFindables[this.mRandomOrder[this.mCurrentFindableIndex]].mLocalizedFindText; this.mPointsText = base.GetChildByID(0xfdae9f0, true) as Text; if (sTotalPointsEarned == 0) { this.mPointsText.Caption = ""; } else { this.mPointsText.Caption = Responder.Instance.LocalizationModel.LocalizeString("Gameplay/Systems/InteractiveLoad:PointsEarned", new object[] { sTotalPointsEarned }); } this.mFlashEffect = base.GetChildByID(0x10136a80, true) as Window; if (this.mFlashEffect != null) { this.mFlashEffect.Visible = false; } this.mButtonHolder = base.GetChildByID(0xfdaea40, true); for (int j = 0; j < sInteractiveLoadScreens[sChosenLoadScreen].mFindables.Count; j++) { foreach (ulong num7 in sInteractiveLoadScreens[sChosenLoadScreen].mFindables[j].mButtonIds) { Button button = this.mButtonHolder.GetChildByID((uint)num7, false) as Button; if (button != null) { button.Click += new UIEventHandler<UIButtonClickEventArgs>(this.OnButtonClick); button.ShadeColor = Color.Preset.None; if (j == this.mRandomOrder[this.mCurrentFindableIndex]) { button.IgnoreMouse = false; button.Enabled = true; } else { button.IgnoreMouse = true; button.Enabled = false; } } } } Window window2 = base.GetChildByID(0x6eb40ff, true) as Window; if (window2 != null) { window2.SetImage(this.GetLocalizedLogoKey()); } base.TriggerDown += new UIEventHandler<UITriggerEventArgs>(this.OnTriggerDown); this.mRewardStopwatch = StopWatch.Create(StopWatch.TickStyles.Seconds); this.mFindTimeout = StopWatch.Create(StopWatch.TickStyles.Seconds); this.mFindTimeout.Start(); return; } string str3 = string.Empty; ProductVersion version = ProductVersion.Undefined | ProductVersion.BaseGame; if (sbLoadingSaveGame && (sSaveGameMetadata != null)) { Window window = base.GetChildByID(0x6eb5210, true) as Window; (window.Drawable as ImageDrawable).Image = sSaveGameMetadata.mLotThumbnail; window.Invalidate(); window = base.GetChildByID(0x6eb5212, true) as Window; (window.Drawable as ImageDrawable).Image = sSaveGameMetadata.mHouseholdThumbnail; window.Invalidate(); Text text = base.GetChildByID(0x6eb5211, true) as Text; text.Caption = sSaveGameMetadata.mHouseholdName; switch (sSaveGameMetadata.mWorldFile) { case "China": str3 = "world_loading_beijing"; goto Label_0676; case "Egypt": str3 = "world_loading_cairo"; goto Label_0676; case "France": str3 = "world_loading_paris"; goto Label_0676; case "Twinbrook": str3 = "world_loading_twinbrook"; goto Label_0676; case "Bridgeport": str3 = "world_loading_bridgeport"; version = ProductVersion.Undefined | ProductVersion.EP3; goto Label_0676; case "AppaloosaPlains": str3 = "ep5_world_loading_screen"; version = ProductVersion.Undefined | ProductVersion.EP5; goto Label_0676; case "Starlight Shores": str3 = "world_loading_EP6World"; version = ProductVersion.EP6; goto Label_0676; case "Moonlight Falls": str3 = "world_loading_EP7World"; version = ProductVersion.EP7; goto Label_0676; case "Sims University": str3 = "world_loading_university"; version = ProductVersion.EP9; goto Label_0676; case "IslaParadiso": str3 = "ep10_world_loading_screen"; version = ProductVersion.EP10; goto Label_0676; case "Oasis Landing": str3 = "world_loading_future"; version = ProductVersion.EP11; goto Label_0676; case "testing": str3 = "loadingscr_testing_customworld1"; version = ProductVersion.BaseGame; goto Label_0676; } } else if (!sbTravellingHome) { if ((sWorldFileMetadata != null) || (sTravelWorldName != string.Empty)) { Text text3 = base.GetChildByID(0x6eb5220, true) as Text; if ((sWorldName != WorldName.Undefined) || (sWorldFileMetadata == null)) { text3.Caption = Responder.Instance.LocalizationModel.LocalizeString("Ui/Caption/TravelLoadingScreen:TravelingTo", new object[] { sTravelWorldName }); if (sWorldName == WorldName.China) { str3 = "world_loading_beijing"; } else if (sWorldName == WorldName.Egypt) { str3 = "world_loading_cairo"; } else if (sWorldName == WorldName.France) { str3 = "world_loading_paris"; } else if (sWorldName == WorldName.University) { str3 = "world_loading_university"; version = ProductVersion.EP9; } else if (sWorldName == WorldName.FutureWorld) { str3 = "world_loading_future"; version = ProductVersion.EP11; } } else { text3.Caption = Responder.Instance.LocalizationModel.LocalizeString("Ui/Caption/GameEntry/LoadingScreen:WelcomeText", new object[] { sWorldFileMetadata.mCaption }); string mWorldFile = sWorldFileMetadata.mWorldFile; if (mWorldFile != null) { if (!(mWorldFile == "Twinbrook.world")) { if (mWorldFile == "Bridgeport.world") { str3 = "world_loading_bridgeport"; version = ProductVersion.Undefined | ProductVersion.EP3; } else if (mWorldFile == "AppaloosaPlains.world") { str3 = "ep5_world_loading_screen"; version = ProductVersion.Undefined | ProductVersion.EP5; } else if (mWorldFile == "Starlight Shores.world") { str3 = "world_loading_EP6World"; version = ProductVersion.EP6; } else if (mWorldFile == "Moonlight Falls.world") { str3 = "world_loading_EP7World"; version = ProductVersion.EP7; } else if (mWorldFile == "IslaParadiso.world") { str3 = "ep10_world_loading_screen"; version = ProductVersion.EP10; } else if (mWorldFile == "testing.world") { str3 = "loadingscr_testing_customworld1"; version = ProductVersion.BaseGame; } } else { str3 = "world_loading_twinbrook"; } } } } } else { Text text2 = base.GetChildByID(0x6eb5220, true) as Text; text2.Caption = Responder.Instance.LocalizationModel.LocalizeString("Ui/Caption/TravelLoadingScreen:TravelingHome", new object[0]); string str6 = sTravelWorldName.ToLower(); if (str6 != null) { if (!(str6 == "twinbrook_0x09b610fa")) { if (str6 == "bridgeport_0x09ffe3d7") { str3 = "world_loading_bridgeport"; version = ProductVersion.Undefined | ProductVersion.EP3; } else if (str6 == "appaloosaplains_0x0c50c56d") { str3 = "ep5_world_loading_screen"; version = ProductVersion.Undefined | ProductVersion.EP5; } else if (str6 == "ep6world_0x09b610ff") { str3 = "world_loading_EP6World"; version = ProductVersion.EP6; } else if (str6 == "ep7world_0x09b61110") { str3 = "world_loading_EP7World"; version = ProductVersion.EP7; } else if (str6 == "ep10_broadpass_0x0c50c382") { str3 = "ep10_world_loading_screen"; version = ProductVersion.EP10; } else if (str6 == "testing") { str3 = "loadingscr_testing_customworld1"; version = ProductVersion.BaseGame; } } else { str3 = "world_loading_twinbrook"; } } } Label_0676: if (!string.IsNullOrEmpty(str3)) { ImageDrawable drawable = base.Drawable as ImageDrawable; drawable.Image = UIManager.LoadUIImage(ResourceKey.CreatePNGKey(str3, ResourceUtils.ProductVersionToGroupId(version))); base.Invalidate(); } this.mTipStopwatch = StopWatch.Create(StopWatch.TickStyles.Seconds); this.ShowRandomUnseenTip(); UIManager.SetOverrideCursor(0x1003); } } private const string kCustomWorld1Image = "loadingscr_testing_customworld"; private const string kCustomWorld1Name = "testing"; public const string kWorldFileNameCustomWorld1 = "testing.world"; } }
You can download the 2nd and 3rd mod to test it.
Thanks in advence
Attached files:
anagy_buyableWeatherStone.rar (468 Bytes, 6 downloads) - View custom content | ||||||||||
Size Packed Ratio Date Time Attr CRC Meth Ver ------------------------------------------------------------------------------- anagy_buyableWeatherStone.package 479 371 77% 08-06-14 11:26 .....A. A983A4E0 m3b 2.9 ------------------------------------------------------------------------------- 1 479 371 77% |
||||||||||
anagy_buylottoatgeneral.rar (5.5 KB, 5 downloads) - View custom content | ||||||||||
Size Packed Ratio Date Time Attr CRC Meth Ver ------------------------------------------------------------------------------- anagy_buylottoatgeneral.package 6861 5489 80% 08-06-14 09:25 .....A. 1FBC8ED4 m3b 2.9 ------------------------------------------------------------------------------- 1 6861 5489 80% |
Never say never.
Advertisement
#2
29th Jun 2014 at 5:09 PM
Posts: 19
Could someone help me please?
Never say never.
Never say never.
Who Posted
|