- Joined
- Jul 18, 2011
- Messages
- 15
How to: SMART Weapons
Introduction
Disclaimer
Overview
Difficulty Levels:
----------------------
Master
Journeyman
Apprentice
----------------------
Conclusion
Fixing the limitation and an Alternate Method
Disclaimer
Overview
Difficulty Levels:
----------------------
Master
Journeyman
Apprentice
----------------------
Conclusion
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 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.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"
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.