Home | Download | Discussion | Help | Site Map | New Posts | Sign in

Latest Site News

2018 MTS Calendar Contest - posted on 12th Nov 2017 at 8:48 PM
Replies: 1 (Who?), Viewed: 1739 times.
Test Subject
Original Poster
#1 Old 15th Oct 2017 at 8:45 AM
Default [HELP] Add bed features into desk
Hi everyone. I try to add all bed features into a desk, and keep all desk features. I have went over some guides and i tried to make a bed internaction code into dll and replace into deskmission. Which is a new desk object.

This is what i've done so far, i have been strugle for sometime now, and i still cant seems to find a solution. Please help and thx in advance!

Quote:
Hi everyone. I try to add all bed features into a desk, and keep all desk features. I have went over some guides and i tried to make a bed internaction code into dll and replace into deskmission. Which is a new desk object. This is what i've done so far, i have been strugle for sometime now, and i still cant seems to find a solution. Please help and thx in advance! Code:
Code:
using System; using System.Collections.Generic; using System.Text; using Sims3.Gameplay.Objects.Miscellaneous; using Sims3.Gameplay.Interactions; using Sims3.Gameplay.Actors; using Sims3.Gameplay.Autonomy; using Sims3.SimIFace; using Sims3.UI; using Sims3.Gameplay.Objects.Beds.Mimics; using Sims3.Gameplay.Objects.Beds; using Sims3.Gameplay.Interfaces; using Sims3.Gameplay.Objects.Tables.Mimics; namespace Sims3.Gameplay.Objects.Tables.Justin10Mod { class DeskBed : DeskMission { public sealed class Rest : Interaction<Sim, Desk>, ICountsAsIndoorInteraction { public readonly static InteractionDefinition Singleton; static Rest() { Rest.Singleton = new Rest.Definition(); } protected override bool Run() { base.StandardEntry(false); base.BeginCommodityUpdates(); this.Actor.Posture.CurrentStateMachine.RequestState("x", "RelaxIdle"); this.Actor.WaitAndGroupTalk(); this.Actor.Posture.CurrentStateMachine.RequestState("x", "Relax"); base.EndCommodityUpdates(true); base.StandardExit(false, false); return true; } [DoesntRequireTuning] private sealed class Definition : InteractionDefinition<Sim, Desk, Rest> { public Definition() { } protected override bool Test(Sim a, Desk target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback) { return target.CanBeLookedAt; } } } public override void OnStartup() { base.OnStartup(); base.AddInteraction(Rest.Singleton); } } }
Download - please read all instructions before downloading any files!
File Type: zip justin10_DeskMission_E5649826.zip (135.1 KB, 4 downloads) - View custom content
Advertisement
MakeNeedsStaticOn
staff: super moderator
#2 Old 17th Oct 2017 at 7:10 PM
First thing worth pointing out is that the OBJK's script line isn't correctly assigned as it should be:

Sims3.Gameplay.Objects.Tables.Justin10Mod.DeskBed

Since it's always Namespace + the name of the class

I'm not really sure if that would fix it. I think this tutorial might be interesting for you just to get the actual core table script added to it, although it's not exactly done this way: http://www.modthesims.info/wiki.php...ClassWithTuning

Second thing you want to figure out is to get the bed's bones assigned to the mesh as well as in the RIG file Sounds... quite complicated, I know. Although it seems like your script and package only really has the desk data.

Script related, you seem to have the bed stuff, but what I'd personally do is actually use the class:

internal class DeskBed : Bed
{

So then, the bed stuff will be already added to it, then maybe taking a look at the 'BedSingle' for slot related stuff would be really helpful too
Create a new class, (Which can be done by clicking on the project, add>new item and use the 'class' one and call it in your case 'Justin10Desk') right click and What I'd do is copy paste the normal desk script, (so the Desk script that EA made) Into that class and save it.

Code:

private static void AddInteractions(DeskBed deskbed)
		{
			foreach (InteractionObjectPair current in deskbed.Interactions)
			{
				if (current.InteractionDefinition.GetType() == Justin10Desk.Singleton.GetType())
				{
					return;
				}
			}
			candle.AddInteraction(Justin10Desk.Singleton);
		}


Now it added the desk script with your bed script What i'd look into is Instantiator. It helps you add scripts to an object during start up and basically fixes all of your 'oh no my interaction's not there but I did everything right!' issue

Let me know if that worked out for you!
Back to top