LordAshes-ProjectilePlugin icon

ProjectilePlugin

Custom projectiles and projectile paths.

Last updated 2 months ago
Total downloads 8644
Total rating 1 
Categories Tweaks Networked Tools Integration Assets Minis Effects
Dependency string LordAshes-ProjectilePlugin-2.5.0
Dependants 3 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
LordAshes-AssetDataPlugin-3.4.0 icon
LordAshes-AssetDataPlugin

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

Preferred version: 3.4.0
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

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

Video Link: https://youtu.be/P_JKAPvWHgg

Change Log

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

There are two ways to select Projectile attacks: Core Talspire way and Game Sequence way.

Core Talespire Method

  1. Select a mini. This marks that mini as the attacker.
  2. Right click a different mini (the first target) and select the projectile menu option.
  3. Select the desired projectile attack from the Projectile menu.
  4. If multiple targets need to be selected, right click another mini (could be the same one or a different one), select the Projectile menu again and then select the only option in the menu. The option indicates which target and of how many the selection is.
  5. Once all targets have been chosen, the projectile animation is played.

The appearance of the projectile icon, mesh and the path it takes is dicated by the projectile configuration.

Game Sequence Method

  1. Select a mini. This marks that mini as the attacker.
  2. Right click the same mini and select the projectile menu option.
  3. Select the desired projectile attack from the projectile menu.
  4. Click on each (mini) that is a target of the attack.
  5. Once enough targets have been selected the projectile is launched.

The appearance of the projectile icon, mesh and the path it takes is dicated by the projectile configuration.

Non-Mini Selection

If players don't have permissions to select a mini or the target of the projectile is not a creature, the following method can be used to select a non-mini target. For simulating targeting minis (when players don't have permission) select a spot just beside the mini's base (but no on the mini). For targeting non-creature spots, just select the desired location keeping in mind that the mouse location is interpreted using a zero elevation.

  1. Select a mini. This marks that mini as the attacker.
  2. Right click the same mini and select the projectile menu option.
  3. Select the desired projectile attack from the projectile menu.
  4. Click on any non-mini spot. For simulating mini targeting, select a spot directly beside the base.
  5. Once enough targets have been selected the projectile is launched.

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.
*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.