How to: SMART Weapons

Level 2
Joined
Jul 18, 2011
Messages
15

How to: SMART Weapons


:fp: Introduction
:fp: Disclaimer
:fp: Overview
Difficulty Levels:
----------------------
:fp: Master
:fp: Journeyman
:fp: Apprentice
----------------------
:fp: Conclusion
:fp: Fixing the limitation and an Alternate Method

Introduction

Have you noticed how StarCraft II units (or any other units in a game for that matter) do not distribute their shots optimally? That is, they will fire everything they got at a unit, no matter the unit will die by the first shot. I am specifically talking about units that seem to have multiple shots per attack (I'm looking at you, Mothership) but fire them all at any tiny-weeny little critter, thus wasting most of them. Well to some this can be annoying and fortunately it can be partially fixed. This is what this tutorial is about.


Disclaimer

This tutorial was done with/for editor version 1.3.4.

This method only works with "immediate" weapons, i.e. weapons that hit the target the moment they are fired, as such missile weapons (ones with a "Launch" effect) will not produce the desired effect.

Additionally some may consider the end product of this tutorial "ugly", but it is not its purpose to deal with visual art, only effect functionality.


Overview

This tutorial will show you a simple method of making a unit that has several "shots" per attack, that can all be shot at different targets.
The tutorial is divided in sections, based on the reader's expected skill with the editor, as to not bore more advanced users with too many details. Each subsequent section explores the same concept in more detail.

What you will need:

We will be using the Diamondback unit in this example, so you will need the Liberty (Campaign) dependency to be active and also, in the Data Editor, all the orange buttons on the right half of the window to be pressed (specifically "Show Table View", "Show Default Values", "Show Advanced Fields", "Show Field Type Names" and "Combine Structure Values").
We will be using a pre-made damage and art-linked effect – the "Diamondback – Eviscerator (Set)" as the purpose of this tutorial is to demonstrate how to make "smart" weapons and thus firing art and etcetera are of no importance and will not be reviewed.


Master

This comes down to making the weapon fire a Search Area effect with maximum unit count equal to the desired number of attacks, Impact Location of "Source Unit/Point" and area radius that of the weapon's range, minding the source unit's radius, as larger units' range, like the Diamondback, is not measured from their center.
…yup, that's it.


Journeyman

Let's start with making the dummies we are going to fire at:

Go to the Zergling and change its Movement - Speed, Stats - Life Maximum, Stats – Life Starting Amount and Stats - Life Regeneration (just in case) to 0 (zero).

Create a Search Area effect named "Diamondback – Search Area".
Add a search area with an arc of 360 degrees, maximum count of 5 (five), radius of 7 (seven) and set the effect to "Diamondback – Eviscerator (Set)".
The "Maximum Count", in this case, are the number of attacks the unit will have and "Radius" the range of the weapon – it normally is 6 (six), but because range is not measured from the shooter's origin point and the "Search Area" effect is, we set it to one higher to compensate for the unit's size.

After this modify the "Search Filters" in the following fashion:

Set the following to be "Excluded": Dead, Destructible, Hidden, Invulnerable, Item, Missile, Radar, Resource (Harvestable), Resource (Raw), Self, Stasis.
Set "Visible" to "Required".

Everything else is left at "Allowed".

It is important to exclude all things that potentially can be inside the searched area, but are undesirable targets as the "Search Area" effect will still select them, even if they are not suitable targets for the effect, thus shots will be wasted.

Lastly set the "Target – Impact Location +" field "Value" to "Source Unit/Point". This will make the effect's search circle (as it is set to 360 degrees) to have its radius set to the firing unit's origin/source point. Leaving it at "Target Unit/Point" will center it at their origin point.


Apprentice

After creating a new map and all, let's start with our training dummies, i.e. the things we are going to shoot at.

Open the Data Editor, go to the "Units" tab and find the Zergling. Set its Movement - Speed, Stats - Life Maximum, Stats – Life Starting Amount and Stats - Life Regeneration (just in case) to 0 (zero).

After that since we will be working only with the Diamondback for facility's sake you can type "Diamondback" (or just "diamondb") in the Search box.
Now go to the Effects tab and create a new Search Area effect by the name of "Diamondback – Search Area". Modify the "Search – Areas +" field and click the green X in the upper-right corner of the newly opened window to add a new value. Set "Maximum Count" to the number of attacks you want your unit to have, in this case let it be 5 (five). "Radius" will usually be the range of the weapon, minding the firing unit – in this case the Diamondback's weapon has a range of 6 (six) , but we will set it one greater, i.e. 7 (seven), as the firing range is not measured from this unit's center, but the "Search Effect" will be.

Now set "Effect" to "Diamondback – Eviscerator (Set)"and click "OK". Set the appropriate "Search – Search Filters", in particular:
Dead – Excluded
Destructible – Excluded
Hidden – Excluded
Invulnerable – Excluded
Item – Excluded
Missile – Excluded
Radar – Excluded
Resource (Harvestable) – Excluded
Resource (Raw) – Excluded
Self – Excluded
Stasis – Excluded
Visible – Required
all others are left at "Allowed"
and uncheck "Ally", "Neutral" and "Player"
Unlike weapon filers the Search Area filter does NOT know better and if fields like "Dead" are not "Excluded" then units that already died will be targeted by the effect, but the beam will not fire as they are… well, kinda dead.

And here we can see a limitation to this method – if "Ally" and/or "Neutral" are unchecked then the unit will not fire at all at allied and/or neutral units, which typically is what normal people want, but the other problem for people like us, yes I'm talking to YOU, is that if the aforementioned fields are left checked then the unit will waste valuable time and/or energy to fire upon allied and/or neutral units, even in the presence of enemies. The solution to this is at the end of the tutorial.

Now the last thing we must modify in this effect is the "Target – Impact Location +". Set it's "Value" field to "Source Unit/Point". This is what makes the "Search Area" effect to start from the source point of the firing unit and spread only as far as the weapon's range (or whatever range we set it to). If left to "Target Unit/Point" then the Search Area effect (which in our case is a circle, since the "Arc" is 360 degrees) will be centered on the source point of the attacked unit. Now go to the "Weapons" tab and select the "Diamondback – Eviscerator Rail Gun". Double-click the "Effect – Effect" field and set it to "Diamondback – Search Area".
That is it.


Conclusion

If everything is in order, place some zerglings on the map and the Diamondback. Then bless the Machine Spirit, chant the Rites of Engloriment, Rites of Errorless Running and Rites of Startage… (and press Ctrl+F9 or just test run the map). The Diamondback should be killing 5 (five) zerglings at a time (or whatever number you inputted as "Maximum Count").


Fixing the limitation and an Alternate Method

If you wish to fix the aforementioned limitation with attacking allied and/or neutral units you can make the weapon fire a "Set" effect, consisting of "Diamondback – Eviscerator (Set)" and our "Diamondback – Search Area", but with "Maximum Count" set to one lower.

In detail:

Go to the Effects tab and create a new "Set" effect with the name "Diamondback – Set". Modify the "Effect – Effects" field – include "Diamondback – Eviscerator (Set)" and our "Diamondback – Search Area". Thus every time the unit fires it will fire one solid attack at the target (even if it is allied etc.) and then conduct a Search Area procedure, therefore if you wish to have 5 (five) attacks you must set the "Maximum Count" field of the Search Area effect to one lower, i.e. 4 (four) in our case.
An alternate method would be to make the weapon start a "Create Persistent" effect each time it fires with "Period Count" equal to the number of desired attacks and "Period Effects" set to a "Search Area" effect, the same as the one we used in this example, with the difference, that "Maximum Count" is set to 1, so that every "Search Area" effect only finds one target.
 
Level 2
Joined
Jul 18, 2011
Messages
15
Request Form Theta-Six #516A63beta16316812HC3518

Request Begin.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

I request permission to use multi-coloring.
According to site rules multiple color use is restricted to gray and light-gray, with the exception of:

208 red, 246 green, 128 blue
96 red, 166 green, 0 blue
204 red, 170 green, 0 blue

These colors are insufficient and inefficient. While color theories and graphic designers may argue on many topics, all color theory and graphic designers agree: "Using few/several different colors is better than using only one color (and its shades)".

Tests and [rainbow]Omnisiah[/rainbow] teachings confirm theory.

It causes an increase of pleasure/happiness hormone in those viewers, who have still not had the honor of replacing the right brain hemisphere with a cogitator, additionally it increases productivity, morale and learning capacity.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


Request End.

This request is posted to the Departamentum Administorum separately from the previous tutorial, as it does not reflect, neither has any connection to the subject itself.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,241
I think missles can be made to automatically change target when their source aquires a new target. I believe the missle turret of the terran does or atleast did due to its slow missle speed.

The same idea can probably be applied to duration effects like the colossus, thor or mothership by making the weapon "channeled" in some way so the effects it produces are tied to its current target instead of the target at launch.
 
Level 2
Joined
Jul 18, 2011
Messages
15
I see your point.

While I haven't conducted in-depth studies on the matter here is the information, stored in my data-vaults:

While missiles can be made to change target in the course of their flight, the key element here is that they are in fact unit-data-objects, allowing for far bigger versatility that their counterparts - "create persistent effects".

Should a "create persistent" effect be channeled that would tie its existence to that of its origin data object, therefore discontinuing its existence, should the origin data object be removed, that is mainly used if a unit's attack would require a long time to fire all of its projectiles. If say a marauder is made to fire 256 shells, each in 0.01 seconds, that would make the entire volley take 2,56 seconds, should the effect not be channeled and he were to die after 1,32 seconds, the missiles would continue to fire, causing numerous glitches in the system, while if the effects is "channeled" it ceases to exist, along with its origin parent. However the target of the execution remains the same, it is quite possible for the aforementioned Marauder to begin its shell-burst upon Target01 only to fire a second one upon Target02 1,2 seconds later (weapon cooldown being key here) and in effect firing a multitude of projectiles at two different targets at the same time.

Mind you, I believe it absolutely possible for a "create persistent" effect to be forged as to change targets mid-execution, but I also believe it would require advanced knowledge and it would be more complex to a degree, variating between "really" and "a lot".

Persisting that I do not have extensive knowledge about said topics, it is quite possible I am wrong, but in lack of solid proof, I maintain my previous point, that I have shown a simple and functioning method.
 
Top