(If you see typos, please point them out so that I can fix them)
This tutorial will show one of the ways you can make a dynamic weapon that changes attacks based on the target type. It's possible to use Target Sorts and Target Filters with multiple weapons to make each of them fire at a specific kind of unit, but using an Effect - Switch allows you to combine it all into one weapon. While it is the most efficient method, don't assume it's the best method. While incredibly efficient, it never allows you to fire multiple weapons at once because you only have one weapon. Thus this is only ideal if you want to restrict a unit to one weapon attack at a time.
Swiss Army Tank
Validators Tab
Create a new Validator named TargetIsArmored with Validator Type: Unit Filters
set Filters: Required [Armored]
set Unit +: Target
Create a new Validator named TargetIsFlying with Validator Type: Unit Mover
set Find: Enabled
set Unit +: Target
set Value: Fly
Create a new Validator named TargetIsStructure with Validator Type: Unit Filters
set Filters: Required [Structure]
set Unit +: Target
These three validators will determine what weapon effect is fired at the target based on the unit's type.
Units Tab
Create a new Unit named Air Missile with Based On: Invulnerable Missile
set Mover: Missile Default
Effects Tab
Create a new Effect named Air LMissile (Damage) with Effect Type: Damage
set AI Notify Flags: Hurt Enemy
set Amount: 25
set Death: Blast
set Flags: Notification
set Kind: Ranged
set Response Flags: [Acquire/Flee]
set Area +: (Arc: 360; Fraction: 0.6; Max Count: -1; Radius: 1.5)
set Exclude +: Target
set Search Filters: Exclude [Dead/Hidden/Invulnerable/Missile/Self/Stasis], Require [Air/Visible] and Uncheck [Ally/Player]
Duplicate and change LMissile to RMissile
Create a new Effect named Air LMissile (Missile) with Effect Type: Launch Missile
set Impact Effect:Air LMissile (Damage)
set Ammo Unit:Air Missile
Duplicate and change LMissile to RMissile
Create a new Effect named Air Missiles (Set) with Effect Type: Set
set Effects:Air LMissile (Missile) and Air RMissile (Missile)
set Maximum Count: -1
Create a new Effect named Armored LBeam (Damage) with Effect Type: Damage
set AI Notify Flags: Hurt Enemy
set Amount: 20
set Death: Impact
set Flags: Notification
set Kind: Ranged
set Response Flags: [Acquire/Flee]
Duplicate and change LBeam to RBeam
Create a new Effect named Armored Beams (Set) with Effect Type: Set
set Effects:Armored LBeam (Damage) and Armored RBeam (Damage)
set Maximum Count: -1
Create a new Effect named Light LBeam (Damage) with Effect Type: Damage
set AI Notify Flags: Hurt Enemy
set Amount: 10
set Death: Normal
set Flags: Notification
set Kind: Ranged
set Response Flags: [Acquire/Flee]
Duplicate and change LBeam to RBeam
Create a new Effect named Light Beams (Set) with Effect Type: Set
set Effects:Light LBeam (Damage) and Light RBeam (Damage)
set Maximum Count: -1
Create a new Effect named Structure LBeam (Damage) with Effect Type: Damage
set AI Notify Flags: Hurt Enemy
set Amount: 50
set Death: Impact
set Flags: Notification
set Kind: Ranged
set Response Flags: [Acquire/Flee]
Duplicate and change LBeam to RBeam
Create a new Effect named Structure Beams (Set) with Effect Type: Set
set Effects:Structure LBeam (Damage) and Structure RBeam (Damage)
set Maximum Count: -1
Create a new Effect named Swiss Army Blaster (Switch) with Effect Type: Switch
open Cases +:
Case 0 > Air Missiles (Set) | TargetIsFlying
Case 1 > Structure Beams (Set) | TargetIsStructure
Case 2 > Armored Beams (Set) | TargetIsArmored
set Default:Light Beams (Set)
This effect is the lynch pin for the entire weapon. Unless one or more of the validators pass, the weapon will fire the default effect. It's important to note that the highest case on the list (IE 1 before 2) to pass its validator is the chosen effect. So if you have a flying, armored unit, the Air Missiles (Set) will be fired and NOT the Armored Beams (Set).
Weapons Tab
Create a new Weapon named Swiss Army Blaster
set Effect:Swiss Army Blaster (Switch)
set Period: 1.5
set Damage Display Effect:Light LBeam (Damage)
set Icon: btn-techupgrade-terran-multilockingtargetingsystem.dds
set Target Filters: Exclude [Dead/Hidden/Invulnerable/Missile/Self/Stasis] and Require [Visible]
Models Tab
Create a new Model named Air Missile
set Model: ThorShoulderMissile.m3
Create a new Model named Armored Beam
set Model: DiamondbackWeaponChargedBeam.m3
Create a new Model named Light Beam
set Model: HellionUpgradeBeam.m3
Create a new Model named Structure Beam
set Model: ColossusBeam.m3
Units Tab
Duplicate the Diamondback (Unit) and its corresponding Actor and Model. Everything else will be stock or made from scratch.
Name it Swiss Army Tank
open Abilities + and remove all but [Attack/Move/Stop]
open Command Card + and remove all but [Attack/Move/Hold Position/Patrol/Stop]
remove everything in Behaviors +
open Weapons + and add Swiss Army Blaster
Name the Actor and Model Swiss Army Tank
Actors Tab
Model Actors
Create a new Actor named Air Missile with Actor Type: Missile and Based On: GenericAttackMissile
set Unit Name Token:Air Missile
set Model:Air Missile
As long as you use the Token you shouldn't need to alter the events.
Create a new Actor named Armored Beam with Actor Type: Beam (Simple) and Based On: Beam Simple Animation Style One Shot
set Model:Armored Beam
open Events + and create the following events:
Actor Creation
Animation Play (Name: Beam; Animation Properties: Stand; Time Variant: 0.5; Time Type: Duration)
Animation Done
Destroy
Create a new Actor named Light Beam with Actor Type: Beam (Simple) and Based On: Beam Simple Animation Style One Shot
set Model:Light Beam
open Events + and create the following events:
Actor Creation
Animation Play (Name: Beam; Animation Properties: Stand; Time Variant: 20; Time Type: Time Scale)
Animation Done
Destroy
By increasing the Time Scale so drastically it turns the beam into that missile-like projectile shown in the video.
Create a new Actor named Structure Beam with Actor Type: Beam (Simple) and Based On: Beam Simple Animation Style One Shot
set Model:Structure Beam
open Events + and create the following events:
Actor Creation
Animation Play (Name: Beam; Animation Properties: Stand; Time Variant: 0.5; Time Type: Duration)
Animation Done
Destroy
Attack Actors
Create a new Actor named Air LMissile Attack with Actor Type: Action and Based On: GenericAttack
set Impact Effect Token:Air LMissile (Damage)
set Launch Effect Token:Air LMissile (Missile)
set Missile:Air Missile (Actor)
set Launch Attachment Query +: Methods > Filter Weapon 01
set Launch Assets +: (Art > Thor AA Attack Launch | Sound > Thor_AntiAirAttackLaunch)
set Impact Map +: 1st Row > (Art > Thor AA Attack Impact | Sound > Thor_AntiAirAttackImpact)
Create a new Actor named Air RMissile Attack with Actor Type: Action and Based On: GenericAttack
set Impact Effect Token:Air RMissile (Damage)
set Launch Effect Token:Air RMissile (Missile)
set Missile:Air Missile (Actor)
set Launch Attachment Query +: Methods > Filter Weapon 02
set Launch Assets +: (Art > Thor AA Attack Launch | Sound > Thor_AntiAirAttackLaunch)
set Impact Map +: 1st Row > (Art > Thor AA Attack Impact | Sound > Thor_AntiAirAttackImpact)
As long as you use the Tokens you don't need to change the Events for Missile Attack Actors.
Create a new Actor named Armored LBeam Attack with Actor Type: Action and Based On: GenericAttack
set Beam:Armored Beam (Actor)
set Impact Attachment Query +: Methods > Filter Center
set Launch Attachment Query +: Methods > Filter Weapon 01
set Launch Assets +: Sound > Diamondback_AttackLaunch
set Impact Map +: 1st Row > Sound > Diamondback_AttackImpact
open Events + and create the following events:
Effect - Armored LBeam (Damage) - Start
Create
Create a new Actor named Armored RBeam Attack with Actor Type: Action and Based On: GenericAttack
set Beam:Armored Beam (Actor)
set Impact Attachment Query +: Methods > Filter Center
set Launch Attachment Query +: Methods > Filter Weapon 02
set Launch Assets +: Sound > Diamondback_AttackLaunch
set Impact Map +: 1st Row > Sound > Diamondback_AttackImpact
open Events + and create the following events:
Effect - Armored RBeam (Damage) - Start
Create
Create a new Actor named Light LBeam Attack with Actor Type: Action and Based On: GenericAttack
set Beam:Light Beam (Actor)
set Impact Attachment Query +: Methods > Filter Center
set Launch Attachment Query +: Methods > Filter Weapon 01
set Launch Assets +: Sound > Obelisk_ArgusLinkLaunch
set Impact Map +: 1st Row > Sound > Obelisk_ArgusLinkImpact
open Events + and create the following events:
Effect - Light LBeam (Damage) - Start
Create
Create a new Actor named Light RBeam Attack with Actor Type: Action and Based On: GenericAttack
set Beam:Light Beam (Actor)
set Impact Attachment Query +: Methods > Filter Center
set Launch Attachment Query +: Methods > Filter Weapon 02
set Launch Assets +: Sound > Obelisk_ArgusLinkLaunch
set Impact Map +: 1st Row > Sound > Obelisk_ArgusLinkImpact
open Events + and create the following events:
Effect - Light RBeam (Damage) - Start
Create
Create a new Actor named Structure LBeam Attack with Actor Type: Action and Based On: GenericAttack
set Beam:Structure Beam (Actor)
set Impact Attachment Query +: Methods > Filter Center
set Launch Attachment Query +: Methods > Filter Weapon 01
set Launch Assets +: Sound > Colossus_AttackLaunch
For all of these actors, the IAQ (Impact Attachment Query) and LAQ (Launch Attachment Query) control where the weapon fires from and where on the target it impacts. Launch Assets determines the models (muzzleflash) and sounds when the weapon fires. Impact Map determines the models (explosions) and sounds when the weapon impacts various target types (All, Flesh, Metal etc).
Unit Actors
Select the Actor named Swiss Army Tank
open Events + and create the following events:
Unit Birth - Swiss Army Tank
Create
Unit Death - Swiss Army Tank
Destroy
Weapon Start - * - Attack Start
Animation Play (Name: Attack; Animation Properties: Attack)
Weapon Stop - * - Attack Stop
Animation Clear (Name: Attack)
Now the unit will animate properly whenever it attacks :)
Feel free to use the attached Test Map or contact me via forum post/IRC if you encounter problems. Keep in mind that I'm a busy person so I may not reply right away, but I'll do my best to answer all questions/concerns that I am aware of :)
A couple quick things I would like to mention about the guild. First off on the beam attacks you want to put the actor in the Beam slot not the Missile. The second I ran into a problem with the Missile actor not creating the lunch event correctly. So I went in and edited the events + manually with the data from your map It was missing
Event - AirRMissileMissile -Start
At Caster
Create
This allowed it to animate the two missiles Correctly
The only other thing I ran into a problem is I used an Immortal for my model cause I didn't have access to the campaign models and it fires 3 lasers instead of the proposed 2 but still only does damage of 2 is there a way I can make it only animate the 2 beams instead of the 3
(If you see typos, please point them out so that I can fix them)
It's possible to use Target Sorts and Target Filters with multiple weapons to make each of them fire at a specific kind of unit,
Thanks for the tutorial.
Do you know if this is possible with weapon classes? In other words, could i assign weapon classes to behave that way? Could you have a hero that has "Long-Range" and "Close-Range" Weapon slots, able to find and equip different weapons based on these slots and have them behave based on target types. So, my "Sniper-Rifle" based weapons are used against armored and my "Shotgun" based weapons target light units? Or would you have to set target filters for each individual weapon?
Okay, I'm really confused. Do all of you have the units, models, weapons and such from the specialized campaign units? (goliath, diamondback, and such)
I don't have any of them, only the base units, and it's limiting my creation...
My map editor version is 1.0.3, installed using a collectors edition disc, and patched regularly.
@JukeZor - Yes, you can have a unit with multiple weapons that only shoot at certain targets. Instead of using a Validator to filter targets, you'd use the Weapon - Target Filters field to do this. Now this isn't exactly creating a "class," but you could easily configure one shotgun weapon with the desired filters and then copy these filters over to all other shotguns. Those filters would then represent a weapon class.
Hey ProzaicMuze,
Is there a way to change Damage Display Effect when the weapon or effect changes? I was going to use a similar idea to yours but instead of type of armor, it would be based on which buff the source unit(caster) has. For instance, if the unit has a fire buff then he will use the fire weapon and so forth. I would then like the UI - Damage Display Effect to change accordly.
I haven't actually tried a dynamic Damage Display Effect, but you could try using an Effect - Switch. You'd set the default case to your standard damage and then make cases for each of the buffs and a validator that checks for them. Hopefully this would cause it to change with each buff, but I don't know if it takes the info direction from the effect you list in the field or if it's semi-intuitive and looks for an Effect - Damage linked to it.
I haven't had time to try it yet but I give a crack soon enough. I did come up with another idea. You can use the upgrade system. If you recall the damage changes when you upgrade weapons. So you can have the buff change the upgrade level and thus update the UI - Damage Display. I will play with both options and see which one works.
(If you see typos, please point them out so that I can fix them)
This tutorial will show one of the ways you can make a dynamic weapon that changes attacks based on the target type. It's possible to use Target Sorts and Target Filters with multiple weapons to make each of them fire at a specific kind of unit, but using an Effect - Switch allows you to combine it all into one weapon. While it is the most efficient method, don't assume it's the best method. While incredibly efficient, it never allows you to fire multiple weapons at once because you only have one weapon. Thus this is only ideal if you want to restrict a unit to one weapon attack at a time.
Swiss Army Tank
Validators Tab
These three validators will determine what weapon effect is fired at the target based on the unit's type.
Units Tab
Effects Tab
This effect is the lynch pin for the entire weapon. Unless one or more of the validators pass, the weapon will fire the default effect. It's important to note that the highest case on the list (IE 1 before 2) to pass its validator is the chosen effect. So if you have a flying, armored unit, the Air Missiles (Set) will be fired and NOT the Armored Beams (Set).
Weapons Tab
Models Tab
Units Tab
Duplicate the Diamondback (Unit) and its corresponding Actor and Model. Everything else will be stock or made from scratch.
Actors Tab
Model Actors
As long as you use the Token you shouldn't need to alter the events.
By increasing the Time Scale so drastically it turns the beam into that missile-like projectile shown in the video.
Attack Actors
As long as you use the Tokens you don't need to change the Events for Missile Attack Actors.
For all of these actors, the IAQ (Impact Attachment Query) and LAQ (Launch Attachment Query) control where the weapon fires from and where on the target it impacts. Launch Assets determines the models (muzzleflash) and sounds when the weapon fires. Impact Map determines the models (explosions) and sounds when the weapon impacts various target types (All, Flesh, Metal etc).
Unit Actors
Now the unit will animate properly whenever it attacks :)
Feel free to use the attached Test Map or contact me via forum post/IRC if you encounter problems. Keep in mind that I'm a busy person so I may not reply right away, but I'll do my best to answer all questions/concerns that I am aware of :)
Didn't know validators were so powerful. Very interesting tutorial, longly anticipated but surpassed expectation.
A couple quick things I would like to mention about the guild. First off on the beam attacks you want to put the actor in the Beam slot not the Missile. The second I ran into a problem with the Missile actor not creating the lunch event correctly. So I went in and edited the events + manually with the data from your map It was missing
This allowed it to animate the two missiles Correctly
The only other thing I ran into a problem is I used an Immortal for my model cause I didn't have access to the campaign models and it fires 3 lasers instead of the proposed 2 but still only does damage of 2 is there a way I can make it only animate the 2 beams instead of the 3
Typo:
And I believe its not "that" inefficent to sort and filter, Thor's weapon might be an example
Fixed typos.
Thanks for the tutorial.
Do you know if this is possible with weapon classes? In other words, could i assign weapon classes to behave that way? Could you have a hero that has "Long-Range" and "Close-Range" Weapon slots, able to find and equip different weapons based on these slots and have them behave based on target types. So, my "Sniper-Rifle" based weapons are used against armored and my "Shotgun" based weapons target light units? Or would you have to set target filters for each individual weapon?
Thanks much for any input.
Very useful tutorial. I have noticed the switch effect before, but never think it can be used like that.
Okay, I'm really confused. Do all of you have the units, models, weapons and such from the specialized campaign units? (goliath, diamondback, and such)
I don't have any of them, only the base units, and it's limiting my creation...
My map editor version is 1.0.3, installed using a collectors edition disc, and patched regularly.
Any assistance would be appreciated...
@Kiaulen: Go
Files -> Dependencies
Check the cool campaign stuff.
Thanks!
@JukeZor - Yes, you can have a unit with multiple weapons that only shoot at certain targets. Instead of using a Validator to filter targets, you'd use the Weapon - Target Filters field to do this. Now this isn't exactly creating a "class," but you could easily configure one shotgun weapon with the desired filters and then copy these filters over to all other shotguns. Those filters would then represent a weapon class.
Hey ProzaicMuze, Is there a way to change Damage Display Effect when the weapon or effect changes? I was going to use a similar idea to yours but instead of type of armor, it would be based on which buff the source unit(caster) has. For instance, if the unit has a fire buff then he will use the fire weapon and so forth. I would then like the UI - Damage Display Effect to change accordly.
I haven't actually tried a dynamic Damage Display Effect, but you could try using an Effect - Switch. You'd set the default case to your standard damage and then make cases for each of the buffs and a validator that checks for them. Hopefully this would cause it to change with each buff, but I don't know if it takes the info direction from the effect you list in the field or if it's semi-intuitive and looks for an Effect - Damage linked to it.
@ProzaicMuze: Go
I haven't had time to try it yet but I give a crack soon enough. I did come up with another idea. You can use the upgrade system. If you recall the damage changes when you upgrade weapons. So you can have the buff change the upgrade level and thus update the UI - Damage Display. I will play with both options and see which one works.
I really appreciate this tutorial, thank you for making it.
Question: Is there a way to revive the YouTube video/link? Much appreciated.