Instantiate is basically a term used for spawning.
In this section we will create layouts that will spawn our projectile and our warm up. Skills
work by calling on layouts at certain points of an event. The layouts basically work like how one would create a map, but these layouts only contain spawners, logic, and particles.
Lets start with the Warmup.
Start a new layout, File>>New, make sure you're in the Layout Editor.
The warm up will consist of 3 components:
Timelines are used to play a sequence of events chronologically, which is basically what connects this particular layout. The particles are what the timeline will show through the course of time, and the sound will be what the skill
will make when it is casted.
So lets create:
- 1 Timeline - Right Click object explorer>>Logic>>Timeline
- 1 Layout Link Particle - Right Click>>Building Blocks>>Layout Link Particle
- 1 Sound - Right Click>>Sounds>>Sound
Lets work on the Particle first.
Select the Layout Link Particle and switch attention to the Properties editor.
Lets leave the orientation alone for this skill
Position on the other hand is important when creating a skill
. If you decide to take a look at the warm up for any skill
, you would see particles/animations playing at a point close to 0, 0, 0(x, y, z). That's because the character position is at 0, 0, 0. Because we want our warm up to come from the character we are playing, we place the particle effect we want near our character, but we don't want 0, 0, 0 since that is dead center on the character. Lets move it a bit.
This will make the warm up particle play slightly ahead of the player and at hand level
Obviously we need the particle to be on, so set Enabled to True.
Start on Load is not necessary in this situation since we are controlling the particle through our timeline, so leave it on false.
Yes we want to see our particle, so true on Visible.
Now we select the particle we want for the layout link under the Resources category. For the layout file select the warmup particle we made earlier in "[mod project]\media\particles\[PlayerSkills\[the skill name]\"
If you want to use a custom sound you will need to go through the process of adding it to the Sound Bank, but lets not go into that here.
You are not limited to one sound effect though, most of the great sounds you hear in any form of media is usually a mash up of multiple sounds to create the sound you want. For the sake of the tutorial lets not worry too much about the precise sound for the skill
, just remember that you are not limited to just one sound effect.
Select the Sound node; in the Workspace you should see a yellow wire frame sphere, that is the Radius of the "Environmental Sound" meaning the sound will fade in or out depending on the player position. Since this is a skill
layout that will be right where the player is in game, you will hear it period.
Now switch your attention to the Properties. The fields are pretty straight forward, you have the file category, the position category, and the Sound category.
In the file category you will select your sound from the sound bank by selecting a category and then selecting the "Sound Group"*
*Sound Group - Ever wondered why Adam says so many different lines everytime you swing, equip, unequip, or drop the Sword of Adam? Its because the Swing uses a Sound Group, and draws a sound from said group each swing.
For the skill
lets just use the Fireball
sound, which is found under the category Skills
and named FIREWANDLAUNCH.
Position, because you want it heard from the player position in game, set it to 0, 0, 0 which is dead on the player.
For the Sound category, you will adjust how loud it is, how you hear it, and how far.
Environmental - This option when true will put the Radius into play, the sound will fade in and out depending on the player's position. Lets set this to true, so the sound will feel like its coming from the player.
Radius - This is the radius of the Environmental option, which is portrayed in the editor through the yellow sphere. Lets set it to 10.
Start on Activate - This will force the sound to play on the call of the layout. Since we want control over when it plays, maybe not for this skill
, but in another, we will leave this one on false.
Volume - This is how loud it'll be, lets set it to 0.7.
Okay, so now we have the objects we need to create the warmup, we need to make them launch, which is where the timeline comes in.
Timelines play events/logic chronologically similar to how Logic Groups
play events through logic.
Lets look at the properties. If you're not interested in the math or more complex functions of a timeline, ignore the details of Layout Control, Interpolation, Type, and Step. Which is what I'm gonna do since they serve no purpose in this tutorial.
Reset Properties - Does exactly that it resets the properties of the objects in the timeline. Set it to True
Start on Load - Setting this to true will start the timeline when it is loaded. Oddly though, the timeline starts even if its set to false for skills
. Set it to False because Runic does it :P.
Layout Control - True
Type - None
Default Interpolation - Linear
Duration - This is how long this timeline will run, lets set it from anything between 0.5 to 1.5.
Loop - Because we are making a skill
, we don't want the effect to loop, so false.
Step - 0
Now that we have the properties done, let start on the timeline itself.
Select the Timeline, a new wrench/hammer icon will appear at the top of the object explorer. This is the External Tool Icon, it only appears for nodes that have external tools like the Timeline and the Logic Group
. Clicking it opens the Timeline Editor in this case. Click it.
A new window will open and it should look something like this:
Drag the Layout Link Particle and Sound objects into the white column on the left.
Below is a Video that shows what to do inside this editor, this timeline is not very complex, so the video should explain itself, but I will guide you through it below.
The video starts off with me dragging in the Sound and Layout Link Particle objects
Then has me selecting the logic or property to launch from the Context Menu(Right Click) for each object.
The logic or property appears in the center column with "timelines" under each.
I right click to open the context menu and select add point for each, and drag the point to 0 on the timeline.
What this timeline does is play both the Sound and the Particle the moment it is called.
Save your layout as "blueballwarmup.layout" inside the folder where the skill
will be. Usually it'll be something like: "\mods\[mod name]\media\skills
\[class]\[skill]" where [class] is the new class
and [skill] is the skill
So now you have a Layout that'll be used for the warm up towards your skill
For this layout we will actually make our projectile fire.
Start a new layout.
To create this layout you need:
1 or more Sounds
1 Unit Spawner
Properties for the timeline and Sound are exactly the same as the Warm up's so use their properties. The timeline Duration however is shorter at 0.1.
The Unit Spawner is the main star here, it will be the one that'll shoot our projectile. If you watched the Official Scripting Video Tutorials from Runic Games
, you should understand basically how they work, but in context to shooting a projectile, there are some things to know.
The angle or the arch your projectile will fire from. If you only want 1 projectile, the arch should be small. So, select the Angle field in the properties and click on the [...]. It should open a new window.
Set the value to a very small value, and make sure it is a "FIXED" value.
The angle determines how close or how far apart the projectiles will fire if you have more than 1.
For our skill
lets set the Count(under Properties) to 1.
Make sure they do not Target the Player, that is intended for Monsters
Set Spawn on Create to false, so that the projectile will spawn on our command.
Set the Min Radius to 0.5 FIXED so it'll fire as close to the player as possible.
Instead of Spawning Monsters
we are going to Spawn Missiles, so under Resources, change the group to Missiles and then browse for the missile we created. If you save it in the TorchED
folder it should appear in that menu after a restart of TorchED
Lets open the timeline editor for this timeline.
Again I'm gonna do this in a Video and it should be as easy to follow as the previous one, and explain below:
This timeline is very similar to the warm up's one, except you are spawning missiles instead of playing particles. The video starts off with me dragging the Spawner and the Sound object into the timeline editor. Then selecting the logic I want played when the timeline reaches the point. Then adding points to the beginning of the timeline for both objects.
Save your layout as "blueball.layout" inside the folder where the skill
will be. "\mods\[mod name]\media\skills
\[class]\[skill]" where [class] is the new class
and [skill] is the skill
name. Should be the same place as the warmup.
We are now on the home stretch, all that is left is the Effects
data and placing it on the Class