Locked thread | Replies: 92 (Who?), Viewed: 70346 times. | Locked by: HugeLunatic Reason: Please see updated tutorial in wiki, see first post.
Page 2 of 4
The Attack Cat
retired moderator
Original Poster
#26 Old 3rd Oct 2009 at 12:39 AM
Ani: tiger created a jazz script mod thing, ive never tried it but go ahead if you want:
http://www.modthesims.info/download.php?t=365465
Lab Assistant
#27 Old 12th Oct 2009 at 11:07 PM Last edited by cwurts00 : 13th Oct 2009 at 2:22 AM.
Default about other tutorial
You sent us to another tutorial with 4 steps. The first one says "use the Visual Studio C# Template, but I have no idea what program I should be running for these steps.

Edit: I downloaded "Microsoft Visual C# 2008, but it doesn't appear to be the right program, and I was unable to find a copy of "Microsoft Visual Studio 2008 Express" anywhere. I am now stuck on that one step.
Scholar
#28 Old 15th Oct 2009 at 2:13 AM
Thanks for the useful info.

Now I am wondering if anyone has located all the scripts for the Inventory, as I am not in the mood to hunt them down unnecessarily. By "inventory", I am referring to the "virtual napsack" sims store items in, as I would like to override some of it's functions a bit.
Test Subject
#29 Old 24th Nov 2009 at 12:13 AM
Quick Problem: The sims 3 package editor demo link is not working. i downloaded a different program called 3-something, but just in case it doesnt work, could you fix the link?
Field Researcher
#30 Old 29th Nov 2009 at 1:06 PM
Quote:
Originally Posted by zomgwowlolz
Quick Problem: The sims 3 package editor demo link is not working. i downloaded a different program called 3-something, but just in case it doesnt work, could you fix the link?


http://modthesims.info/forumdisplay.php?f=604


That's the link to the forums. It has S3PE and S3OC witch are the two programs you need to download.


This guide is a bit out of date with the current way these programs work, but I was able to follow it perfectly fine.
Lab Assistant
#31 Old 5th Dec 2009 at 5:36 PM
Here's a little something extra for your tutorial, Kolipoki:

If you want to add an interaction to object when it's in a sim's inventory, simply add this code to the object's OnStartup() overridden method:

Code:
public override void OnStartup()
{
    //Add these first two lines ONLY ONCE:
    base.OnStartup();
    base.AddComponent<Sims3.Gameplay.ObjectComponents.ItemComponent>(new object[] { false, typeof(sim) });
    
    //Add this line for each interaction you want to add:
    base.AddInventoryInteraction(TalktoMe.Singleton);
}


Of course, you have to make sure you've cloned your object from an object that you can actually place in a sim's inventory.
Test Subject
#32 Old 16th Dec 2009 at 9:11 AM
Default S3PE Not working?
When I try to modify objects in S3PE and add the key to refer to my new code, I'm running into a bit of a problem. When hit Grid on the OBJK, it doesn't give me a collection of keys (thus causing problems for where I should add a key referring to my new code). Attached you'll find a screen shot (this is actually taken off a cloned bear like the one you used in your example - originally I thought it might just be due the fact that I was using a Dive Well).

I'm wondering if EA changed the way objects are stored in World Adventures and that's why S3PE is having an issue? Any advice is appreciated.
Screenshots
Test Subject
#33 Old 16th Dec 2009 at 9:00 PM
Same problem here. Was thinking it was just me. Is it a change in the game or the latest version of S3PE?
Test Subject
#34 Old 20th Dec 2009 at 11:51 PM
Thanks to some help on another thread I learned that now you just have to hit the "Edit" button under external. It will open up the OBJK editor. Make sure "Script" is checked in this new window, and then input the namespace.class reference to your mod (as you did in Keys previously). That's all it takes.

OBJK editor. How convenient!
Test Subject
#35 Old 26th Dec 2009 at 6:30 AM
Thanks for the Tutorial, unfourtunatly I'm running into a lot of proplems, First up the link to the package editor is dead, but I managed to get the non demo version(one compatible for WAetc.)
Problem starts with the coding though, in Visual Studio I cant find the active configuration refered to in step 3 of the setup link. When ever I ty to do any coding I get one or two error messages, even when I try to copy an exsiting code or your final code in the tutorial (no changes to either), some one else refered to right clicking the error to fix/resolve, but I don't get any options along those lines.
Ended up giving up on that program and went to play around with the S3PE program, and when I get to add resource part of the process I can't seem to get the ok button to highlight, all fields where filled in, tried using the drop down as well as just typing it in and nothing.

All of the other steps work fine, just going around in circles with these two problems, any advice would be appreciated. Thanks.
Instructor
#36 Old 16th Jan 2010 at 10:48 PM Last edited by bella3lek4 : 16th Jan 2010 at 11:19 PM.
Hi ..
i am having a problem ..
i tried to do the Talking Teddy exactly like it's written in the tutorial ..
[ I copied the text in the final results .. from the tutorial .. and i pasted it in my C# project ..]
i did everything as written .. i exported the Dll's and everything ..
i think i did everything right ..
But in game .. when i buy the Talking Teddy and try to click at it .. it gives me the hand grab tool .. and its written .. [ there are no interactions available ] ...
Please help !
Thanks everybody!

--> Sorry for my bad English <--

. I am a 20 years old male ..I'm not a Female .. and my name is not Bella .. as everybody think .
I used to bite .. but i don't do that anymore . Have fun! :)

Lab Assistant
#37 Old 17th Jan 2010 at 5:53 PM
I'm having the same problem as bella3lek4

Smile tomorow will be worse.
Me? Sarcastic? Never.
staff: administrator
#38 Old 17th Jan 2010 at 6:59 PM
Sounds like a framework issue if instead of the object having an interaction menu available it only has the hand for grabbing.

Use Delphy's Framework Installer to make sure your framework is set up correctly.
Instructor
#39 Old 17th Jan 2010 at 10:34 PM
I don't think that's the problem ..
because i have Dexter the bear .. and it works perfectly for me
so i guess it's something else .
Thanks for help!

. I am a 20 years old male ..I'm not a Female .. and my name is not Bella .. as everybody think .
I used to bite .. but i don't do that anymore . Have fun! :)

The Attack Cat
retired moderator
Original Poster
#40 Old 18th Jan 2010 at 12:22 AM
A) I'm surprised that you could get anything working out of the old tutorial as it was so outdated.

B) It does sound like you are missing the framework, but another cause would be the code. If you would have run it you should have gotten an error saying there is no ktip styled notification. I have updated the tutorial and the code so I advise you to try again. If it still does not work, then it has something to do with your computer. I have just gone through the entire new tutorial and have gotten it to work. Good luck.
Lab Assistant
#41 Old 18th Jan 2010 at 1:44 AM
Quote:
Originally Posted by Kolipoki
A) I'm surprised that you could get anything working out of the old tutorial as it was so outdated.

B) It does sound like you are missing the framework, but another cause would be the code. If you would have run it you should have gotten an error saying there is no ktip styled notification. I have updated the tutorial and the code so I advise you to try again. If it still does not work, then it has something to do with your computer. I have just gone through the entire new tutorial and have gotten it to work. Good luck.


I don't know what did it but ether 1)useing Delphys framework tool or 2) using C# 2008 express to code in (i like the intellisence) and use Digitalchaos' Assembly Generator to acttualy make the .dll. anyways it works Now ^^

Smile tomorow will be worse.
The Attack Cat
retired moderator
Original Poster
#42 Old 18th Jan 2010 at 6:47 AM
This tutorial is now on video and can be found at The Sims Supply, here.
Instructor
#43 Old 18th Jan 2010 at 1:58 PM Last edited by bella3lek4 : 18th Jan 2010 at 8:34 PM.
Thanks !
It worked !
Glad that you made the video tutorial ..
it made it easier to understand ! :]
Thank you so much!
Amazing!

Edit:! Adding custom interactions is really really hard ..
can you add In-Depth .. how to add custom interactions .. with some samples .. because it is really hard .. and you didn't explain how to do it ..
you just show us the stereo function ..
so i suggest to explain more .. and give us some examples .. [ Text .. not Video ]

Thanks!
........

Edit ..:
Thanks for explaining ! ..
but could you please show us the code that we should type every new interaction we want to add .. and where can we find the game interactions names?

Thanks! you are amazing!

..........
Edit: I just don't know what to do .. i tried so many things ! Non of them works .. i keep getting errors ! D: !
I really need help .. i am about to die DX ..
Please ..
Give me an example .. to a functional interaction .. lets say .. [ Burn sim .. Get pregnant ]
Please explain .. a functional interaction .. not just a message !
Sorry i am being so weeny .. please be patient with me ..

. I am a 20 years old male ..I'm not a Female .. and my name is not Bella .. as everybody think .
I used to bite .. but i don't do that anymore . Have fun! :)

The Attack Cat
retired moderator
Original Poster
#44 Old 18th Jan 2010 at 5:20 PM
How about I explain the one I have:
Code:
using System;
using System.Collections.Generic;
using System.Text;
using Sims3.Gameplay.Objects.Miscellaneous;
using Sims3.Gameplay.Utilities;
using Sims3.Gameplay.Interactions;
using Sims3.Gameplay.Actors;
using Sims3.Gameplay.Autonomy;
using Sims3.SimIFace;
using Sims3.Gameplay.Skills;
using Sims3.UI;
using Sims3.Gameplay.Objects;



namespace KolipokiMod
{

    public class TalkingTeddy : StuffedAnimal
    {
        protected Sim mRevealingSim;

        public override void OnStartup()
        {
            base.OnStartup();
            base.AddInteraction(TalktoMe.Singleton);
        }
        private sealed class TalktoMe : ImmediateInteraction<Sim, TalkingTeddy>
        {
            // Fields
            public static readonly InteractionDefinition Singleton = new Definition();
            private const string sLocalizationKey = "Gameplay/Objects/Miscellaneous/TalkingTeddy/TalktoMe";
            // Methods
            private static string LocalizeString(string name, params object[] parameters)
            {
                return Localization.LocalizeString("Gameplay/Objects/Miscellaneous/TalkingTeddy/TalktoMe:" + name, parameters);
            }
            protected override bool Run()
            {
                //Do the interaction here.                   
                base.Actor.ShowTNSIfSelectable("Hello", StyledNotification.NotificationStyle.kGameMessagePositive, ObjectGuid.InvalidObjectGuid, base.Actor.ObjectId);
                base.Target.mRevealingSim = base.Actor;
                return true;
            }
            // Nested Types
            private sealed class Definition : ImmediateInteractionDefinition<Sim, TalkingTeddy, TalkingTeddy.TalktoMe>
            {
                // Methods
                protected override string GetInteractionName(Sim a, TalkingTeddy target, InteractionObjectPair interaction)
                {
                    return TalkingTeddy.TalktoMe.LocalizeString("TalktoMe", new object[0]);
                }
                protected override bool Test(Sim a, TalkingTeddy target, bool isAutonomous, ref GreyedOutTooltipCallback greyedOutTooltipCallback)
                {
                    return !isAutonomous;
                }
            }
        }
    }
}


This could be a very bad job but here it goes.

So to start in the class we have protected Sim mRevealingSim. This statement makes a new definition that we can store things in and gives it a protected feature meaning that it cannot be accessed out of the script. This is used later to determine what sim the teddy bear is acting on.

The public override on startup should always be there I believe, but the add interaction is used so it know to make the new interaction

You need actually need to add the interaction and tell it do something. So you make a new class with the interaction name and derive it from the ImmediateInteractions so it will Immediately happen and the sim doesn't have to walk over to it. I haven't tried other interactions but I assume these are easier (or they might be the same).

Next in the script the strings are listed to name the interaction.

As well in the script is the protected override bool Run() which will tell the interaction to do something when called. For this instance we are using the the styled notification to have the game tell the user something.

The last bit of the code, I believe its for like testing to make sure the interaction worked, and the object is not null.
Test Subject
#45 Old 27th Jan 2010 at 3:45 PM Last edited by mesher : 27th Jan 2010 at 3:48 PM. Reason: adding some info...
Thanks for this tut, kolipoli, and for the video at thesimsupply.

My new teddy works like a charm, but there is only one problem : it´s impossible to change the interaction string, like you describe on the last part of your tutorial. I tried it several times, triple-checking the class name (myMod.TalkingTeddy.TalktoMe) and the new generated hash (0xCE472847CC83DDFE), but that long scary string stills on teddy´s interaction menu. Intersting, the other changes that i made, like the name of the object on the first item of STBL, are accepted and showed.

May this be a sims cache issue ?
The Attack Cat
retired moderator
Original Poster
#46 Old 27th Jan 2010 at 9:28 PM
Okay, so there is an easier way that I use to change the string name. In the
Code:
            private static string LocalizeString(string name, params object[] parameters)

            {

                return Localization.LocalizeString("Gameplay/Objects/Miscellaneous/TalkingTeddy/TalktoMe:" + name, parameters);

            }
Change the return Localization.LocalizeString("Gameplay/Objects/Miscellaneous/TalkingTeddy/TalktoMe:" + name, parameters); to simple return "Interaction Name" and whatever you put in the Interaction Name will appear.
Test Subject
#47 Old 28th Jan 2010 at 10:49 PM
You did it again, Kolipoki, it works fine now !

(.... gosh, read the code, mesher, just read the code ....)

There is a new universe to explore now, after a few explorations I was able to create interactions to change several variables, like sim's motives. Now I have some ideas to try...

Thanks a lot, Kolipoki.
Field Researcher
#48 Old 3rd Feb 2010 at 7:49 AM
Regarding localization, the string to hash in the STBL resources must match what you pass in to the LocalizeString method, i.e. in this example you should hash "Gameplay/Objects/Miscellaneous/TalkingTeddy/TalktoMe:TalktoMe" (0x0629857C465A244D).
But you can use anything else as long as what you pass in LocalizeString matches the Hash:
Localization.LocalizeString("AnythingElse", parameters); would look for a a Hash in the resources for "AnythingElse" (0xADD4D8E85F8C9868).

Although I think it's a good idea to follow EA's naming convention [DashSeparatedNamespace]/[ClassName]:[StringName] to avoid having reapeated hashes in the resources.

For avoiding things to look wierd if I forgot to add an Hash on the STBL for some language, I replaced the localization method with this:
Code:
        
        private const string sLocalizationKey = "Desecrate/Sims3Mod/TalkingTeddy";

        private static string LocalizeString(string name, params object[] parameters)
        {
            string key = sLocalizationKey + ":" + name;
            string localizedString = "";

            if (Localization.HasLocalizedString(key))
                localizedString = Localization.LocalizeString(key, parameters);
            else
                localizedString = name;

            return localizedString;
        }
Mad Poster
#49 Old 14th Feb 2010 at 6:09 AM
As I haven't yet found a script mod tutorial (actually I did find on another forum but forgot where it was), I'v been trying to make my first script mod with combining this tutorial, with spying on already made script mods, like twallan's woohooer and the abortion mod.

My problem is that when I'm in the OnWorldLoadFinishedHandler method, and I'm trying to get the list of object already existing,

List<Sim> list = new List<Sim>(Queries.GetObjects<Sim>());

I get the following error.

The non-generic method 'Sims3.SimIFace.Queries.GetObjects(System.Type)' cannot be used with type arguments.

Google is being of no help, as it's telling me to use System.Collections.Generic, but I'm already using it. Any ideas?
The Attack Cat
retired moderator
Original Poster
#50 Old 14th Feb 2010 at 7:37 AM
Try this instead...

List<Sim> list = new List<Sim>(Sims3.Gameplay.Queries.GetObjects<Sim>());

The reason is, is that there are two Queries, one (the one it automatically goes to) is withing the Sims 3 IFace while the one you want is in the Gameplay.
Locked thread | Locked by: HugeLunatic Reason: Please see updated tutorial in wiki, see first post.
Page 2 of 4
Back to top