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
Virtual gardener
staff: administrator
Original Poster
#1 Old 25th Apr 2016 at 10:47 PM
Default Adding a 'broken' mesh through a script mod and animated snow
Hi guys!

So I am making this snowglobe and of course, snowglobes break when you drop them. So I wanted to make something similair to the sims like this as well. I am pretty new when it comes to scripting, but I do know the basics as I have looked deeper into adding interactions to something. But I was wondering if there is a way to make the game switch textures? And with that I mean, say your sim 'breaks the snowglobe, that the snowglobe will show this 'broke glass' texture (as the glass part is actually only a texture). How do I add that to the script? Do I need to make it link it only through the script or need to do more?

Also, I was wondering how I could make a texture animated? like gifs do, but then in-game. Since I have a gif that I want to use for the snow, I was wondering how to make the snow animated in the snowglobe. I've tried to do something similair to this but I was deeply lost on how to actually do this, so I was wondering if this is actually possible, or do I need a part of the script of the magic mirror from the supernatural expansion pack?
Advertisement
Instructor
#2 Old 26th Apr 2016 at 8:52 AM
It's possible to switch textures at runtime. One way I'm aware of involves adding the texture as a material definition in the MODL (using S3PE), then calling SetMaterial to make the switch. The material definition will need an entry in the MODL's material state block. This entry will need to contain the FNV32 hash of the string that is passed to SetMaterial. That's how the code looks up the texture. There are some additional things to consider when adding material definitions to the MODL, but this is the gist of it.

As for animation, another object that might be useful to look at is the fancy electronic dartboard that comes with Late Night. It has animations that vary according to game score. I don't know much more than that about animations.
Virtual gardener
staff: administrator
Original Poster
#3 Old 26th Apr 2016 at 12:29 PM
So I tried to clone these stone piles from WA where your sim has to break the stones, so I could see how to scripted it but for some reason S3OC doesn't clone the script with it. It might be because I cloned it wrong, but I made sure I clicked 'deep clone' so I'm not sure where I can find these scripts. I've tried to find one before and the only script I seem to get open are the 'XML' ones but I don't need these. I'm not sure which file I need for scripting at this point and where to find the needed scripts >-<
Instructor
#4 Old 26th Apr 2016 at 6:22 PM Last edited by Butterbot : 26th Apr 2016 at 6:48 PM. Reason: Added question.
Code for basegame and expansion pack objects are in the core libraries. Basically a lot of the code for each EP is patched into the core whether the user owns the EP or not. There are several tutorials on how to extract and decompile them for working with in Visual Studio and something like ILSpy (free) or Reflector (pay)--they explain the procedure better than I can. The OBJK points to the class used by the object. Only objects from the store are packed with their own script (which also uses stuff from the core libraries, obviously), AFAIK. In this case, the S3SA resource can be extracted using S3PE, provided that the .package has been decrapped.

The XML files contain no scripting logic; they're more like resources that scripts read for tuning parameters, constructing objects, etc.

Also, are the stone piles you're investigating the tomb ones that sims break apart with a pick ax? I haven't played tombs in a while, but I think that's more than just a texture change, as the rock piles crumbles. Maybe a geostate?
Virtual gardener
staff: administrator
Original Poster
#5 Old 26th Apr 2016 at 8:34 PM Last edited by Greenplumbbob : 26th Apr 2016 at 10:25 PM.
Yup it is! I guess either a changing mesh or texture changing would do okay with this. I'm not sure if the rocks that you have at the end of pick axing these stone pile share the same texture or not, but I can change the UV map and make it share the same texture but just the glass parts to have a different UV location (So like the broken glass texture next to the not broken glass texture)
Oh well that explains why I couldn't find the scripts in 'gameplay' (as Objk said) And why XML was showing me all these texture information.

I'll see how far i'll get with the knowledge I have about scripting, but I probably am expecting myself returning with many question >-<

Edit: So, as I was following this tutorial: http://simswiki.info/wiki.php?title..._Object_Modding
I understood about everything, but then I was reading the 'your custom script' and I'm not sure if there is any file i'm suppose to have opened besides the OBJK. Also, I was wondering if it was right that S3PE exported the core libraries as 'file' and not as a DLL or some sort.
Instructor
#6 Old 26th Apr 2016 at 10:51 PM Last edited by Butterbot : 29th Apr 2016 at 12:22 AM. Reason: Grammar
Quote: Originally posted by Greenplumbbob
I understood about everything, but then I was reading the 'your custom script' and I'm not sure if there is any file i'm suppose to have opened besides the OBJK.


The tutorial starts to explain scripting at that point. The Visual Studio project should be set up and the core libraries loaded by then. You can open up any class in ILSpy or Reflector (for example, the one used by the WA rocks) and get a feel for how things are set up by EA to help you follow the tutorial more easily.

To export/import libraries from S3PE, right-click on the S3SA resource and choose "Export DLL" or "Import DLL" at the bottom of the context menu.
Virtual gardener
staff: administrator
Original Poster
#7 Old 28th Apr 2016 at 1:41 PM Last edited by Greenplumbbob : 28th Apr 2016 at 5:31 PM.
Allright! I managed to find certain scripts that gave me animated snow. I only need to change the interaction scripts and see what I need to do to make the mesh 'break' but it seems that I need to make seperated scripts for them, like the board breaker from WA.

Thanks for the export/import explanation and the tutorial part because that one got me stuck! The files did work that way in ILspy but MV 2008 Express didn't.

EDit: Here is what it looks like right now with the animated snow: http://greenplumbboblover.tumblr.co...ould-i-leave-it
Instructor
#8 Old 28th Apr 2016 at 11:28 PM
@Greenplumbbob

Holy cow, that looks amazing!
Virtual gardener
staff: administrator
Original Poster
#9 Old 29th Apr 2016 at 10:43 AM
I extracted the mesh from SimPE (after looking for it for 3 days straight), But then I realised Numenor found it already and I only used the codes as reference to find the textures. I edited the glass though, but it's a start of what I wanted! I only need to figure out how to make it change when it's broken as well, but I guess I should be looking at the rubble pile somewhat better and see what it does. I understand the coding much better though, thanks to that tutorial and you helping me out at some points! Thanks!
I'll go see if I can somehow make it break.
Back to top