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
Sockpuppet
Original Poster
#1 Old 3rd Oct 2011 at 9:23 AM
Default Changing sounds and effects?
Is this possible or are those called by a script?
I cloned the firetruck and would like to change the sound and effects.

Could be that both(links) are part of the animation file right?
If so, is it possible to relink the truck to another car animation?
Were would i start?
Advertisement
˙uʍop ǝpᴉsdn ǝɹ,noʎ 'oN
#2 Old 3rd Oct 2011 at 1:19 PM
It looks like they are both called by it's script:
Code:
public class CarServiceFiretruck : CarServiceWithSiren
{
    // Fields
    [Tunable]
    private static Vehicle.CarTunables kCarTuning = new Vehicle.CarTunables();

    // Properties
    protected override string CarAudioSuffix
    {
        get
        {
            return "fire";
        }
    }

    public override Vehicle.CarTunables CarTuning
    {
        get
        {
            return kCarTuning;
        }
    }

    public override string SirenEffectName
    {
        get
        {
            return "firetruckSirenLights";
        }
    }
}

"Part of being a mesher is being persistent through your own confusedness" - HystericalParoxysm
| (• ◡•)| (❍ᴥ❍ʋ) [◕ ‿ ◕]
Field Researcher
#3 Old 3rd Oct 2011 at 9:57 PM
I went ahead and created an extremely rough set of code that took me about 5 minutes to do. It's no where near complete, but you asked for some starting points so here is one. What I did was made a new class named MyFiretruck which is derived from GameObject and IGameObject. I used the class CarServiceWithSiren and CarServiceFiretruck class.

You can use this code to derive a new firetruck called LivingFiretruckToy : MyFiretruck. You should still add in some more standard object methods into MyFiretruck class. You can look at some of the Sims3.Gameplay.Objects.Toys classes to see how it's done.

Code:
    public class MyFiretruck : GameObject, IGameObject
    {
        public abstract string SirenEffectName { get; }
        public VisualEffect mSirenEffect;
        // Honestly, I'm not sure how the FxSlots work. You'll have to research that.
        public static Slot mFxSlot = ((Slot)ResourceUtils.HashString32("_FX_2"));

        public override void Dispose()
        {
            if (this.mSirenEffect != null)
            {
                this.mSirenEffect.Stop();
                this.mSirenEffect.Dispose();
                this.mSirenEffect = null;
            }
            base.Dispose();
        }

        public override void OnCreation()
        {
            base.OnCreation();
            this.mSirenEffect = VisualEffect.Create(this.SirenEffectName);
            this.mSirenEffect.ParentTo(this, mFxSlot);
            this.mSirenEffect.Start();
        }

        public override string SirenEffectName
        {
            get
            {
                return "firetruckSirenLights";
            }
        }
    }
Sockpuppet
Original Poster
#4 Old 4th Oct 2011 at 12:48 AM Last edited by BloomsBase : 4th Oct 2011 at 3:58 AM.
Thank you!

I really want to learn this, its the last step....

Is there a good tutorial that explains were to start? Like:
How to extract/view the original script?
Can it be updated with new(or other default) sounds or effects?
Can you extract it, modify it and reuse it on a custom object?

sorry for all the quistions but i have tons of great ideas and this is the last thing i need to learn......

As a test i wanted to switch the firetruck with the policecar but then both sound as effects are wrong, other then that it works fine.

Problem with most tutorials i need to go study english first before i can understand them
Field Researcher
#5 Old 4th Oct 2011 at 12:44 PM
You should look at Buzzlers game object tutorial, it will explain a lot. He normally checks up on the modding discussion thread. If you send him a PM with this thread link Im sure he can help more then me.

It is possible to replace the existing toy firetruck. You would just have to add in your script to the object. Buzzler shows how to do that in the tutorial i mentioned. The class I gave you is a bit more advance. When I get home I'll work on one similar to the tutorial.
Sockpuppet
Original Poster
#6 Old 4th Oct 2011 at 12:56 PM
i was talking about the Ambitions firetruck
That vehicle can be cloned as normal vehicle and has some nice features
You can tune it and maintanance it

I want to use it to create a car sims can work on, like pop the hood and tune the engine.
The firetruck alraedy has all this, just need to reassigne the animations/sound and effects.

So wat im after is the truck with a custom script attached.
The scripte can be default 99%, but updated with new links/names for the:
Object animation(just a pose)
New or basegame effect(smoke would be cool)
New or basegame sound

I had a look at buzzer tutorial but it is to complicated at this point for me.....
Field Researcher
#7 Old 4th Oct 2011 at 7:46 PM Last edited by Odistant : 4th Oct 2011 at 9:16 PM.
Okay, lets walk through Buzzlers tutorial since it's a bit confusing for you. It can be a bit vague on some parts, so I'll go deeper into it as well.

First off, you do have Visual Studio 2008 Express Installed, yes?

You'll also need the trial version of Reflector too. This lets you explore the Sims 3 Scripts.

Read this on how to setup your project. If you have trouble understanding, I can assist with that as well. http://modthesims.info/wiki.php?tit..._Studio_project

Once you have that all setup you're ready to go and start making a script. You cannot simply "change" the values of the firetruck. You could however do something such as Interaction Injections but that's Twallans expertise.

Alright, so now lets get to the actual coding. You should change the default namespace to something like Sims3.Gameplay.Objects.Bloombase. You want to but sure that you inculde Sims3.Gameplay in the namespace otherwise your scripted object will not work.

Now, lets create the main class (group which contains code) that will contain everything. You will also want to "derive", or set the group the object is based off of. Think of a Apple for example. A Apple is it's own species of plant but it is grouped under the vegetables because it has similarities. The same idea applies to deriving a class.

Open up reflector and import those .dll's that you got from the .package's in the TS3 folder. Go into Sims3GameplayObjects and then go under Sims3.Gameplay.Objects.Vehicles and look for the "CarServiceWithSiren" class. This is what we will be deriving off of. Why don't we derive off of "CarServiceFiretruck"? If we were to do that, then we would not be able to set our own Siren and Effects. If you notice, you can see that the CarServiceWithSiren is derived off of CarService, derived off of CarNpc, derived off of Car, and finally Vehicle is derived off of GameObject. GameObject is THE highest group you can go up to. Object contains every class you will need to make a object script.

So, now lets go back into Visual Studio and put in this code:
Code:
public class MyFiretruck : CarServiceWithSiren


Notice the " : " after the space in MyFireTruck? This is telling the game to use the same "methods" (functions, like how to do a problem in math) for this object as CarServiceWithSiren. It's very possible to use the CarServiceWithSiren class on a object if we really wanted to. It just wont contain the effects that we want it too because it's not defined in the class.

Alright, I'll go deeper into Buzzlers tutorial once you understand this, otherwise we'd be getting nowhere! I also highly reccomend getting a book on C# in your language too as that will help you a ton, as it has helped me. I'm still learning, but I know enough to help you out . Trust me, once you learn C#, you can pick up other similar programming languages very quickly like Java. Also, if you're confused on what ANY word means that I just talked about, please do ask and I can help you with that too if I didn't explain it well.

Edit: I'm working on a tutorial now since I got a ton of free time which goes over C# programming in Sims 3. You can find it here: http://simswiki.info/wiki.php?title...Depth_Scripting
Sockpuppet
Original Poster
#8 Old 4th Oct 2011 at 9:35 PM Last edited by BloomsBase : 4th Oct 2011 at 9:52 PM.
Ok, i will give it a shot, i seen the video and hope i can manage.
So, we will be able to use most of the coding of the CarserviceFiretruck with updates on the animations and effects called?
Or does it not work like that?

When starting you have to setup the folders, do you need to include Ambitions also or does the EP's do not have core libraries?

Thank you!!


Edit,

How would i get the file Carservicefiretruck and view it?
Is this the file CMo showed?


And do i need Reflector because it isn't Free....
Field Researcher
#9 Old 4th Oct 2011 at 10:41 PM
Yes, that is correct!

No, using the base game DLL's are perfectly fine. They are exactly the same.

You view this file by using Reflector. You can use dotPeek which is very similar to Reflector but it's still in it's early development stage. Reflector has a 14 day trial.
Forum Resident
#10 Old 5th Oct 2011 at 12:06 PM
I use ILspy instead of reflector. It's been around for a while, is stable, and works almost the same as reflector.
I've had it since reflector timebombed last january, and no complaints. There's a link for it on here somewhere,
I think it's ...
http://www.modthesims.info/showthread.php?t=436481
... 2nd on buzzlers list.
Sockpuppet
Original Poster
#11 Old 5th Oct 2011 at 12:26 PM
I downloaded Telerik JustDecompile Beta, there are a few programs arround that hopefully do the trick.
Field Researcher
#12 Old 5th Oct 2011 at 12:41 PM
Alright, now that you have the class all made and derived, make sure that you have opened up Sims3GameplayObjects.dll into your decompiler. Look for the vehicles namespace and browse to CarServiceFiretruck. You should be able to search for the class in your decompiler as well. Notice how it calls the methods, functions really, CarAudioSuffix and SirenEffect name? CarAudioSuffix is a part of the Car class and SirenEffectName is part of the CarServiceWithSiren class. Because we derived CarServiceWithSiren it allows us to use all of the Car methods AND the SirenWithSound methods. So with that said, youd type in public override string SirenEffectName. Your basically copy and pasting that method in Firetruck class to your class replacing the siren name with the one you want. Do the same for the audio method.
Sockpuppet
Original Poster
#13 Old 5th Oct 2011 at 2:44 PM Last edited by BloomsBase : 5th Oct 2011 at 3:51 PM.
not so fast lol, im having problems setting up the core library
According to the tutorial(the video) Koli imports 11 .DLL files as reference files in MS visual C but i only have 8....
Following the tutorial I took the files from:
Gameplay.package wich has 3 files in it(Sims3GameplaySystems.dll / Sims3GameplayObjects.dll / UI.dll)
SimsCore.package wich has 3 files in it(System.Xml.dll / System.dll / mscorlib.dll)
Script.package wich has 3 files in it(SimIFace.dll / ScriptCore.dll / Sims3Metadata.dll)
A total of 9 but according to the tut you dont need the mscorlib.dll as it is integrated in MS visual C already, so i have 8

I am still missing 3 files, wich ones and were to locate them?
Field Researcher
#14 Old 5th Oct 2011 at 4:01 PM
Do not use that tutorial. Its outdated. Follow the one i posted before. You are missing the testing dlls which were removed in a patch during ambitions or wa. You really should import the mscorlib as the VS mscorlib is not Mono which is what the game uses.
Sockpuppet
Original Poster
#15 Old 5th Oct 2011 at 5:21 PM
ok, thank you!


It is not possible to import mscorlib. because it is already referenced, you get a error
Field Researcher
#16 Old 5th Oct 2011 at 6:11 PM
Okay, go under Project -> <projectname> Properties.

Once there, select Build. And now click on the button that says Advanced in the bottom right hand corner under the Output category.

When you click on that, uncheck the "Do not reference mscorlib". Now, go into Application tab and make sure for Framework it says .NET Framework 2.0. If not, then change it. That should tell you you need to save project and it will be reopened.

You are now able to import the mscorlib from the package.
Sockpuppet
Original Poster
#17 Old 5th Oct 2011 at 6:23 PM
ok, i also have been browsing the files.
Its the fireengine wat gives the tuning stuff and such

Thnx again
Field Researcher
#18 Old 5th Oct 2011 at 6:55 PM
No problem. If you need any more help I'm glad to help out :D
Sockpuppet
Original Poster
#19 Old 5th Oct 2011 at 7:19 PM
Thank you
I prolly need your help, the script is perfect exept that the tuning of the vehicle is related to the career.
I hope i can find and eliminate that.
Field Researcher
#20 Old 5th Oct 2011 at 10:43 PM
Can you explain what you mean by "tunning of the career"?
Forum Resident
#21 Old 6th Oct 2011 at 2:23 PM
I think he's talking about the animations, where the fireman tunes the engine. (as opposed to xml tuning)
He's trying to get it so it doesn't have to be a fireman.
Field Researcher
#22 Old 6th Oct 2011 at 2:34 PM
Ahh ok. When I get home Ill do some searching on the class. Guessing its getting called somewhere in CarNPC class.
Sockpuppet
Original Poster
#23 Old 6th Oct 2011 at 2:40 PM Last edited by BloomsBase : 6th Oct 2011 at 3:50 PM.
yup,
There are 2 possibility's:
Mantainance on the car wich can do each sim
Tuning of the car speed ingame, this can only a sim do wich is a fireman.
Both are the same animation but unfortunate related to the fireengine(truck)
this prolly means that when you tune the car you will auto tune all firetrucks in town.

Anyway, ill figure it out i hope.
I already have them walk up to the front of the car and pop the hood were they start tuning
And if i can not figure it out you guys prolly can.

This is the car im working on:
http://koti.mbnet.fi/turpuli/garage/vc70gtx.html
Field Researcher
#24 Old 7th Oct 2011 at 12:13 AM
Okay, I had you derive off of the wrong type of car class, sorry!

We'll derive off of FireEngine. I made a big booboo and derived off of the wrong one. I'm so sorry! Mistakes happen, and we learn from them

I'm having you derive off of FireEngine instead since that has what you're looking for. We could derive off of SirenEnabledVehicle if you want too.

The CarService class was for NPC use, which is why you couldn't really change anything. Taking a look at the FireEngine class shows us a ton of different methods we can override to fit our preferences.

I'm honestly not sure if you will need to do something else for it. Just replace the class I had you derive from before and you will probably be good.
Back to top