Simple Linear Attacks
Author: wingednosering (sc2mapster.com)Tags: intermediate data  
Source: http://forums.sc2mapster.com/resour...Added 13 years ago 

I've seen people asking for help with missiles that continue in a certain direction until they come into contact with a wall or unit. Please note that this is NOT a traceline guide. There are many of those about already, or you can look at my Third Person Shooter System (link).

I expect you to have some basic understanding of effect types and a bit of experience already with the data editor. I will be running through a demonstration, but will sum up the theory behind the whole thing afterward. You may name your buffs/effects/etc; whatever you wish as you follow along.
We will be using three Data Types: Effect, Validator, and Behavior. Others may be used to actually assign the finished product to an ability or weapon, but I won't be covering that, since it's unique to each person's final intentions.

Step 1: Behavior Tab
Switch over to the Behavior Tab.
Add an object named Contact with type: Buff

You can leave the rest default. This buff is completely invisible and really just allows us to create our validator.


Step 2: Validator Tab
Switch over to the Validator tab.
Add an object named Contact Val with type: Unit Compare Behavior Count

This Validator prevents our caster from continuing once his shot has come into contact with a unit, wall, etc;


Step 3: Effects Tab
Yep, you guessed it. It's time to wander over to the Effects tab. We actually won't need the other two again, so you can close them if you wish. This is going to take a little while...
With Effects, I always like to get a good idea of what I hope to achieve and then work backwards. That way, everything links correctly and you don't need to revisit anything.
Add object named Shoot (Damage) with Type: Damage

I don't think the damage effect needs much explanation...if you want to add an AoE effect upon impact, do it via the Area+ field in this effect.
Add object named Shoot (Buff) with Type: Apply Behavior

This is what will add the buff to our caster if the attack hits an object.
Add object named Shoot (Set) with Type: Set

That one's fairly simple. Sets are really just a way of using multiple effects at once.
Add object to named Shoot (Remove Buff) with Type: Remove Behavior

Add object named Shoot (Search Area) with Type: Search Area

This Search Area effect is what helps our missile detect enemies as it travels.
Add object Shoot (Persistent) of Type: Create Persistent

This persistent will check for collision ever X distance and prevent the check from continuing once contact has been made.
That's all there is to it really. Obviously you still need buttons/abilities/weapons set up to actually make use of your effect, but calling the Persistent will make the whole string work. However, I will walk through one bonus step that I recommend:


(Optional) Step 4: Actor Tab
Switch to the Actor Tab.
Add object named Shoot Beam with Type: Beam (Simple) - Beam Simple Animation Style One Shot

This is a beam model, which will represent your shot. It is used in conjunction with the next Actor.
Add object named Shoot Attack Launch with Type: Action - GenericAttack

And that should be it.


Fun Additions
Here are some fun ideas to consider:



The Theory
The way it works is like this:
The Persistent runs periodically. Every interval specified by your Periodic Duration field, it creates the Search Area effect. The Search Area effect searches for a single, targetable unit at the first offset specified in your persistent effect. If it finds an applicable target, it does adds our Collision Buff to the Caster and deals damage.

When our Persistent runs again, it will set the Search Effect to the second offset, unless the Validator we made fails to clear, which happens whenever the buff is found on our unit.
Finally, at the end of the Persistent, the buff is destroyed, so it doesn't remain on your unit for its next attack/cast.
No question it's not ideal for long ranges, but I wanted to show how simple something this daunting can be.


To use a Missile Instead of a Beam
Create your missile (I won't get into how to do that, I expect anybody following this know how)
Go to the Effects Tab and create a new object called Shoot (Launch) with Type: Launch Missile

Return to Shoot (Set)

Go to the Actor tab and add an object named Shoot Attack with Type: Action - GenericAttack










Star Depot
Contact      Login