Making a ballistic missile

From ARK Modding Wiki
Jump to navigation Jump to search

Introduction

This tutorial will teach you how to make a ballistic missile that can strike anywhere on the surface of an ark. The models for the missile silo and the missile itself were made by pleasure in his tutorial here <>.


Explanation

This ballistic missile will have several components.

The first component is the missile silo. The silo will allow you to craft ballistic missiles and then fire them. The silo will have an inventory component where you can craft a missile and a button where you can launch the missile.

The second component is the ballistic missile. The missile will be a moving actor that allows up to four passengers and it will have a launch phase, an ascent phase, a level out phase, a descent phase, and finally a terminal phase where if the missile touches anything it explodes. The ballistic missile cannot be shot down or stopped.

The third component is a locator structure. This structure will act as a target for the ballistic missile and a tribe may only have a single one placed on the map at one time.

The final component is an explosion actor. The missile itself will be able to be seen anywhere on the map however, the destruction of structures,dinos,players,and foliage uses up large amount of processing power so we make a second local actor that manages the destruction so only near by players will have to process the damage.

Setting Up

This project will include many different blueprints that will work concurrently so to start with we will create all the actors and fill out their defaults and logic one at a time. To start with make a copy of the smithy and call it Structure_MissileLauncher or something similar. Then create a primal inventory component called Inventory_MissileLauncher. Next create two generic actors, one called "Ballistic Missile" and the other called "ExplosionActor". Finally create a decal actor and call it "radiation decal".

For any mod you also need primal game data which you can learn about in the ark mod community manager tutorials located in a playlist here.


https://www.youtube.com/watch?v=Ap1szFuAKxY&list=PL2o1TY9xh_JsmbgQfSCydfT-7OSdvxsVR

Building the missile silo

The Items

For our missile silo we need two items, the missile silo item so we can actually place the structure down and the ballistic missile item itself. Red dwarf goes over what type of item to make for a structure and a simple item in this part of his solar panel tutorial https://wiki.arkmodding.net/index.php?title=Tutorial:_Solar_Panel#Setup_the_Primal_Items.

The structure

Since this structure will be able to craft items step one is to make a copy of the storagebox_anvilbench and put it in your mod folder. Next add three custom functions to your blueprint called begin launch , missile added, missile removed. Set all three events to multi cast and reliable so that the events occur on all players and the server.

Defaults

  • Static mesh: Set this to your missile silo static mesh
  • Blueprint multi use entries: set this to true so that we can add custom multi use entries to this structure for our launch command

Making the Multi use entry

First go into the event graph and search for multi use in the search bar on the left. Then right click BPgetmultiuseentries and implement function then do the same for BPtry multi use. This will add the two multi use functions we will be working in.

Your make multi use entry should look like this.
2.png

Next go into the BPGet multi use entries graph and right click the multi use entries array output on the input of the function and promote to variable. Name the variable to local multi use. This variable will store our single multi use entry and then output it from the function. Create a make multi use entry. Set use string to "launch missile". Expand the node by clicking the down arrow and set display on inventory UI to true. This will add a button to the inventory component that lets you launch will still in the inventory. Set the use index to any number above 10,000. Keep note of this number since it will be used later. Get your local multi use variable drag off of it and make an add node then connect your make multi use node output to this add node. Link all the execution wires up together and make another get local multi use variable that connects to the output of the function.

Finally go to your BPtry multi use graph and drag off use index and create a switch on int. Make the start index for your switch the number you choose for your make multi use entry and add a single pin. Make that single pin execute your launch missile event and wire up the function. Some people like to add a force net update before the function ends to insure both the client and server are synced after the multi use is executed.

Setting up the event graph

Creating the events

To begin with the event graph you need to create three custom events(search custom event in the blueprint browser) named missile slotted, missile removed, and launch missile.(Note these can be whatever you want but I'm specifying the names for consistency in the tutorial). All three events will be reliable. Missile slotted and missile removed as their names imply will handle all the changes the launcher makes when a missile is ready in the launch vs when it's not. Therefore these two events are multicast because they will be both controlling client changes like particle effects and server effects like spawning a rocket actor when a missile is slotted. Missile launch however will run lots of logic but all the client side stuff that happens like noises are going to be taken care of the rocket itself. The missile launch event will only have to deal with the logic required for a missile launch and not it's client consequence thus it is a server side only event.

You need these three events in your event graph

Creating the variables


The next step is to create two variables that will be used in the event graph. The first variable is a boolean called "ismissileslotted?" and the second variable is a object variable of the ballistic missile we made in setting up named "Missile". The local multiuse is also a variable but it will not be used in the event graph.


3.png

Missile removed


We will now begin filling out the events. The first event we will fill out is the "missile removed" event. This event will be fired from the inventory component whenever there is no available missile items in the missile silo. So the event will start by setting the "missileslotted" variable to false and then get a reference to our "Missile" variable and destroying that actor. Finally set the value of "Missile" to none.

4.png


Missile slotted

Next up is the missile slotted event. First we set the "missileslotted" variable to true then we check if the "missile" variable is valid, if it is we already have a missile slotted thus we do nothing. If there isn't a value for "missile" or the value is broken we spawn a new missile from the launcher location + offset and set that to the new value of "missile"

8.png

The inventory component

Building the targeting station

Building the missile

Building the explosion actor

Defaults

Setting up the event graph

Decal

A decal is an actor that uses a special material to apply textures to objects in the world. For this tutorial we will use a decal to make the area affected by the ballistic missile look irradiated. To start with create a material called "M_RadiationDecal". Next set the domain of the material to "DefferedDecal", this lets the material know it will be used for a decal and opens the material inputs needed for a decal.

5.png

The next step is to fill out the graph. We will have a texture sample node with our radiation texture. The output will go into the base color and the alpha will be multiplied by a exponential radial gradient node. This arrangment means as the texture gets closer to it's edges it becomes more translucent effectively turning a square texture into a circular one. The exponential radial gradient will have a constant .6 as it's radius to make the final product a smaller circle but you can set it to whatever suits your needs.

6.png

The next step is to create a blueprint of the type "DecalActor" with the decal material being the material we use in the blueprint. When the missile explodes it will spawn this decal.


The effect of the decal on a *previously* forested hill.

7.png

If you want to learn more about decals you visit the official documentation here https://docs.unrealengine.com/en-us/Resources/ContentExamples/Decals.

Wrapping up

Sources

Missile Icon: Missile Silo Icon: https://openclipart.org/detail/82435/missile

Challenges

Using your own knowledge try to complete these challenges to improve your ballistic missile mod!

- Make the area that is nuked irradiated and have radiation cloud particles

- Make the missile's landing more graceful and realistic

- Add an anti-ballistic missile launcher to counter the ballistic missile

Conclusion