HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Vietnam War Map's Machine Gunning System

10-29-2006, 03:45 PM#1
illidan92
To help everyone out on their shooter-like maps, i'll show you how I successfully made a shooting system for my machine gunner class. It uses 3 triggers, too. I have 2 variables, point and unit group. Point is indexed to size 2 since the game limits the amount of MGers to 2 for the map. "Shoot M60 Machine Gun" is based off of the cloud of fog ability, with mana cost 0 and duration as high as possible so they don't just stop shooting. The heros have an ability called "Heavy Weapons Proficiency" which increases their damage, and the dummy unit's dummy spell is based off of carrion swarm, and has 5 levels which increase the damage prior to the proficiency ability.

Trigger:
Machine Gun Shooting
Collapse Events
Unit - A unit Begins channeling an ability
Collapse Conditions
(Ability being cast) Equal to Shoot M60 Machine Gun
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Distance between (Position of (Casting unit)) and (Target point of ability being cast)) Greater than or equal to 250.00
Collapse Then - Actions
Unit Group - Add (Casting unit) to Machine_Gun_Shooters
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Casting unit) Equal to Machine_Gunners[1]
Collapse Then - Actions
Set Machine_Gun_Target[1] = (Target point of ability being cast)
Collapse Else - Actions
Set Machine_Gun_Target[2] = (Target point of ability being cast)
Camera - Shake the camera for (Owner of (Casting unit)) with magnitude 4.50
Collapse Else - Actions
Unit - Order (Casting unit) to Stop
Game - Display to (Player group((Owner of (Casting unit)))) for 8.00 seconds the text: You must shoot at l...

Trigger:
Machine Gun Shooting Stop
Collapse Events
Unit - A unit Stops casting an ability
Collapse Conditions
(Ability being cast) Equal to Shoot M60 Machine Gun
Collapse Actions
Unit Group - Remove (Casting unit) from Machine_Gun_Shooters
Camera - Stop swaying/shaking the camera for (Owner of (Casting unit))
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
Machine_Gunners[1] Equal to (Casting unit)
Collapse Then - Actions
Custom script: call RemoveLocation(udg_Machine_Gun_Target[1])
Collapse Else - Actions
Custom script: call RemoveLocation(udg_Machine_Gun_Target[2])

Trigger:
Machine Gun Shooting Recycle
Collapse Events
Time - Every 0.12 seconds of game time
Conditions
Collapse Actions
Collapse Unit Group - Pick every unit in Machine_Gun_Shooters and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
((Owner of (Picked unit)) Current gold) Equal to 0
Collapse Then - Actions
Sound - Play NoAmmo <gen> at 100.00% volume, attached to (Picked unit)
Animation - Play (Picked unit)'s stand animation
Collapse Else - Actions
Animation - Play (Picked unit)'s attack animation
Player - Add -1 to (Owner of (Picked unit)) Current gold
Unit - Create 1 M60 Machine Gun Dummy for (Owner of (Picked unit)) at (Position of (Picked unit)) facing Default building facing (270.0) degrees
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
Unit - Set level of M60 Machine Gun Dummy Shoot for (Last created unit) to (Level of Heavy Weapons Proficiency (Hero) for (Picked unit))
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Picked unit) Equal to Machine_Gunners[1]
Collapse Then - Actions
Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm (Machine_Gun_Target[1] offset by ((Random real number between -150.00 and 150.00), (Random real number between -150.00 and 150.00)))
Collapse Else - Actions
Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm (Machine_Gun_Target[2] offset by ((Random real number between -150.00 and 150.00), (Random real number between -150.00 and 150.00)))

The offset makes it so he doesn't shoot exactly where the target is every time (accuracy basicly), and can spray if he wants to by casting it closer to his hero. The machine gun target is the point variable so we know where we want the dummy to shoot.
10-29-2006, 03:52 PM#2
Captain Griffen
Leaks like hell.
10-29-2006, 03:54 PM#3
illidan92
Leaks? How so? Is it because of my if/then/else functions I bet? Yeah thats very easy to fix...
10-29-2006, 03:55 PM#4
iNfraNe
If you shoot at the place you're standing you make a 360 wide spread, -.-

And no it leaks cause you dont clean up locations you use.
10-29-2006, 05:05 PM#5
illidan92
OHHH THATS RIGHT! Whats the JASS again? Remove udg_LOCATION?

I'll make a condition that makes sure it's at least 150 away from the shooter too.
10-29-2006, 05:34 PM#6
Thunder_Eye
call RemoveLocation(udg_location)
10-29-2006, 05:51 PM#7
iNfraNe
Quote:
Originally Posted by illidan92
OHHH THATS RIGHT! Whats the JASS again? Remove udg_LOCATION?

I'll make a condition that makes sure it's at least 150 away from the shooter too.
orrrrrr.... you could make it depend on the angle instead.
10-29-2006, 06:20 PM#8
illidan92
Okay I did it all.