In this tutorial, we will be improving our weapon with actors. This tutorial will be a bit heavier than our previous ones as actors are a bit more involved.

This tutorial will cover:

1. Creating An Action Actor


You may have noticed at the end of the last tutorial that the missiles were launching from the hero’s feet and impacted at the enemy’s feet. This is less than ideal. We can fix this with action actors.

Action actors are unique in that they can assign other actors to effects and adjust various attributes, such as the launch and impact position of a missile effect.

To get started, create a new actor. Let’s name it “Hero IceMage Weapon Attack FX”. Set the Parent to "_FX Attack SingleTarget." Then set the Actor Type to “Action Actor.”

In this Action Actor you just created, in Effect, select your weapon’s launch missile effect (Hero IceMage Weapon Launch).

https://user-images.githubusercontent.com/56179268/218166273-d1a55139-107d-42e8-afa5-63e50a754361.png

The thing to pay attention to here is the Launch Site and Target Site of the action actor (set to SiteWeapon and SiteHit from our parent actor, respectively). The action actor tells the launch missile effect to use these sites for its Launch and Target positions. So when the Hero IceMage Weapon Launch effect fires, it will look for a “SiteWeapon” on the caster unit and a “SiteHit” on the target unit.

2. Host Sites


So what are these Sites? These sites are arbitrary attachments that can be added to unit actors. If you look at your hero actor and scroll down to its “unitActor.hostSites” you can see that it already has a “SiteHit” and “SiteStatus” that it’s inheriting from its parent actors (our enemy units have these same sites as well). The action actor we created looks for a “SiteWeapon” on the caster… but our hero doesn’t have one yet. So let’s add one.

https://user-images.githubusercontent.com/56179268/218166617-bda28c94-daaa-417f-9440-af5b14b1c538.png

Click the “Add” button next to the unitActor.hostSites and name the new site “SiteWeapon” (this name is important, since it’s what our action actor is currently looking for).

https://user-images.githubusercontent.com/56179268/218166775-1306b14e-74be-4c83-bb89-4ab732aeca8d.png

Set the new site’s Forward and Up properties to “0.5”. These values mean that this site will be 0.5 forward and 0.5 up from the hero’s origin position, which is about where the tip of the mage’s wand is during the attack animation.

https://user-images.githubusercontent.com/56179268/218166875-cb4d8658-6406-4fe9-b976-89a0b46c2655.png