LordAshes-ProjectilePlugin icon

ProjectilePlugin

Custom projectiles and projectile paths.

Last updated 2 months ago
Total downloads 10321
Total rating 1 
Categories Tweaks Networked Tools Integration Assets Minis Effects Props
Dependency string LordAshes-ProjectilePlugin-3.0.1
Dependants 4 other packages depend on this package

This mod requires the following mods to function

bbepisTaleSpire-BepInExPack-5.4.10 icon
bbepisTaleSpire-BepInExPack

Unified BepInEx all-in-one modding pack - plugin framework, detour library

Preferred version: 5.4.10
brcoding-SetInjectionFlagPlugin-2.3.0 icon
brcoding-SetInjectionFlagPlugin

Allows players to flag mods are installed

Preferred version: 2.3.0
LordAshes-FileAccessPlugin-1.4.1 icon
LordAshes-FileAccessPlugin

Provides standardized methods for accessing both local file and url resources. Automatically handles searching local folders for assets.

Preferred version: 1.4.1
HolloFox_TS-RadialUIPlugin-2.6.0 icon
HolloFox_TS-RadialUIPlugin

This is a developer tool based package used to manage and configure Radial UI Menus.

Preferred version: 2.6.0
LordAshes-AssetDataPlugin-3.4.0 icon
LordAshes-AssetDataPlugin

Dependency plugin for subscription/notification based data storage and message exchange.

Preferred version: 3.4.0
LordAshes-LoggingPlugin-1.0.1 icon
LordAshes-LoggingPlugin

Provides unified logging functionality

Preferred version: 1.0.1

README

Projectile Plugin

This unofficial TaleSpire plugin for adding custom projectiles and projectile path builders. This is an initial release of the plugin with the base feature implemented by very little bells and whistles. Improvements and additional features will be coming soon.

This plugin, like all others, is free but if you want to donate, use: http://LordAshes.ca/TalespireDonate/Donate.php

Change Log

3.0.1: Added missing icons
3.0.0: Triggering code rewrite
2.5.1: Bugfix for compatibility with BR Taleweaver update
2.5.0: Updated for compatibility with BR Taleweaver update
2.4.0: Updated for compatibility with BR Slab Browser update
2.3.1: Added missing components. No change to plugin since 2.3.0
2.3.0: Bug fix for Culture issues (users that use ``2,5`` instead of ``2.5``)
2.2.1: Added missing sample fireball asset. No plugin change.
2.2.0: Added Morph support
2.2.0: Rewrote animation to use Coroutines based on time and not frames
2.2.0: Added ability to select non-mini targets 
2.1.0: No longer require permission to the target mini
2.1.0: Fix for BR Mass Move update
2.0.0: Fix for BR HF Integration update
1.2.0: Added alternate "Fast Selection" method
1.1.0: Added automatic orientation along path
1.0.0: Initial release

Install

Use R2ModMan or similar installer to install this plugin.

Using R2ModMan to edit the configuration for this plugin, one can set the duration (in frames) of the projectile animations. Currently the duration of the animation is always the same regardless of the distance. This is to more easily accomodate other plugins, such as rule set plugins, which need to determine when the animations has completed.

Usage

  1. Right click on the attacking (source) mini to open the Radial menu.
  2. Select Projectile icon (3 firebolts) from the menu.
  3. Select the desired projectile from the sub-menu.
  4. Select targets using the below options.
  5. Once the require targets are selected or the user ends target selection, the projetile(s) are launched.

Mini Selection

  1. Click on the mini to select it.

Location Selection

  1. Click on the ground at the desired location.

Selecting Less Targets

  1. Middle click to end target selection

Target Count Indication

On the right hand side of the screen, arranged vertically, is an indication of the number of targets that need to be selected and how many have already been selected.

For projectiles that need 9 or less targets a box will appear for each target that is needed. As the user selects targets the boxes light up allow the user to see how many more selections are needed.

For projectiles that have an unlimited selection a plus box appears. This means that target selection wil continue endlessly until the user uses the middle mouse button to end it.

Plugin Details

This plugin requires two types of assets: projectiles and path builders. The plugin comes with three projectile asstes (arrow, boulder and chaos bolt) and two path builders (direct and arc).

Projectiles define the various setting of the corresponding projectile like the name, mesh, icon, number of targets, path builder, path builder parameters, etc. Each projectile has its own file thus allowing content creators to easily make additional projectile options.

Path builders determine how the projectile gets from the source (attacker) to the destination(s) (victim(s)).

In order to try the sample projectiles, open the plugin folder and under CustomData or Assets folder you will find a folder called "Move_Me_To_A_LocalContent_Folder". Move this folder to a separate custom folder (e.g. [LocalContent]) and place it within the CustomData folder. Lastly remove the ".assetBundle" extension from the 3 files within.

Creating Projectiles

  1. Before you can create a projectile for this plugin, the asset must already exist. Make a projectile asset bundle just like you make any other asset. Projectiles always use Effect mode (even if the asset bundle info.txt file say otherwise), so it is suggested to use the Kind Effect in your info.txt file so that when the asset is spawned as an Effect it will look the same as when it is used as a projectile.

  2. You will also need a 64x64 PNG file to represent the projectile icon. The PNG can use transparency.

  3. Now you can create the projectile file. It should be a text file with the extension "projectile". The file actually contains JSON content but needs the projectile extension for this plugin to recognize it as a projectile configruation. The contents of the file look similar to this:

{
	"name": "Chaos Bolt",
	"iconName": "chaosbolt.png",
	"assetBundleName": "lachaosbolt",
	"targets": 3,
	"pathType": "direct",
	"targetArea": "SPELL"
}
*name* indicates the display name in the projectiles menu.
*iconName* indicates the name of the file containing the projectile icon (64x64 PNG) file.
*assetBundleName* indicates both the asset bundle file name and the prefab with that contains the projectile mesh.
*targets* indicates the number of targets that the projectile requires. A value of 0 means unlimited.
*pathType* indictaes the name of the path builder to be used to determine the path of the projectile.
*targetArea* indicates the location on the target that the projectile aims for. Valid options are: HEAD, CAST or SPELL,
TORCH, and (default) HIT.

This plugin comes with two Path Builders (valid selection for pathType): direct and arc. The direct path builder moves the projectile from the source to the destination in a straight line. Arc does the same thing except it causes the projectile to gain height and then lose height during the path. However, the plugin supports adding additional path builders in which case more options become avaialable.

The arc path builder takes an optional float value as a parameter (default 0.25) indicating how high the arc is.

Creating Path Builders

Path builders dictate how the projectile gets from the source to the destination. A direct and arc path builder is provided with the plugin but user can create custom path builders for other types of paths. To create a path builder, one creates a very simple C# library. The library must be a static library with one required method. The library can contain other methods for internal use but must contain the one required method. A sample path builder is shown below:

using System.Collections.Generic;
using UnityEngine;

namespace LordAshes
{
    public class Direct_PathBuilder
    {
        public static List<Vector3> MakePath(Vector3 source, Vector3 destination, string parameters, int frames)
        {
            List<Vector3> path = new List<Vector3>();
            Vector3 delta = (destination - source) / frames;
            for(int f=0; f<frames; f++)
            {
                path.Add(source + (f * delta));
            }
            return path;
        }
    }
}

The required method of:

public static List<Vector3> MakePath(Vector3 source, Vector3 destination, string parameters, int frames)

is called when a projectile is launched that uses this path builder. It is called once for each target. source is a Vector3 position of the source (attacker). destination is a Vector3 position of the destination (victim). parameters is a single string containing any optional parameters needed by the path builder (or an empty string if not used). frames indicates the number of frames that the path builder should use to get the projectile from source to destination.

The method returns a List of Vector3 indicating the position of the projectile at each step (frame). The number of elements in the List should match the frame number indicated. While failing to comply with this condition will not cause the plugin to fail, it may throw off the timing of other plugins such as rule set plugins.