Koding Konversation: Casting spells towards a target

This conversation was posted to the Project Spark forum and is recovered from The Wayback Machine

Date: Apr 27 2016

OP: Lucid3982: I’m looking to create / modify the existing piece of Kode so that the healing visual effect doesn’t look like it is being cast on the target but rather at or towards the target. For example, I’ve replaced the basic Druid healing spell effect with Fan Breeze which looks like a swirl of leaves in the breeze. Right now it acts just as the original spell ever did where the effect is played on the target. here is the original Kode.

Play FX > Fan Breeze > On > It.

There are no available modifier that I’ve found to have this effect directed at a target. I’m wanting it to be directed outward from the caster as a cone of leaves, so I’ll ultimately also have to be able to turn this effect 90 degrees.

Any help with this would be greatly appreciated.

For reference, the Kode I’m talking about is found within the “Follower Healer” brain, Page 1, Line 12.

Responses

Kohldar: In order to modify a visual effects properties, I’ve found it easier to create a template of the object within the world. That can be done multiple ways, depending on your application.

If I understand the request right, you are wanting to face the target and play the Fan Breeze FX while rotating the FX in a swirling motion.

I would see if creating the Fan Breeze effect as a template first and then instantiating it through code would work. I’ve had success with something similar by attaching the effect to a logic cube. I think the Kode is something like:

When: Do: [ObjVar – fx][equals][create][IWP – Fan Breeze][at position][position]
When: DO: [fx][up][equals][fx][forward]
When: Do: [IWP – Logic Cube][attach][me]

Now in the logic cube

When: Do: [Roll]

So now, what i’m hoping would happen is that when you cast the spell, it creates the Fan Breeze effect at your position and sets its Up vector to its Forward vector, which would tilt the effect up and down (another community member may need to clarify if I did this right as I can’t test this now), then attach it to a spinning logic cube giving it the swirl effect.

Again, not sure if this works, but that’s where I would start.

Brasten: I will concur with Kohldar.

FX “Objects” are Object’s themselves, depending on how you create them in the world. If you just use “Play FX” it simply spawns a one time instance of FX Gizmo, and destory’s it the animation.

If you need more control over the FX, as Kohldar said, make it as a Template Object in the world. You can then put Kode in its brain to adjust its [forward] and other direction vectors. You shouldn’t need to connect it to a logic cube. However you may have to experiment to figure out which direction the FX is playing. Some play [up] some play [forward]

You can also do the same by using [create][fx:your choice] and create it right from the gallery, and then use an Object Variable to run direction change Kode on it from the creating brain. The down side of calling it from the Gallery is you can’t do any custom coloring or sound work on it if you desire.

The Basic Kode for getting an object to point a direction toward a select object is

[forward] = ( “Target Object” [center] – [center] )[normal]

This will have the object’s [forward] pointed right at the center of the target.

Lucid3982: that’s awesome. thanks guys. that works and it looks great.

Comments are closed.

Website Powered by WordPress.com.

Up ↑

%d bloggers like this: