(Starting on a new map for this tutorial, but not necessary)
We will duplicate the marine's original weapon and then change it up!
Before we go to the data editor, please place a Marine on the map somewhere (for player 1), and then some zerglings for Hostile (and a bunch of Drones too if you like!).
Open the Data Editor.
Go to the Weapons tab or click the + button to open it (under Game Data list btw).
Find the Marine - C-14 Gauss Rifle. Right-Click and choose Duplicate Weapon. CHECK OFF THE FOLLOWING:
Actors
Marine Attack
Effects
Marine - Gauss Rifle (Damage)
In the object explorer, rename (& suggest for) the following (they should be in green):
(Actors) Marine Attack Copy to Shotgun Attack
(Effects) Marine - Gauss Rifle Copy (Damage) to Marine - Shotgun (Damage)NOTE: 'Marine' and '(Damage)' are prefix/suffixes
Now rename the Weapon itself to Marine - ShotgunAgain note that Marine is a prefix
Okay so at this point we just have an exact copy of the gauss rifle. What needs to change is that rather than fire a single damage effect at a target, the weapon will need to pick several random points around the target, check at those points if it hit a unit (aka search effect), and THEN deal damage to those units. Hopefully enough shells are fired that it WILL hit the original target as well (not guaranteed though).
Let's begin making our Shotgun!
Switch to the Effects tab.
Right-Click anywhere and choose Add Effect.
Name it Shotgun Shells
Hit Suggest
Make the Effect Type be Set
Hit OK.
For the effect:
Set Maximum Count and Minimum Count to 6.
We will set the Effects+ later.
Again, right-click anywhere and choose Add Effect.
Name it Shotgun Random Offset
Hit Suggest
Make the Effect Type be Create Persistent
Hit OK.
Now for this new effect:
For Flags+, check-off Random Offset.
For Period Count, choose 1.
For Period Durations+, just add one value of 0.0.
We will fill in Period Effects+ later.
For Periodic Offsets+, add 10-15 different offsets with different positive/negative X and Y numbers. Be realistic though, a shotgun's spread is not too much, so maybe keep the X and Y numbers below 2.5...
For Response Flags+, check-off Acquire and Flee.
Back in Shotgun Shells, open Effects+ and add six of the same effect (our Shotgun Random Offset effect).
Now right-click in the effect list again, and choose Add Effect.
Name it Shotgun Search Targets
Hit Suggest
Make the Effect Type be Search Area
Hit OK.
Back in our Shotgun Random Offset effect, open Periodic Effects+ and just add one effect, our new Shotgun Search Targets.
Now for Shotgun Search Targets:
For Response Flags+, check-off Acquire and Flee.
For Maximum Count, choose 1.
Open Search Areas+, add one area.
Choose the effect to be Marine - Shotgun (Damage).
Choose a radius of 1.0.
Hit OK.
Open Search Filters, uncheck Ally, Neutral, and Player.. Also right-click Dead, Hidden, Invulnerable, Item, Missile, and Stasis and set them to Excluded.
Side note: For clarity reasons, I removed the Editor Prefix of "Marine -" from the damage effect... so now it just reads "Shotgun (Damage)".
Switch to the Weapons tab.
Click on our Marine - Shotgun weapon.
Change the Effect to be Shotgun Shells.
Change the Period to be higher so he doesn't shoot so fast.
Switch to the Units tab.
Find the Marine.
Open the Combat:Weapons+ field.
Change the Gauss Rifle weapon to be our shotgun one.
Scroll down and change his health to be way higher so we can test for a while without dieing.
At this point it works mathematically, but visual/audio are busted! We are about to do some CRAZY actor work...
Switch to the Actors tab.
Find our Shotgun Attack.
At the top field (Attack Effect), change the effect to be Shotgun Search Targets.
Open Combat:Launch Assets+.
For Sound, change it to be Reaper_AttackLaunch.
Open Target:Impact Map+ and select the first row.
For Art, change the Model to Ghost Snipe Attack Impact.
For Sound, change it to Reaper_AttackImpact.
Now the shots sound right but there is still no 'bullet' line. Let's fix that!
Right-click in the Actors list and go Add Actor.
Name it Shotgun Beam Impact Site
Hit Suggest
Make the Actor Type be Site
Hit OK.
For this new actor:
Open Host Site Operations+ and for Operations, add a new one (SOpTargetPoint).
Open Event:Events+
Right-click and add a new event.
Msg Type is Effect.
Source Name is Shotgun Search Targets.
Sub Name is Start.
Now right-Click on the event and choose Add Term.
Change the Term Type to be At.
Change the At spot to be Effect.
Finally change the action from ActionImpact to be Create.
Hit OK.
Right-click in the Actors list and go Add Actor.
Name it Shotgun Beam Launch Site
Hit Suggest
Make the Actor Type be Site
Make it based on SiteUNIT
Hit OK.
For this new actor:
Open Host Site Operations+
Add an operation: SOpAttachWeapon.
Hit OK.
Last actor will be a copy of the GhostSnipeAttackBeam. Find it and copy+paste it.
Rename it to be Shotgun Beam.
For Host Impact+, set the Subject to the Actor radial and then choose Shotgun Beam Impact Site.
For Host Launch+:
Set Actor to Creation.
Set Scope to Scope Caster.
Set Subject to the Actor radial and then choose Shotgun Beam Launch Site.
Open Event:Events+
Right-click (on the last event) and add a new event.
Msg Type is Effect.
Source Name is Shotgun Search Targets.
Sub Name is Start.
Now right-Click on the event and choose Add Term.
Change the Term Type to be At.
Change the At spot to be Effect.
Finally change the action from ActionImpact to be Create.
Hit OK.
Go test and check it out!
You might notice the shots tend to spread kind of crazily when the enemy units are very close... you could lower the persistent's offset area numbers... but I kind of see it as 'bullet ricocheting" lol.
Very easy to read and follow. I was able to get mine working last night. One question though. During my testing, I noticed that if there was an enemy between me and my firing point- they would not suffer any damage. How would you modify this weapon to hit anything in the gun's firing path. If I could set this up correctly, then my original target wouldn't get hit because the bullet stopped at the first unit it the path of fire.
In this tutorial I make a new (aoe) weapon for the marine. I do some cool effect chains to make it happen and some advanced beam & site actor stuff.
Map DL link: Link Removed: http://www.mediafire.com/?toa358w03wic388
Text Tutorial
(Starting on a new map for this tutorial, but not necessary)
We will duplicate the marine's original weapon and then change it up!
Before we go to the data editor, please place a Marine on the map somewhere (for player 1), and then some zerglings for Hostile (and a bunch of Drones too if you like!).
Open the Data Editor.
Go to the Weapons tab or click the + button to open it (under Game Data list btw).
Find the Marine - C-14 Gauss Rifle. Right-Click and choose Duplicate Weapon. CHECK OFF THE FOLLOWING:
In the object explorer, rename (& suggest for) the following (they should be in green):
Now rename the Weapon itself to Marine - Shotgun Again note that Marine is a prefix
Okay so at this point we just have an exact copy of the gauss rifle. What needs to change is that rather than fire a single damage effect at a target, the weapon will need to pick several random points around the target, check at those points if it hit a unit (aka search effect), and THEN deal damage to those units. Hopefully enough shells are fired that it WILL hit the original target as well (not guaranteed though).
Let's begin making our Shotgun!
Switch to the Effects tab.
Right-Click anywhere and choose Add Effect.
For the effect:
Again, right-click anywhere and choose Add Effect.
Now for this new effect:
Back in Shotgun Shells, open Effects+ and add six of the same effect (our Shotgun Random Offset effect).
Now right-click in the effect list again, and choose Add Effect.
Back in our Shotgun Random Offset effect, open Periodic Effects+ and just add one effect, our new Shotgun Search Targets.
Now for Shotgun Search Targets:
Side note: For clarity reasons, I removed the Editor Prefix of "Marine -" from the damage effect... so now it just reads "Shotgun (Damage)".
Switch to the Weapons tab.
Click on our Marine - Shotgun weapon.
Switch to the Units tab.
Find the Marine.
At this point it works mathematically, but visual/audio are busted! We are about to do some CRAZY actor work...
Switch to the Actors tab.
Find our Shotgun Attack.
Now the shots sound right but there is still no 'bullet' line. Let's fix that!
Right-click in the Actors list and go Add Actor.
For this new actor:
Right-click in the Actors list and go Add Actor.
For this new actor:
Last actor will be a copy of the GhostSnipeAttackBeam. Find it and copy+paste it.
Go test and check it out!
You might notice the shots tend to spread kind of crazily when the enemy units are very close... you could lower the persistent's offset area numbers... but I kind of see it as 'bullet ricocheting" lol.
Hey- Great Tutorial! Thank you!
Very easy to read and follow. I was able to get mine working last night. One question though. During my testing, I noticed that if there was an enemy between me and my firing point- they would not suffer any damage. How would you modify this weapon to hit anything in the gun's firing path. If I could set this up correctly, then my original target wouldn't get hit because the bullet stopped at the first unit it the path of fire.
Thanks again!
link is dead