0 of 0

File information

Last updated

Original upload

Created by

alexguldemond

Uploaded by

alexguldemond

Virus scan

Safe to use

Tags for this mod

About this mod

A mod which allows spells to track enemies in a parabolic arch. Also allows alternative spell casting trajectories, such as spiraling around the caster.

Requirements
Permissions and credits
Take control of your spell casting with Arcing Spells! Provides 5 unique customization spell casting trajectories that allows you to wield magic like never before. Cast spells in 6 different styles:

Vanilla:
The base games regular trajectory. The speed can be modified via the MCM.

Spiral:
The first is an outward spiraling trajectory centered around the caster. Its angular velocity and radial velocity can be modified in the MCM.

Disk:
A trajectory that causes the projectile to spin in circles while moving forward. The angular and forward velocities can be modified in the MCM.

Helix:
A trajectory that cause the projectile to move in a helix. The angular velocity, forward velocity, and radius can be modified in the MCM.

PseudoCloak:
A trajectory that cause a projectile to spin around the caster like a cloak spell. The angular velocity can be modified in the MCM.

Arcing:
A trajectory that moves in a parabolic arc from the caster to the target. Its linear velocity and the angle of incidence on the target can be modified in the MCM. Changing the angle of incidence away from the default turns the trajectory into a cubic arc. Lowering the angle of incidence may make aiming in narrow caves easier, and raising it may make aiming in open spaces easier.

The arcing trajectory is the primary goal of this mod. If you've ever played Mass Effect 2 & 3, think something like that.

Custom casting mode:
Now presenting a new casting mode Custom. In the Data directory, or if using MO2 in Arcing Spells directory, create a file called arcing_spells.txt. In this file, specify which spells you would like to cast with different trajectories, like the following

Firebolt=Arcing
Fireball=Spiral
Incinerate=PseudoCloak
Ice Spike=Helix

Then, in game, use the hotkeys to switch to Custom mode, and cast away! Works with spells from other mods as well, as long as the spells are spelled correctly. Anything not specified (or spelled incorrectly) will use the vanilla trajectory.




How it works:
When casting a spell in arcing mode, the mod first chooses the hostile target that is closest to where you are aiming. If this target is sufficiently close, and the angle between where you are aiming and the target is sufficiently small, a quadratic arc is interpolated between the caster and the target. The projectile then travels along this trajectory until it collides with something. This means that it is still very possible to miss when casting in arcing mode, as the projectile aims for where the target was, not where it is going to be. I did it this way so that this mod would make it so that aiming the arc would take some practice and not just automatically hit whenever a spell is cast. Currently, this mod only works for the player, all other actors still cast spells normally.

Compatibility:
This mod should be compatible with everything. It works by overwriting the GetLinearVelocity method on MissileProjectiles, so anything else that does this will obviously be incompatible. However, I am not aware of anything else that overwrites this method, so everything else should be compatible. 

Is this safe to add midgame?
As far as I can tell, yes.

Is this safe to remove midgame?
Eh, no more so than most mods. There is a very light script for the MCM and the toggle keys, and removing anything with scripts always comes with risks. If you don't like it, just use the toggles to change it back to vanilla mode, then assign the hotkeys to something you never use.

This is my first ever mod, so any feedback would be most appreciated. I am also open to any requests on other trajectories.

Math behind arcing:
Let the vector v be the vector that represents where you are aiming.
Let p0 be the player's position.
Let P be the set of positions of all hostile actors in the cell.
Let d(p) = min ||x - p||^2 subject to x being on the affine subspace generated by v, i.e. the distance from the target to where you are aiming. (This optimization problem has an explicit solution in terms of p0, v, and p)
Let p1 = argmin { d(p) : p is in P}. 
Let v2 = p1 - p2.
If ||v2|| is sufficiently small, and v.v1/(||v|| * ||v1||) is sufficiently large (i.e. the angle between them is sufficiently small), then proceed, else let the projectile travel along the vanilla trajectory.
Graham-Schmidt process step:
Let q1 = v
Let q2 = v1 - (v1.q1/q1.q1)*q1
Let e1 = q1 / ||q1||
Let e2 = q2 / ||q2||

Interpolation step (Newton interpolation with divided differences):
Let f0 = 0
Let f1 = 0
Let f00 = sqrt(1 - (v.v1/(||v|| * ||v1||))^2)/v.v1/(||v|| * ||v1||) 
Let f01 = (f1- f0)/ ||v2||
Let f001 = (f01 - f00)/||v2|| 

Let x(t) = f0 + f00(x - 0) + f001(x - 0)^2
Let p(t) = p0 + t*e1 + x(t)*e2

Then p(t) is the trajectory