- Joined
- Apr 1, 2009
- Messages
- 201
I've been editing NFWar's GUI Bullet/Arc Missile System v1.02. I did receive permission from him to do so. I wanted to edit the system to fit the needs of my map. All I wanted was no arc, no head shot, the missile to go straight, and to have some sort of collision with the environment. So far there is no arc and no head shot action or conditions anymore. I've changed around the variable names and changed some of the custom scripts so I can better understand his system. I'm not sure exactly how to make the bullet go straight until a certain point then disappear, it seems to drop after the ability is cast. I assume it is either the Debug variable or Parabola variable. Also when shooting it on a hill is seems a little glitchy and tends to crash into the ground when there is a tiny bump that you cannot see in game but only with zooming in with the world editor. Not sure how to fix the height or how to add collision. My temporary solution is to make the environment units and that's been working so far and I might just keep it that way. Main point is how do I make the bullet go straight and not drop unless it is fired on a downward angle or until it hits something, if there are any leaks, or if I can improve something. Credit will be given to NFWAR since I only modified his system
-
Setup
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Shoot
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- MissileSkip Equal to 0
-
Then - Actions
- Trigger - Turn on Loop <gen>
- Else - Actions
-
If - Conditions
- -------- Set Points --------
- Set MissilePosition[0] = (Position of (Triggering unit))
- Set MissilePosition[1] = (Target point of ability being cast)
- Set MissileAmount = 1
-
For each (Integer MissileCount) from 1 to MissileAmount, do (Actions)
-
Loop - Actions
- Set MissileSkip = (MissileSkip + 1)
- Set MissileInt = (MissileInt + 1)
- Set MissileOn[MissileInt] = True
- -------- SetVariables --------
- Set MissileTempCaster[MissileInt] = (Triggering unit)
- Set MissileAngle[MissileInt] = (Angle from MissilePosition[0] to MissilePosition[1])
- Set MissileMaxDistance[MissileInt] = (Distance between MissilePosition[0] and MissilePosition[1])
- Set MissileDistanceToTravel[MissileInt] = MissileMaxDistance[MissileInt]
- Custom script: set udg_MissilePointZ = GetLocationZ(udg_MissilePosition[1])
- Custom script: set udg_MissileCasterZ[udg_MissileInt] = GetLocationZ(udg_MissilePosition[0]) + 50
- Set MissileDistance = (Distance between MissilePosition[0] and MissilePosition[1])
- Set MissileRange[MissileInt] = 600.00
- Set MissileCollision[MissileInt] = 50.00
- -------- Checking Up Or Down --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- MissileCasterZ[MissileInt] Greater than MissilePointZ
-
Then - Actions
- Set MissileUp[MissileInt] = False
- Set MissileHeight = (MissileCasterZ[MissileInt] - MissilePointZ)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- MissileCasterZ[MissileInt] Less than MissilePointZ
-
Then - Actions
- Set MissileUp[MissileInt] = True
- Set MissileHeight = (MissilePointZ - MissileCasterZ[MissileInt])
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- MissileCasterZ[MissileInt] Equal to MissilePointZ
-
Then - Actions
- Set MissileHeight = 25.00
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- -------- Setting Formulas --------
- Set Hypotenuse = (Square root(((MissileDistance x MissileDistance) + (MissileHeight x MissileHeight))))
- Set Sine = (MissileDistance / Hypotenuse)
- Set Cosine = (MissileHeight / Hypotenuse)
- -------- Setting HypotenuseSpeed --------
- Set HypotenuseSpeed[MissileInt] = 30.00
- -------- Setting Speed --------
- Set MissileSpeed[MissileInt] = (HypotenuseSpeed[MissileInt] x Sine)
- Set MissileSpeedZ[MissileInt] = (HypotenuseSpeed[MissileInt] x Cosine)
- -------- Create Bullet --------
- Unit - Create 1 Bullet for (Owner of MissileTempCaster[MissileInt]) at MissilePosition[0] facing MissileAngle[MissileInt] degrees
- -------- Set Missile As Last Created Unit --------
- Set Missile[MissileInt] = (Last created unit)
- Unit - Add Storm Crow Form to (Last created unit)
- Unit - Remove Storm Crow Form from (Last created unit)
-
Loop - Actions
- -------- Removing Leaks --------
- Custom script: call RemoveLocation ( udg_MissilePosition[0] )
- Custom script: call RemoveLocation ( udg_MissilePosition[1] )
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events
-
Loop
-
Events
- Time - Every 0.03 seconds of game time
- Conditions
-
Actions
-
For each (Integer MissileSystem) from 1 to MissileInt, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- MissileOn[MissileSystem] Equal to True
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- MissileRange[MissileSystem] Less than or equal to 0.00
-
Then - Actions
- Unit - Kill Missile[MissileSystem]
- Set MissileOn[MissileSystem] = False
- -------- Recycle Indexs --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- MissileSystem Less than MissileInt
-
Then - Actions
- Set MissileOn[MissileSystem] = MissileOn[MissileInt]
- Set Missile[MissileSystem] = Missile[MissileInt]
- Set MissileTempCaster[MissileSystem] = MissileTempCaster[MissileInt]
- Set MissileRange[MissileSystem] = MissileRange[MissileInt]
- Set MissileSpeed[MissileSystem] = MissileSpeed[MissileInt]
- Set HypotenuseSpeed[MissileSystem] = HypotenuseSpeed[MissileInt]
- Set MissileSpeedZ[MissileSystem] = MissileSpeedZ[MissileInt]
- Set MissileCasterZ[MissileSystem] = MissileCasterZ[MissileInt]
- Set MissileAngle[MissileSystem] = MissileAngle[MissileInt]
- Set MissileCollision[MissileSystem] = MissileCollision[MissileInt]
- Set MissileMaxDistance[MissileSystem] = MissileMaxDistance[MissileInt]
- Set MissileDistanceToTravel[MissileSystem] = MissileDistanceToTravel[MissileInt]
- Set MissileParabola[MissileSystem] = MissileParabola[MissileInt]
- Set MissileUp[MissileSystem] = MissileUp[MissileInt]
- Else - Actions
-
If - Conditions
- Set MissileInt = (MissileInt - 1)
- Set MissileSystem = (MissileSystem - 1)
- Set MissileSkip = (MissileSkip - 1)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- MissileSkip Equal to 0
-
Then - Actions
- Set MissileInt = 0
- Trigger - Turn off (This trigger)
- Else - Actions
-
If - Conditions
-
Else - Actions
- -------- Set New Positions --------
- Set MissilePosition[3] = (Position of Missile[MissileSystem])
- Set MissilePosition[4] = (MissilePosition[3] offset by MissileSpeed[MissileSystem] towards MissileAngle[MissileSystem] degrees)
- Set MissileDistanceToTravel[MissileSystem] = (MissileDistanceToTravel[MissileSystem] - MissileSpeed[0])
- Unit - Move Missile[MissileSystem] instantly to MissilePosition[4]
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Playable map area) contains MissilePosition[4]) Equal to False
-
Then - Actions
- Set MissileRange[MissileSystem] = 0.00
-
Else - Actions
- -------- ---------------------------------------------------------------------------------------------------------------------------------------------------------- --------
- -------- Missile traveled some range. Lets set remaining range. --------
- -------- ---------------------------------------------------------------------------------------------------------------------------------------------------------- --------
- Set MissileRange[MissileSystem] = (MissileRange[MissileSystem] - HypotenuseSpeed[MissileSystem])
- -------- ---------------------------------------------------------------------------------------------------------------------------------------------------------- --------
- -------- Need to check height of point where missile traveled to calculate debug height and make missile movement "real" --------
- -------- ---------------------------------------------------------------------------------------------------------------------------------------------------------- --------
- Custom script: set udg_MissileDebugZ[udg_MissileSystem] = GetLocationZ(udg_MissilePosition[4])
- -------- ---------------------------------------------------------------------------------------------------------------------------------------------------------- --------
- -------- Height of missile will change at diferent way when it fly up/down. --------
- -------- ---------------------------------------------------------------------------------------------------------------------------------------------------------- --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- MissileUp[MissileSystem] Equal to False
-
Then - Actions
- Set MissileCasterZ[MissileSystem] = (MissileCasterZ[MissileSystem] - MissileSpeedZ[MissileSystem])
-
Else - Actions
- Set MissileCasterZ[MissileSystem] = (MissileCasterZ[MissileSystem] + MissileSpeedZ[MissileSystem])
-
If - Conditions
- -------- ---------------------------------------------------------------------------------------------------------------------------------------------------------- --------
- -------- Calculation of height that missile must have. --------
- -------- ---------------------------------------------------------------------------------------------------------------------------------------------------------- --------
- Set MissileParabola[MissileSystem] = ((MissileMaxDistance[MissileSystem] - MissileDistanceToTravel[MissileSystem]) + (MissileDistanceToTravel[MissileSystem] / MissileMaxDistance[MissileSystem]))
- Set MissileDebug[MissileSystem] = ((MissileCasterZ[MissileSystem] - MissileDebugZ[MissileSystem]) + MissileParabola[MissileSystem])
- Animation - Change Missile[MissileSystem] flying height to MissileDebug[MissileSystem] at 0.00
- -------- ---------------------------------------------------------------------------------------------------------------------------------------------------------- --------
- -------- Missile flying height is zero and it hit the ground. --------
- -------- ---------------------------------------------------------------------------------------------------------------------------------------------------------- --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- MissileDebug[MissileSystem] Less than or equal to 0.00
-
Then - Actions
- Set MissileRange[MissileSystem] = 0.00
-
Else - Actions
- -------- ---------------------------------------------------------------------------------------------------------------------------------------------------------- --------
- -------- Not zero yet? Pick units to damage someone. --------
- -------- ---------------------------------------------------------------------------------------------------------------------------------------------------------- --------
- Set MissileGroup[MissileSystem] = (Units within MissileCollision[MissileSystem] of MissilePosition[4] matching (((Matching unit) belongs to an enemy of (Owner of MissileTempCaster[MissileSystem])) Equal to True))
- -------- ---------------------------------------------------------------------------------------------------------------------------------------------------------- --------
- -------- Someone is picked, then deal damage. --------
- -------- ---------------------------------------------------------------------------------------------------------------------------------------------------------- --------
-
Unit Group - Pick every unit in MissileGroup[MissileSystem] and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in MissileGroup[MissileSystem]) Greater than 0
-
Then - Actions
- Unit - Cause MissileTempCaster[MissileSystem] to damage (Picked unit), dealing 50.00 damage of attack type Spells and damage type Normal
- Set MissileRange[MissileSystem] = 0.00
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
- Custom script: call DestroyGroup ( udg_MissileGroup[udg_MissileSystem] )
-
If - Conditions
-
If - Conditions
- Custom script: call RemoveLocation ( udg_MissilePosition[3] )
- Custom script: call RemoveLocation ( udg_MissilePosition[4] )
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
For each (Integer MissileSystem) from 1 to MissileInt, do (Actions)
-
Events