Overview
This guide is the up-to-date guide on creating a Flare spell and a Fireworks spell after an update fundamentally changed how some of the mechanics surrounding spell creation work.
Flare
FLARE
[imgur.com]
Now, if you’ve seen the pre-update Flare code, found here, you’ll notice two things are different:
Firstly, I lowered the mana to 1. It’ll just make it easier down the road when we make Fireworks.
More importantly, you’ll see a light blue box, a pink box, and within the pink box, a red box. These additions are not strictly necessary, but they’re required if you want the spell to fizzle on its own like you might expect a flare or firework to do.
1. The light blue box is a Call Function box. It tells the code to perform the actions included in whatever Function you have it point to. I have it pointing to “Fizzle.” The Function names are whatever you want them to be- whatever will help your personal sense of organization best. For all anyone else cares, it could say “Function 1” or “Daddy issues”. It really doesn’t matter so long as you understand it.
2. The pink box is the Function I’m calling to with the light blue box. I name it “Fizzle” (since I called to “Fizzle” earlier. If their names don’t match, the code won’t work!) All the Function “Fizzle” does is it tells the game to destroy the orb we created with the spell by using the red box Destroy Orb.
So, in effect, the spell casts an orb (at slow speed), which waits for two seconds before Calling to the Function “Fizzle” which destroys itself. This gives you a quick, easy, two-second light. Yay!
If you’ve read the previous guide, the game used to automatically fizzle your spells based on how much mana it cost (roughly 1 second per mana to my understanding). Now, we have to do it manually.
Here’s what your finished product should look like in gif format.[gfycat.com]
Fireworks
FIREWORKS
[imgur.com]
(I’ll skip the basic explanation of how Fireworks’ code is laid out, since it’s very well-documented in the previous Steam guide[http//imhttps]. The only things we’re changing here are numbers.)
Astute observers will note there’s only two major changes between this version and the old version.
Firstly, the total mana cost appears to be much higher. Secondly, the mana cost per additional orb generated by the loop is also different- it lists a 1 for every slot instead of a 2 for Earth and a 0 for the other three. Why? Well, the answer requires a couple different pieces of information:
1. Since the update, the Cast Spell function requires a mana cost of each type regardless of whether or not the spell you’re casting originally cost mana of that type. So despite the fact that our original Flare cost 1 Earth mana and nothing else, the Cast Spell function in Fireworks will cost 1 of all four mana types.
2. As to why our total cost is 40 mana per each instead of 20, when each Cast Spell loop should only cost 1 mana, and we’re only looping 20 times (you sly reader, you)- that’s something else that appears to be bugged. The total mana cost of a spell that uses the Cast Spell function in each category is double what you would normally need. So, in this case we’re casting Flare 20 times at 1 of each mana per cast. However, for some reason, this requires double the projected total mana cost, bringing it up to 40 of each type.
Once you’ve made the changes, it should look like this.[http//imhttps%3Ahttp]
If you haven’t made the changes, you’ll receive an error indicating that you don’t have enough mana to perform the spell.
That’s my little guide! I hope that helps people who were as lost as I was for a couple hours!
And if you found yourself wondering “Hey Janube, why did you name your spells ‘Flare Boring’ and ‘Fireworks Boring’?” It’s because before I decided to do this tutorial, I made some modifications to Fireworks to make it a tiny bit more… Exciting[gfycat.com]