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
Lab Assistant
Original Poster
#1 Old 11th Apr 2017 at 5:53 AM
Default Hopping through "Start a Fire" interaction creation process
Someone asked me about how I made it so that sims can start fires in my Sorcerer Trait mod.

Rather than give an obscure and vague explanation that no one but them ever sees, I thought I'd put together a brief overview of how I accomplished it. This isn't going to be a step-by-step tutorial. Think of it more like a window into the process of my figuring it out.

The focus here is how "able to start fires" specifically and what did the process entail.

The short version is this: I went and looked at the XML files for ghosts who can start fires and copied/adapted the relevant bits. This is the "short version" for modding most anything in this game, though it's rarely as "short" as it sounds and certainly wasn't in this case.

The long version is: I was thinking about how fires are spawned and I remembered that there's a type of ghost that can start fires when they're angry; sims who became ghosts because they died from a fire. I wasn't sure how this is triggered, so I started digging through the files with keywords like "ghost" and "fire," and eventually found that they have a special Whim when they're angry, which triggers the Start a Fire interaction.

This Whim uses a Continuation. A Continuation is exactly what it sounds like; it seamlessly goes from one piece into another (and that "other" is always an interaction... I've never seen a Continuation that is not an interaction). In this case, it goes from the Whim and continues into the SuperInteraction "StartFire." The two most common types of interactions are SuperInteraction and SocialMixerInteraction. SuperInteractions are generally used for stuff that the sim does independently and SocialMixerInteractions are used for conversation interactions, such as Get To Know.

In this case, I found that the Continuation linked right into playing the interaction StartFire. StartFire doesn't have any values in it to do with duration; it just has an angry animation that plays once and then when the interaction ends, its "single outcome" content is to loot a fire object. In this case, it loots a debug fire object, which is set to spawn a fire on whatever object the interaction is connected to. I didn't find any special properties tied to this fire object as being "debug"; it's distinction was just that the only thing looted was the fire itself on an object. The only difference for the non-debug loot fire file was that it had a test in it, blacklisting fire from being looted if the object has the buff "recent_fire" on it.

In my case, I didn't want a restriction like that. I wanted fires to be spawnable with as few restrictions as possible, so loot debug in, loot non-debug no good.

Now that I had a way to "loot" (spawn) a fire object, I still needed a way to trigger it in an interaction of my own. My first instinct was to look at / copy code from interactions that already appear when you click on the ground. For example, the Go Here interaction. Go Here is a special type of SuperInteraction that has you walk to the specified part of the ground you click on. At first, I experimented around with a GoHere that had a Continuation into starting a fire. I believe I got this working at one point and then realized it was not what I wanted; if Bob the test sim walked to the same spot he was going to start a fire at, he would just set himself on fire.

So I threw out doing it with two interactions. Instead, I set up a single SuperInteraction that would appear when you click on the ground. I built a timer into this interaction, in the range of maximum of 10 seconds and minimum of 5 seconds. But I also needed an animation that would loop while the interaction was running and I didn't want to try to learn the process of creating/implementing an entirely new animation. So I needed to reuse something that the game already used for looping.

I believe I more or less stumbled upon the animation for warming yourself at a fireplace. Which, incidentally, is where the text Warm Self came from. I didn't even bother to create a new text string for starting a fire; I used the one from warming yourself at a fireplace, "Warm Self," which I thought sounded like a cute "oops, I'm a wizard" way to describe one casting a spell that starts a fire on the ground. I made its "single outcome" be the loot fire object debug and put a check in its global tests, so that the interaction only appears if the sim has the sorcerer trait.

(This is simplifying a lot. There was a lot of blundering, testing, and experimenting throughout all of this.)

The reason I chose to write it this way is because 1) a tutorial would require either explaining an enormous amount of stuff about the code or assuming that you know stuff you may not know and 2) I wanted to illustrate what the process was actually like. I didn't wake up one day, decide I'm going to make an interaction that involves a sim starting a fire, and did it in 20 minutes. I spent hours reading and comparing code, trying things, and blundering my way through it until I figured it out. Since making that interaction, I have a lot better understanding of how interactions are connected and it's mainly because I've made a lot more and different types of interactions since then.

I am happy to be helpful when I have the time and I don't want to be one of those people who says something weird like, "It builds character to figure it out yourself." The reason I'm focusing on the process, rather than step-by-step in this case, is because learning how the code works in this game is an ongoing process with no clear beginning and end. There's an enormous amount of code to learn about and knowing how one interaction works doesn't necessarily mean you'll know how another works. So I figured maybe people can benefit more from knowing the kind of process I went through because it's the process itself that has taught me most of what I know about the code. And I can't emphasize enough the value of looking at the code for examples of how something works that you can copy from.

♫ Improvising into a corner ♫
♫ No rhyme or rhythm in this verse cause I'm in a corner ♫
Advertisement
Test Subject
#2 Old 13th Apr 2017 at 2:41 PM
Thanks it helps a lot and it is explained really well.
Back to top