Downloading the Unity Package:
To download the current unity package go to the link below:
Unity Package Download
To import the package into unity go into your unity project then right-click in the project tab
Under the menu select import package, then custom package
Finally, select the mod tool package in your file browser.
The new assets will be automatically checked by unity, then click import.
Creating a Reloadable Shell:
- Start by creating a model for your shell, you can also retexture the example models in the asset package
- Make sure the model is the right size for your tube, you can compare the size by importing your
model into the tube prefab
- Make sure your shell is structured as follows in the hierarchy:
You should have your shell prefab as the top object with the model object and the effect object directly below it.
- Create colliders for your shell under the prefab object (the top object in your hierarchy)
- Shells will need at least 1 capsule collider or sphere collider to work with the tubes properly
for the radius of this collider the values for the tube sizes are as follows:
1.75" - 0.032
3" - 0.055
10" - 0.15
all sizes are on objects with a scale of 1,1,1 changing the scale will affect the size.
Shells with a radius greater than 1.25x the tube value will not fit in the tube
Shells with a radius less than 0.75x the tube value will have their speed reduced proportionally
For shells, you should have 3 colliders, 2 capsule colliders, and one box collider like this:
It is very important that you put the shell_material physic material in the non-trigger capsule collider as this is how the game knows which colliders belong to a shell.
Do not change any of the values in the physic material or it will not work.
Position your colliders around the shell, the box collider should be at the bottom of the shell so that it can stand upright:
It is recommended that you make your trigger collider slightly smaller than the non-trigger collider, but it will not make a huge difference if you don’t
Next, make sure you have included all of the following components in your shell prefab:
This includes a custom shell behavior which you will need to build with your shell mod see the below section labeled IMPORTANT for more information!!!
This means you DO NOT need to include a behavior from the base mod tools provided by laumania. Simply drag in the components to each of the input fields.
- the Shell speed is the speed that the shell will launch with when NOT in a tube
- the tube launch effect is a particle system prefab that the shell will play when it is launched, the audio on the tube effect will replace the audio on the shell itself when in a tube
- the tube load sound is the sound that will play when put in a tube, if you leave this blank a pre-provided audio will be used in-game instead.
It is also recommended that you place your particle effect above the actual shell object, or turn off collisions on the particle effect. Otherwise, it will likely explode within the tube.
If you have issues with this you can also try changing the radius scale under collisions to a very small number
Finally, make sure your shell prefab (the top object in the hierarchy) has a rigidbody component.
And that is basically everything you will need to create custom reloadable shells. When you export your mod you do not need to include any of the components from the package.
Instead, when you publish your mod to mod.io, place the link for Reloadable Shell Assets in the dependencies section:
Uploading Your Mod:
As previously stated you do not need to include any physic materials or scripts in your mod.io folder
Simply keep all of the Reloadable Tube assets in their own folder within your unity project
Again when you upload to mod.io place the link for Reloadable Shells Assets in the dependencies section:
I would also advise that you note in your description and the preview image that your mod requires the Reloadable Shells Asset Mod in order to work
If you need help contact Panini#007 on discord or message Panini007 on mod.io
!IMPORTANT! In order to use any of these scripts you need a Code Compiler like Visual Studio downloaded and installed on your computer and then set up to work with your unity project
Visual Studio Download: Visualstudio.microsoft.com
Once downloaded you will need to go into your Unity Restart it and then make sure you have this package downloaded, it can be found in the package manager under Unity Registry, also make sure you are using the latest version
YOU MAY WANT TO BACKUP YOUR PROJECT BEFORE YOU CONTINUE
Finally, you will need to configure some settings:
in Unity go to edit > preferences > external Tools
Make sure that Visual Studio is selected as your script editor and that Local Packages is checked
Then click Regenerate Project Files, and that should be everything you need to use custom scripts with your mod
Custom Shell Behaviour:
The Shell Behaviour is a script that adds realistic behaviors to your shell, It will cause the shell to only fire up into the air when it is launched from a tube and it will delete the shell model when the shell is launched.
To use this script simply add it to your Shell's Prefab game object, which is the topmost object in the hierarchy (list on the left).
There are 4 variables to the Shell Behaviour:
- the Shell fuse is the Fuse of your shell, It must be the object that has the Fuse component, like a standard firework behavior
- the Entity Defenition is the firework definition for your Shell, like you would set up for any other firework.
- The Launch Effect is the Topmost Particle effect in your hierarchy and the effect that will start when the fuse is lit
- The Shell Speed is the speed your Shell will launch with when it is on the ground, setting this to a value under 10 will give the effect of your shell exploding on the ground as long as your Launch Effect particle system has collisions enabled
- The Tube Launch Effect is completely optional but allows you to set a custom particle effect prefab to be played when the shell is launched from inside of a tube. To use the Tube launch Effect you need to have a particle system that is a Separate Prefab from your firework and then drag that prefab into the Tube effect slot
Custom Fuse Behaviour:
!!! You Must Set Up A Shell Behavior Script on the Shell In order For This script to Work!!!
The Custom Fuse Behaviour allows you to use a custom fuse model on your Shells, you can set a different model for what the fuse looks like on the ground and in a tube.
To use the custom fuse Behaviour Create delete the original fuse and then drag in one of the custom Fuse Prefabs Included in the package, you can change the size/model later if you want
Or to start from new create an empty game object in the hierarchy under the "Model" object and add the Fuse Behaviour to it
Every Custom Fuse needs 3 parts
- A fuse Component, this is the standard fuse part with the "Fuse" component
- A Wrapped Model, this is the model displayed when the shell is on the ground
- An Unwrapped Model, this is the model displayed when the shell is in a tube
It is best practice to structure your Shell Firework Hierarchy(and all fireworks in general) as follows:
ShellFusePrefab_Ball is the Custom Fuse Component and ball_With_Fuse4 is the actual model of the shell
When You click on the Fuse Prefab it will automatically Unpack itself, this is because the fuse prefab cannot be a prefab when you edit it
There are 5 Variables on each Fuse Behaviour
Fuse Wrapped Model: This is the model used for the fuse when the shell is on the ground
Fuse Unwrapped Model This is the model used for the fuse when the shell is in a tube
Fuse Part: This is the "Fuse" Script used in your firework
Fuse part position Wrapped: This is the local position of the Fuse Component when the shell is on the ground
Fuse part position Unwrapped: This is the local position of the FUse Component when the shell is in a tube
Change State of the Fuse: This will switch the fuse from being in the Wrapped position to the Unwrapped position in the editor so that you can visualize what it will look like
If you change the position of the fuse component the following buttons will appear:
They will set the respective variable to the Fuse Part's position for you so you don't have to copy and paste it
The Default Fuses included in the Package have all these values already set for you so no need to worry about setting them unless you are using a custom fuse model
After Dragging in your fuse Prefab from the package and configuring its settings you will have to reset the values of your Fuse on all the other scripts Including your Firework Behaviour and Shell Behaviour
Congratulations! You now have a super realistic Reloadable Shell
Questions & Answers:
Q: Can I make my own reloadable tubes?
A: While it is technically possible, I have not made the necessary assets available as it is much more complex than making custom reloadable shells, If you want a different tube contact Panini#007 on discord.
Q: When I build my own mod the shell doesn’t snap in place with the tube
A: This means you likely didn't include the physic material on the shell colliders. Shells will also only snap into place once, so if they fall out of the tube they will not re-snap back into the tube.
Q: How do reloadable shells work?
A: The reloadable tubes created by myself have many scripts attached to them that perform various functions. Every tube has triggers that are checking for a collider with the shell material every frame, when one is detected that shell is then teleported to the correct location in the tube-based on how many shells are already in the tube. There are also scripts that keep your shells in the tube rotated properly and a script that deletes all of the colliders on your shell and disables the mesh when its fuse goes off.
Q: Do I need to update my mod when the package is updated?
A: Unless I specifically say so, then no you do not need to update anything on your mod when the unity package is updated.
Q: My shells are deleting when placed in the tube
A: All tubes have a cap of 10 shells per tube, regardless of tube or shell size. This is for performance reasons, and because having more than 10 shells per tube is not possible with most tubes.