Search this Thread |
![]() |
#26 | |
zoe22
|
If you look at the pure modding tutorial (Here) it explains this: Quote:
And this means custom code can be run, because the game can find it when it is assigning the values of tunable variables that it finds in the the xml files. When the variable in the class is being accessed to be assigned the value found in the xml, the constructor of the class is called, which means the class is made and put into action, and so your code will be run. At least that's what I understand of it, and sorry if this is actually more confusing! ![]() So basically your tunable instantiator variable in the Instantiator class (neither actually need to be called Instantiator I'm pretty sure, but I guess the name just describes what it's doing) can be assigned a value by an xml file (because it's tunable) and so you make your xml file (in the pure scripting tutorial) which the game will read, and because the game assigns all variables found in xmls, it will access the Instantiator variable in your code, and in turn the Instantiator class will be "instantiated", running your code basically. Basically you need two things, a variable in your code (can be any thing but for example a bool called Instantiator), and an xml file in your package file that assigns the variable some value (so like kinstantiator = true). And the tutorial tells you how to make your xml resource ![]() Hope this makes sense, the tutorial I linked does explain how it actually works but it took me a while to get it and I think it's easier to do stuff when you actually understand what's happening, so I thought id try to explain it in more detail ![]() |
|
|
|
![]() |
#27 |
Lyralei
|
(Here's also a part in the tutorial, see "Writing the XML"Â*http://www.modthesims.info/wiki.php...ripting_Modding ) Also make sure to add something like: [Tunable] protected static bool kInstantiator = false; (Or name it anything else, like Zoe mentioned ![]() |
|
|
![]() |
#28 |
LittleCheshire |
*walks into this thread 3 months later, but with starbucks this time* Hey...hey...how y'all doin'? ![]() Long story short, I took a break from this project due to personal reasons and this project, while very loved and wanted to be seen to completion, was not helping me cope with those personal reasons. So I'm pretty stable now and ready to open it up and take it back on. I've reread this thread a few times to refresh myself and I think I'm getting somewhere now, I just need to go very, very slow. While I'm here though, I wanted to ask how I could get ILSpy working with SharpDevelop? It says to install the ILSpy Addin but I can't find that specific file anywhere; on the internet or on my computer. |
Oh c'mon. There better be a point to all this stress I'm under. |
|
|
|
![]() |
#29 |
zoe22
|
You don't actually need to get them working together as far as I know. There is also a ILSpy addon for Visual Studio though I haven't worked out how it works :P IlSply just decompiles the game dlls so you can see the game code and copy paste/use as a reference etc. The you use Sharp Develop to write your code and compile it ![]() Honestly I'm not sure what the ILSpy plugins actually do. |
|
|
![]() |
#30 | |
LittleCheshire |
Quote:
That's why I want to get it to work with SharpDevelop! ![]() | |
Oh c'mon. There better be a point to all this stress I'm under. |
||
|
|
![]() |
#31 | |
zoe22
|
Quote:
What exactly do you need to get it working with SharpDevelop for? You should just be able to open the game dlls with IlSpy to see all the game code, which you can then use to write your own script in SD - I'm not sure why you would need the plugin for that to work? Adding the references to your project is a separate thing - when I meant use as a reference, I just meant see how the game code works so you can work out what you need to do to get your own code to function how you want it. Sorry if that was what confused you ![]() |
|
|
|
![]() |
#32 |
Battery
|
Im not completely sure since my setup dates back some time by now but as far as i know SD already has the ilspy functionality included by default. To test my hypothesis just write a simple Test.
Code:
[Tunable] internal static bool kInstantiator = false; do a right click on [Tunable] and see if you can select Go to Definition this should show you the decompiled version from the source dll other than that im also puzzled why you dont use ilspy directly. |
|
Last edited by Battery : 6th Sep 2020 at 2:54 PM.
|
![]() |
#33 | |
Lyralei
|
Quote:
![]() ![]() | |
|
|
![]() |
#34 | ||
LittleCheshire |
Quote:
Nope! I understood what you meant perfectly. ILSpy works separately, but I wanted to have it in SharpDevelop as a plugin as it would save me some time. But hey, If I can't use it as a plugin that's fine! Water off a ducks back, honestly. ![]() Quote:
That actually doesn't work for me, unfortunately. We might be using different versions of SharpDevelop! I wanted to use ILSpy from the plugin in SharpDevelop to save time and space, but using it directly is fine as well and that's what I'm going to start doing from this point onwards. I'll come back here if I need help with anything else or want to ask more questions! ![]() | ||
Oh c'mon. There better be a point to all this stress I'm under. |
|||
|
|
![]() |
#35 |
LittleCheshire |
*coughs* Quick question @Lyralei Does the Object Modding (Interactions) tutorial also apply to adding interactions to terrains like grass, sand, and the ocean, instead of objects? Are there any differences at all that I should know of? |
Oh c'mon. There better be a point to all this stress I'm under. |
|
|
|
![]() |
#36 | |
Lyralei
|
Quote:
![]() The tutorial you linked though is if you make your own object and want it to do particular things ![]() ![]() Let me know though if you need some more help with that though! Since the first few reads it tends to be a bit overwhelming to fully understand all of that ![]() | |
|
|
![]() |
#37 |
zoe22
|
And here I was completely clueless about the ILSpy plugin and just using it separately all this time :P |
|
|
![]() |
#38 |
aino
Test Subject
Join Date: Mar 2005 |
Got my little hello world working and it was much less hassle than I expected. The build succeeded in the first try but I had to tweak a little the code to get the message showing. My experiences about getting simple hello world to run: 1. Project configurations seem to be in .csproj -file. I took advantage of the csproj-files of other sims mods and didn't bother to find all the right settings from visual studio 2019 user interface. My project file could probably use some fine tuning. For example, I don't know if you need all the sims sources, unless you use them. 2. I skipped the part with reflector and took sims dlls from Nraas github. They had some differences to the original version, but they seem to be working... at least for Hello World -purposes. 3. The hello world was written without Reflector or IlSpy, but I installed IlSpy after making it. I couldn't get IlSpy Visual Studio add-on working out of the box. Standalone version seems to be fine. I would be nice to find smarter workflow to view the code, though. 4. Visual studio is either clunky or I can't use it. Next step might be looking for nicer IDE. |
|
|
![]() |
#39 |
LittleCheshire |
Okay so basically, I have three coding projects I'm working on and I'm bouncing between the three of them like a kangaroo on crack because I have nothing too serious on my plate at the moment that will keep me away from coding and learning how to do it. Right now I'm dedicating time to the second project; which is me adding a new social interaction into the game that requires me to modify an existing social interaction in the game. I was wondering how I could give this existing interaction a new definition? I can post what little code I already have, if that helps as well. ![]() There are mods out there that would be very helpful to me if I could like, see their code and see how they Do The Thing, but every time I run them through S3PE all I see is gibberish! |
Oh c'mon. There better be a point to all this stress I'm under. |
|
|
|
![]() |
#40 |
LittleCheshire |
Okay actually, I retract that upper statement! I'm pretty sure I got that new definition thing down. I only have a very quick question: are internal sealed classes derivable? I'm trying to derive from an interaction that is an internal sealed class but IntelliSense or whatever autofill feature SharpDevelop has isn't picking it up. Can I use the internal sealed class anyway and the autofill feature not picking it up isn't a problem? |
Oh c'mon. There better be a point to all this stress I'm under. |
|
|
|
![]() |
#41 |
Battery
|
No you cant The sole purpose of the sealed keyword is to prevent Inheiretance (there is a "funny" statement that says that people who use the sealed keyword should be sealed away themselfs because its just stupid in most cases ![]() |
|
|
![]() |
#42 |
LittleCheshire |
Oh, I see! Thanks. ![]() |
Oh c'mon. There better be a point to all this stress I'm under. |
|
|
|
![]() |
#43 |
PuddingFace
|
@LittleChesire Modify an existing social interaction? Which interaction cause a lot of them are coded differently. Some of the social interactions are just all SocialInteractionA or something. |
|
|
![]() |
#44 |
LittleCheshire |
Hello @PuddingFace The interaction I want to modify is indeed a SocialInteractionA interaction; it's the Pet Fight interaction and I want to have it to where it has a chance of killing the target. I also want this action to be autonomous for pets with specific traits, and for the Sims being attacked to have a chance of surviving depending on traits, athletic skill, or both. |
Oh c'mon. There better be a point to all this stress I'm under. |
|
|
|
![]() |
#45 |
PuddingFace
|
Do you see the interaction's ITUN file or code? If not then you can't modify. I will instead recommend that you disable this interaction with an ITUN and create a new fight interaction for pets. And then you can do what you want with this new interaction. |
|
|
![]() |
#46 |
LittleCheshire |
Well let's see, lookin' through S3PE I can see the ITUN file for the interaction and lookin' through ILSpy I can see the interaction's code. So going of your words I can modify the interaction into a custom one. Although, creating a new interaction? That sounds excellent, I would love to do that except...I don't know how. I'm just barely grasping how to use existing interactions and code to cobble together an interaction by going off these tutorials: https://modthesims.info/wiki.php?ti...Depth_Scripting https://modthesims.info/showthread.php?t=491875 Also, disabling the Fight Pet interaction with an ITUN? I don't want to replace the Fight Pet interaction with my own. |
Oh c'mon. There better be a point to all this stress I'm under. |
|
|
|
![]() |
#47 | |
Lyralei
|
Quote:
![]() So: (C# code snippet:
Code:
XML:[Tunable] protected static bool Cheshirefrown = false;
Code:
I also usually hash the XML file like so: "NAMEPSPACE.CLASSNAME". With has I mean, you double click on the XML file in S3PE, you see the 'name' input field. You paste in the correct Namespace + Classname and click 'FNV64' <?xml version="1.0" encoding="utf-8"?> <base> Â* <Current_Tuning> Â* Â* <Cheshirefrown value="True"> Â* Â* Â* <!-- Scripting Mod Instantiator, value does not matter, only its existence --> Â* Â* </Cheshirefrown> Â* </Current_Tuning> </base> ![]() Else, which is a super rare thing to happen, it's really just the website's encoding that notepad (or notepad++, whatever text editor you're using) that isn't compatible with the sims 3. And therefore it wouldn't read it. At least I had that happen to me after I copied it from another file I downloaded... But I doubt it's that. Just a heads up that it COULD be that.Â* Hope this helps! ![]() | |
|
|
![]() |
#48 | |
PuddingFace
|
Quote:
Oh you will have to create a new interaction anyway if you want to change an EA interaction with script. You will have to replace the EA interaction with yours using script. If the interaction didn't have ITUN or code then you will have to remove the interaction with tuning and add your custom interaction in. It's not too hard to create your own interaction. | |
|
|
![]() |
#49 |
LittleCheshire |
Thanks for the explanation, Lyralei! I figured that out a while ago, and have learned a lot since then, but I genuinely thank you for laying the information out like that; I understand Instantiators and XMLs completely now! It's not too hard to create a custom interaction? So does this mean I'm on the right track of following this tutorial? |
Oh c'mon. There better be a point to all this stress I'm under. |
|
|
|
![]() |
#50 |
PuddingFace
|
Yea that tutorial will help you get started. You will learn to make an immediate interaction. And then with that you can make a regular interaction with animations as well. |
|
|
![]() |