Flare
Stops copies me!
- Reaction score
- 662
I discovered a method of making parabolas through GUI (if someone hasn't already thought of it). Currently, the system allows for instant parabola creation and a periodic parabola creation over 3 seconds. I will upload a demo map soon with an example of how this can be used (an accurate grenade arc).
Importing instructions
GUI/JASS: GUI
Leaks: None
MUI: Fully MUI up to 100 instances
Configuring the parabola: Quite simple, done via chat commands which are displayed on game start.
If you intend on using this system, please credit me for making this.
Screenshots
Relevant Code:
WIDTH AND HEIGHT CONTROLS
DIRECTION CONTROLS!
UPDATE! I have finished the timed parabola. It is fully formed after 3 seconds, and is fully MUI up to 100 instances.
Screenshot of the timed parabola in action
Relevant code
Update: Fixed an issue with the Width command trigger, it was changing the width for the previous parabola formed instead of the next one
Importing instructions
Code:
Importing instructions:
-Copy the unit abiliies, Parabola (Instant) and Parabola (Timed)
-Make sure that your editor automatically creates unknown variables (go to File -> Preferences).
-Copy and paste the triggers Immediate, Timed cast and Timed effect.
-Copy the dummy unit Hidden Dummy (other dummy unit is optional, just used as an indicator in the demo map).
-Copy the Height, Width, Left and Right triggers if you wish for the parabola to be configured by text commands.
-Add the abilities to a unit.
WARNING: THIS DEMO MAP DOES NOT/WILL NOT HAVE THE FUNCTIONALITY TO CREATE AN ARC SUCH AS THAT OF A BALL THROWN INTO THE AIR. THAT WILL BE ADDED IN ANOTHER DEMO MAP.
The flying height parabola will not be controlled by text commands, but by distance between caster and target point. The longer the distance, the lower the flying height. The shorter the distance, the greater the flying height
GUI/JASS: GUI
Leaks: None
MUI: Fully MUI up to 100 instances
Configuring the parabola: Quite simple, done via chat commands which are displayed on game start.
If you intend on using this system, please credit me for making this.
Screenshots
Code:
Immediate
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Parabola (Instant)
Actions
Set Caster = (Triggering unit)
Set CasterLoc = (Position of Caster)
Set CasterFacing = (Facing of Caster)
Set ParabolaAngle = (CasterFacing + Direction)
-------- HeightPerEvent is always TotalHeight/(difference between the integer loop's max and min values divided by 2) i.e. 21-1=20/2=10 --------
Set HeightPerEvent = (TotalHeight / 10.00)
-------- HeightDecrease is always HeightPerEvent/(<Max loop value - Min loop value>/2) --------
Set HeightDecrease = (HeightPerEvent / 10.00)
-------- WidthPerEvent is always TotalWidth/(Max loop value - Min loop value) --------
Set WidthPerEvent = (TotalWidth / 20.00)
Unit - Create 1 Hidden Dummy for (Owner of Caster) at CasterLoc facing Default building facing degrees
Set Dummy = (Last created unit)
-------- The integer A from 1 to 21 allows us to get a single maximum point on the curve. --------
For each (Integer A) from 1 to 21, do (Actions)
Loop - Actions
Set WidthPt1 = (Position of Dummy)
Set WidthPt2 = (WidthPt1 offset by WidthPerEvent towards CasterFacing degrees)
Unit - Move Dummy instantly to WidthPt2
Set HeightPt1 = (Position of Dummy)
Set HeightPt2 = (HeightPt1 offset by HeightPerEvent towards ParabolaAngle degrees)
Unit - Move Dummy instantly to HeightPt2
Unit - Create 1 Parabola Effect for (Owner of Caster) at HeightPt2 facing Default building facing degrees
Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
Set HeightPerEvent = (HeightPerEvent - HeightDecrease)
Custom script: call RemoveLocation (udg_WidthPt1)
Custom script: call RemoveLocation (udg_WidthPt2)
Custom script: call RemoveLocation (udg_HeightPt1)
Custom script: call RemoveLocation (udg_HeightPt2)
Unit - Remove Dummy from the game
Custom script: call RemoveLocation (udg_CasterLoc)
WIDTH AND HEIGHT CONTROLS
Code:
height
Events
Player - Player 1 (Red) types a chat message containing h as A substring
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Real((Substring((Entered chat string), 2, 5)))) Greater than 1000.00
Then - Actions
Game - Display to (All players) the text: Max height is 1000,...
Set TotalHeight = (1000.00 x 2.00)
Else - Actions
Set TotalHeight = ((Real((Substring((Entered chat string), 2, 5)))) x 2.00)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Real((Substring((Entered chat string), 2, 5)))) Less than 100.00
Then - Actions
Game - Display to (All players) the text: Minimum height is 1...
Set TotalHeight = (100.00 x 2.00)
Else - Actions
Set TotalHeight = ((Real((Substring((Entered chat string), 2, 5)))) x 2.00)
Code:
Width
Events
Player - Player 1 (Red) types a chat message containing w as A substring
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Real((Substring((Entered chat string), 2, 5)))) Greater than 1000.00
Then - Actions
Game - Display to (All players) the text: Max width is 1000, ...
Set TotalWidth = 1000.00
Else - Actions
Set TotalWidth = ((Real((Substring((Entered chat string), 2, 5)))) x 1.00)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Real((Substring((Entered chat string), 2, 5)))) Less than 100.00
Then - Actions
Game - Display to (All players) the text: Minimum width is 10...
Set TotalWidth = 100.00
Else - Actions
Set TotalWidth = ((Real((Substring((Entered chat string), 2, 5)))) x 1.00)
DIRECTION CONTROLS!
Code:
Left
Events
Player - Player 1 (Red) types a chat message containing l as An exact match
Conditions
Actions
Set Direction = 90.00
Game - Display to (All players) the text: Direction: Left
Code:
Right
Events
Player - Player 1 (Red) types a chat message containing r as An exact match
Conditions
Actions
Set Direction = -90.00
Game - Display to (All players) the text: Direction: Right
UPDATE! I have finished the timed parabola. It is fully formed after 3 seconds, and is fully MUI up to 100 instances.
Screenshot of the timed parabola in action
Code:
Timed cast
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Parabola (Timed)
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
CustomValue Less than 100
Then - Actions
Set CustomValue = (CustomValue + 1)
Else - Actions
Set CustomValue = 1
Set Caster[CustomValue] = (Triggering unit)
Set CasterFacing[CustomValue] = (Facing of Caster[CustomValue])
Set CasterLoc[CustomValue] = (Position of Caster[CustomValue])
Set ParabolaAngle[CustomValue] = (CasterFacing[CustomValue] + Direction[CustomValue])
-------- HeightPerEvent is always TotalHeight/(number of times the periodic event will occur/2) i.e. 75/2 --------
Set HeightPerEvent[CustomValue] = (TotalHeight[CustomValue] / 37.50)
-------- HeightDecrease is always HeightPerEvent/Number of times the periodic event occurs divided by 2 --------
Set HeightDecrease[CustomValue] = (HeightPerEvent[CustomValue] / 37.50)
-------- WidthPerEvent is always TotalWidth/Number of times periodic event occurs in time it takes to form parabola divided by 2 --------
-------- i.e. 0.04 periodic event into 3 seconds is 75 occurences divided by 2 is 37.5 --------
Set WidthPerEvent[CustomValue] = (TotalWidth[CustomValue] / 37.50)
Unit - Create 1 Hidden Dummy for (Owner of Caster[CustomValue]) at CasterLoc[CustomValue] facing Default building facing degrees
Unit - Set the custom value of (Last created unit) to CustomValue
Set Dummy[CustomValue] = (Last created unit)
Unit Group - Add Dummy[CustomValue] to DummyGroup
Set Time[CustomValue] = 3.00
Custom script: call RemoveLocation (udg_CasterLoc[GetUnitUserData(GetEnumUnit())])
Code:
Timed effect
Events
Time - Every 0.04 seconds of game time
Conditions
(Number of units in DummyGroup) Greater than 0
Actions
Unit Group - Pick every unit in DummyGroup and do (Actions)
Loop - Actions
Set WidthPt1[(Custom value of (Picked unit))] = (Position of (Picked unit))
Set Time[(Custom value of (Picked unit))] = (Time[(Custom value of (Picked unit))] - 0.04)
Set WidthPt2[(Custom value of (Picked unit))] = (WidthPt1[(Custom value of (Picked unit))] offset by WidthPerEvent[(Custom value of (Picked unit))] towards CasterFacing[(Custom value of (Picked unit))] degrees)
Unit - Move (Picked unit) instantly to WidthPt2[(Custom value of (Picked unit))]
Set HeightPt1[(Custom value of (Picked unit))] = (Position of (Picked unit))
Set HeightPt2[(Custom value of (Picked unit))] = (HeightPt1[(Custom value of (Picked unit))] offset by HeightPerEvent[(Custom value of (Picked unit))] towards ParabolaAngle[(Custom value of (Picked unit))] degrees)
Unit - Move (Picked unit) instantly to HeightPt2[(Custom value of (Picked unit))]
Unit - Create 1 Parabola Effect for (Owner of Caster[(Custom value of (Picked unit))]) at HeightPt2[(Custom value of (Picked unit))] facing Default building facing degrees
Unit - Add a 5.00 second Generic expiration timer to (Last created unit)
Set HeightPerEvent[(Custom value of (Picked unit))] = (HeightPerEvent[(Custom value of (Picked unit))] - HeightDecrease[(Custom value of (Picked unit))])
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Time[(Custom value of (Picked unit))] Less than or equal to 0.00
Then - Actions
Set Time[(Custom value of (Picked unit))] = 3.00
Unit - Remove (Picked unit) from the game
Else - Actions
Custom script: call RemoveLocation (udg_WidthPt1[GetUnitUserData(GetEnumUnit())])
Custom script: call RemoveLocation (udg_WidthPt2[GetUnitUserData(GetEnumUnit())])
Custom script: call RemoveLocation (udg_HeightPt1[GetUnitUserData(GetEnumUnit())])
Custom script: call RemoveLocation (udg_HeightPt2[GetUnitUserData(GetEnumUnit())])
Update: Fixed an issue with the Width command trigger, it was changing the width for the previous parabola formed instead of the next one