Replies: 17 (Who?), Viewed: 4379 times.
Lab Assistant
Original Poster
#1 Old 16th Jan 2016 at 6:08 PM
Default The Snowboard (aka: how to tell in a script which mesh using)
Hi!

I'm trying to edit the Seasons snowboard mesh, but the game keeps reverting to the original mesh instead of using my own, though it uses my new multiplier and overlays. I tried to clone the snowboard with the Workshop, with s3oc, I tried to clone the adult and the child versions, every times, no matter what I try, the game ignores my new mesh.

Though I don't know anything about modding, I checked the Sims3.Gameplay.Objects.Environment with ILSpy and found, under Snowboard, instructions for the game to use a specific mesh (I think), with mCurrentModelState : Snowboard.SnowboardModelState. It comes with 3 "options": Ground, In Use and Wall.
My question is how I could force the game to use my mesh? Even if I have to give up the wall option (I'm not sure how it gets on wall, if it's just a footprint matter or if it requires another mesh).
Would it be doable by a newbie like me?
Advertisement
Virtual gardener
staff: administrator
#2 Old 16th Jan 2016 at 6:31 PM
I once had this with one certain Accessory, and the problem was that I didn't replace the LODS. I think the wall one does require another mesh, since I don't think EA made objects this way that it would 'rotate'(or whatever position) it by itself. It's the same as when your sim is reading a book and you would grab the book in buy mode. Now you should imagine it when you sim is using the snowboard and you would grab it just like the book. I guess the board won't appear as a wall mesh or a ground mesh, or anything at all.
Did you changed the LODS already?
Lab Assistant
Original Poster
#3 Old 16th Jan 2016 at 7:32 PM
Thanks for your input!
I don't have access to the wall mesh, actually. It's not located in a geostate (the books are). the only mesh that can be replaced is the ground position (but it's still not the one that is used in game). I'm puzzled.
Virtual gardener
staff: administrator
#4 Old 17th Jan 2016 at 11:59 AM
Quote:
Originally Posted by ATS Sandy
Thanks for your input!
I don't have access to the wall mesh, actually. It's not located in a geostate (the books are). the only mesh that can be replaced is the ground position (but it's still not the one that is used in game). I'm puzzled.


Hmm... It could be that they are both different sets. Like EA made a 'snowboard on the ground' set and a 'snowboard for the wall' set and that they would eventually become one set. EA has done weirder stuff when it comes to their way of 'merging'.
Lab Assistant
Original Poster
#5 Old 17th Jan 2016 at 1:25 PM Last edited by ATS Sandy : 17th Jan 2016 at 5:03 PM.
I made some tiny improvements: by editing the script and my mesh name, I managed to make my mesh appearing, but then, nothing works.
So, I guess there's also changes to do to the "Snowboard" script (for now, I've only edited the "snowboard adult" one).
At least, I edited a script without making my game exploding, that's a good start!
It's indeed a weird EA idea to have processes that way. :sigh:

EDIT: Somehow, my references don't stick in my project.
I mean, in Visual C# 2008, I have:
Quote:
using System;
using Sims3.Gameplay.Abstracts;
using Sims3.Gameplay.Actors;
(and more)


but when I open my .dll with ILSpy, I only see:
Quote:
using System;


So, I wonder if my object doesn't work because it doesn't find the references? I followed that tutorial to create my project, but maybe I failed somewhere?
Virtual gardener
staff: administrator
#6 Old 17th Jan 2016 at 7:08 PM
I'm not really experienced in script mods, but maybe it might be because of using Visual C# 2008 instead of the 2010-2012 version? Anyway, it should have sticked to the, doesn't matter what version of it I guess. Maybe doing the entire progress again would work? I bet it is a lot of work, but if you might have accidentally skipped a part or maybe removed a thing without knowing, It might be worth trying. Sorry if this isn't the answer you were looking for >-< But i'm glad to hear you're progressing!
Lab Assistant
Original Poster
#7 Old 17th Jan 2016 at 7:49 PM
I really appreciate your support! I feel less lonely in that dark universe of code!
I tried to remake the project from scratch, but it didn't work better; I guess I remade the same mistake, so I'm downloading Visual Studio 2015. As I have a slow connection and that it requires Windows updates I hadn't made, this is going to take a couple of hours. Awwww, the things we're doing for Sims!
Virtual gardener
staff: administrator
#8 Old 17th Jan 2016 at 8:49 PM
Quote:
Originally Posted by ATS Sandy
I really appreciate your support! I feel less lonely in that dark universe of code!
I tried to remake the project from scratch, but it didn't work better; I guess I remade the same mistake, so I'm downloading Visual Studio 2015. As I have a slow connection and that it requires Windows updates I hadn't made, this is going to take a couple of hours. Awwww, the things we're doing for Sims!


As a CC creator, I know exactly what you mean XD But let's hope Visual Studio 2015 will fix the problem! Let me know if it fixed it ^-^
Instructor
#9 Old 18th Jan 2016 at 2:44 AM
You may want to try Xamarin Studio, it has better handling of not referencing a particular .dll which is necessary for TS3 coding.
Lab Assistant
Original Poster
#10 Old 18th Jan 2016 at 5:39 PM
Thanks for your input, Matthew!
It seems the problem isn't a lack of references; Visual 2015 told me these were not necessary and deleted them as well. Wasn't more lucky with Xamarin.

I'm going to explain what I'm doing, so someone might see what I'm doing wrong.

I checked the Snowboard in ILSpy and found this:

Quote:
using Sims3.Gameplay.Abstracts;
using Sims3.Gameplay.Actors;
using Sims3.Gameplay.ActorSystems;
using Sims3.Gameplay.InteractionsShared;
using Sims3.Gameplay.Interfaces;
using Sims3.Gameplay.ObjectComponents;
using Sims3.Gameplay.Objects.Decorations;
using Sims3.Metadata;
using Sims3.SimIFace;
using Sims3.SimIFace.CustomContent;
using Sims3.SimIFace.Enums;
using System;
using System.Collections.Generic;

namespace Sims3.Gameplay.Objects.Environment
{
public abstract class Snowboard : GameObject, IViewable, IGameObject, IScriptObject, IScriptLogic, IHasScriptProxy, IObjectUI, IExportableContent, IViewableBase, ICarryableHasProductVersion, ICarryableUseGenericSwipe
{
public enum SnowboardModelState : short
{
InUse,
Wall,
Ground
}
public bool IsOwned = true;
private bool mbHandToolPlacementOnWall;
private Snowboard.SnowboardModelState mCurrentModelState;
[Tunable]
private static AbstractArtObject.ViewTuning kViewTuning = new AbstractArtObject.ViewTuning();
protected abstract string BaseModelName
{
get;
}
[...]


In the SnowboardAdult, I found this:

Quote:
using System;
namespace Sims3.Gameplay.Objects.Environment
{
public class SnowboardAdult : Snowboard
{
protected override string BaseModelName
{
get
{
return "snowboardAdult";
}
}
}
}


I understood it as: the game will define if the snowboard is in use, on wall or on the ground to display the mesh. It needs the mesh name, so it knows if it's the adult or child mesh that will be displayed.
Maybe I'm already wrong here, but that was my starting point.
I hoped that if I could say to the game "use my mesh instead of SnowboardAdult", it would be fine. It's what I tried to do by making this script, based on the SnowboardAdult.

Quote:
using System;
namespace Sims3.Gameplay.Objects.Environment.SnowboardAdultATS3
{
public class SkateboardAdult : Snowboard
{
protected override string BaseModelName
{
get
{
return "snowboardAdultATS3";
}
}
}
}


I've renamed my mesh "snowboardAdultATS3" in the InstanceName of the OBJD, I've imported my script and renamed my OBJK "Sims3.Gameplay.Objects.Environment.SnowboardAdultATS3.Skateboard"
The game now displays my mesh instead of EA's snowboard, but that's all, nothing works from there. I can't use my skateboard, and I don't know why...
Field Researcher
#11 Old 18th Jan 2016 at 6:06 PM
If you were hoping to have sims use the custom snowboard when boarding on the halfpipe, the object class has to inherit from the default SnowboardAdult class (according to the TryCreateOrGetBoardFromInventory method in the UseHalfPipe interaction class. Similarly a child version would have to inherit from SnowboardChild).

Try having your object class inherit from the SnowboardAdult class instead. You'll probably have to rename your object class to something else e.g.

public class SkateboardAdultATS3 : SnowboardAdult

since reusing "public class SnowboardAdult : SnowboardAdult" is probably confusing to both human and machine alike.
Lab Assistant
Original Poster
#12 Old 18th Jan 2016 at 8:01 PM
Thanks a lot for your input, icarus (I'm a big fan of your mods, BTW!). I hadn't thought about checking the half-pipe code indeed!!! I'm such a newbie!!! That's my first attempt to "mod" something, so... I'm quite clumsy!

So, I tried what you suggested and my script looked like this:

Quote:
using System;
namespace Sims3.Gameplay.Objects.Environment.SnowboardAdultATS3
{
public class SkateboardAdultATS3 : SnowboardAdult
{
protected override string BaseModelName
{
get
{
return "snowboardAdultATS3";
}
}
}
}


My OBJK was "Sims3.Gameplay.Objects.Environment.SnowboardAdultATS3.SkateboardAdultATS3", but this time, my mesh (still named "snowboardAdultATS3") didn't show at all, neither EA's mesh did.
Field Researcher
#13 Old 19th Jan 2016 at 9:59 AM
I really haven't much clue on how object meshing and works, but if you look at the OnStartup method in the original Snowboard class (which should run when you first place the object down) and follow what it does, you'll see that eventually the game will run the SetModelAndSlurpModel which, from what is written there, sets the model for the object according to whether it's on a wall or not. It reads the BaseModelName value which in this case is "snowboardAdultATS3" and accordingly adds "Wall" or "Floor" to get the model name to set. So it looks like you'll need to provide models corresponding to "snowboardAdultATS3Wall", "snowboardAdultATS3Floor" as well as "snowboardAdultATS3" (which is the model used when a sim is actually using the board on a half pipe), though that's as far as my object creation know-how goes (which is to say, nowhere).
Lab Assistant
Original Poster
#14 Old 19th Jan 2016 at 4:46 PM
Thanks again, Icarus!
It seems this is a too ambitious project for me!

When I clone the snowboard in S3OC (and in the TSRW), there's only one mesh, but I think it can be used for "in use", "ground" and "wall" with the adequat footprints, as you can rotate an object from there, but I'm not sure about that point. Maybe the wall and ground meshes aren't cloned for any other reason.
Anyway, I searched everywhere in the file for any other "snowboardAdult" reference; I found one in the XML (replaced it by "snowboardAdultATS3"), found one in RIG (replaced it by "snowboardAdultATS3") and found a "snowboardAdultFloor" in the OBJD under Material Blocks that I replaced by "snowboardAdultATS3Floor") That's the thing I could that seemed the closes of your recommandation (I don't know how to add a new mesh with its proper OBJD and so on; I tried a rough "duplicate" on OBJD with a new InstanceName, but of course, it didn't work).

But the mesh still doesn't appear.
I also tried to replace these in the file where I had the mesh appearing but where I couldn't do anything with it, but I still can't do anything with it.
Grrrrr, that's so frustrating!
Field Researcher
#15 Old 19th Jan 2016 at 5:12 PM
Correct me if I'm wrong, but rereading your post where you first said your mesh did appear in game, you typed "Sims3.Gameplay.Objects.Environment.SnowboardAdultATS3.Skateboard" as the object class in your OBJK file, but the class name in your project was "SkateboardAdult" instead of just "Skateboard" so "Sims3.Gameplay.Objects.Environment.SnowboardAdultATS3.SkateboardAdult" is what should go in the OBJK. It could be just a typo there, but it would explain the object not working in game if the game can't locate the object class for the object.
Lab Assistant
Original Poster
#16 Old 19th Jan 2016 at 6:47 PM
Sorry, it was a typo in my post (I hadn't copied-pasted it as the mod if actually on another computer), the OBJK was correct. That was a good thought, though!!!
Lab Assistant
#17 Old 23rd Jan 2016 at 12:08 PM
This looks very interesting! Good luck Sandy! <3
Virtual gardener
staff: administrator
#18 Old 24th Jan 2016 at 11:23 AM
Quote:
Originally Posted by ATS Sandy
Sorry, it was a typo in my post (I hadn't copied-pasted it as the mod if actually on another computer), the OBJK was correct. That was a good thought, though!!!

I just saw the skateboard set on your site! Can't wait for this snowboard to come out too!
Back to top