AceHart
Your Friendly Neighborhood Admin
- Reaction score
- 1,495
What is it?
"Blink Move" is a passive ability that automagically blinks you to some target point when you order your unit to move or attack-move.
Why would I want that?
- It's fun.
- It makes all the sense on epic maps
- You get the fastest unit around.
- Just because.
GUI
Usage:
Either enter the trigger yourself, or copy&paste it from the attached map.
For copy&paste to work correctly, make sure to have a check on "auto-create unknown variables" in menu: File / Preferences.
Edit the condition as needed.
JASS
Usage:
Create a new trigger, convert to custom script.
Replace whatever shows there with the above.
Adjust constants as needed.
Requires NewGen.
Enjoy.
Yours,
AceHart
Q: OMG, this has been done 1000003 times already!
A: So?
Q: It's MUI I take it?
A: Yep.
Q: The GUI version too?
A: Yep.
Q: Why is there a GUI version actually???
A: Yep.
Q: Looks simple...
A: Yep.
Q: Would be good to have a different max distance per level
A: Well, then get busy.
Q: My unit ended up in some weird spot!
A: Well, it has Blink Move, doesn't it?
Q: I WAITS JUST FOR TAHT!!!1one1LOL!
A: Coincidence
Q: Are there any leaks?
A: ...
Q: Why do you turn the trigger off near the end?
A: If remaining distance greater than minimum distance then call trigger again automatically
Q: ...
A: Me too
The map:
"Blink Move" is a passive ability that automagically blinks you to some target point when you order your unit to move or attack-move.
Why would I want that?
- It's fun.
- It makes all the sense on epic maps
- You get the fastest unit around.
- Just because.
GUI
Trigger:
- Blink Move GUI
- Events
- Unit - A unit Is issued an order targeting a point
- Conditions
- (Level of Blink for (Triggering unit)) Greater than 0
- Or - Any (Conditions) are true
- Conditions
- (Issued order) Equal to (Order(smart))
- (Issued order) Equal to (Order(attack))
- Conditions
- Actions
- Set Point1 = (Position of (Triggering unit))
- Set Point2 = (Target point of issued order)
- Set Distance = (Distance between Point1 and Point2)
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- Distance Greater than 500.00
- Then - Actions
- Special Effect - Create a special effect at Point1 using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
- Special Effect - Destroy (Last created special effect)
- Special Effect - Create a special effect at Point2 using Abilities\Spells\NightElf\Blink\BlinkTarget.mdl
- Special Effect - Destroy (Last created special effect)
- Set Distance = (Distance - 200.00)
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- Distance Greater than 2000.00
- Then - Actions
- Set Distance = 2000.00
- Else - Actions
- If - Conditions
- Set Point3 = (Point1 offset by Distance towards (Angle from Point1 to Point2) degrees)
- Unit - Move (Triggering unit) instantly to Point3
- Custom script: call RemoveLocation( udg_Point3 )
- Trigger - Turn off (This trigger)
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Issued order) Equal to (Order(smart))
- Then - Actions
- Unit - Order (Triggering unit) to Move To Point2
- Else - Actions
- Unit - Order (Triggering unit) to Attack-Move To Point2
- If - Conditions
- Trigger - Turn on (This trigger)
- Else - Actions
- If - Conditions
- Custom script: call RemoveLocation( udg_Point1 )
- Custom script: call RemoveLocation( udg_Point2 )
- Events
Usage:
Either enter the trigger yourself, or copy&paste it from the attached map.
For copy&paste to work correctly, make sure to have a check on "auto-create unknown variables" in menu: File / Preferences.
Edit the condition as needed.
JASS
JASS:
scope BlinkMove initializer Init
globals
// Order ID of your ability
private constant integer SPELL_ID = 039;AEbl039;
// Adjust to taste
private constant real MIN_DISTANCE = 500.0 // No blink if less than this
private constant real MAX_DISTANCE = 2000.0 // Set to 99999.0 if you want this to work across the entire map
private constant real END_DISTANCE = 200.0 // Blink this close to the end point
// Effects to show on start and end points
private constant string EFFECT_START = "Abilities\\Spells\\NightElf\\Blink\\BlinkCaster.mdl"
private constant string EFFECT_END = "Abilities\\Spells\\NightElf\\Blink\\BlinkTarget.mdl"
// Leave as is
private trigger t = CreateTrigger()
private integer ORDER_SMART
private integer ORDER_ATTACK
endglobals
// The unit needs the spell and must have been ordered to move or attack-move (Right-click or "A")
private function Conditions takes nothing returns boolean
return GetUnitAbilityLevel(GetTriggerUnit(), SPELL_ID) > 0 and (GetIssuedOrderId() == ORDER_SMART or GetIssuedOrderId() == ORDER_ATTACK)
endfunction
private function Actions takes nothing returns nothing
local unit u = GetTriggerUnit() // Caster
local real x1 = GetUnitX(u) // Position of caster
local real y1 = GetUnitY(u)
local real x2 = GetOrderPointX() // Point we want to go to
local real y2 = GetOrderPointY()
local real d = SquareRoot((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)) // Distance from caster to target point
local real a = Atan2(y2 - y1, x2 - x1) // Angle from caster's position to target point
if d > MIN_DISTANCE then // Don't blink for too short a distance
call DestroyEffect(AddSpecialEffect(EFFECT_START, x1, y1)) // Eye-candy starting point
set d = d - END_DISTANCE // This close to the end point
if d > MAX_DISTANCE then // but respect the maximum distance
set d = MAX_DISTANCE
endif
set x1 = x1 + d * Cos(a) // Point that is nearly there
set y1 = y1 + d * Sin(a)
call DestroyEffect(AddSpecialEffect(EFFECT_END, x1, y1)) // Eye-candy target point
call SetUnitX(u, x1) // Move caster "almost" there...
call SetUnitY(u, y1)
call DisableTrigger(t)
if GetIssuedOrderId() == ORDER_SMART then // ...and order the unit to (attack-)move the rest
call IssuePointOrder(u, "move", x2, y2)
else
call IssuePointOrder(u, "attack", x2, y2)
endif
call EnableTrigger(t)
endif
set u = null // Done
endfunction
private function Init takes nothing returns nothing
set ORDER_SMART = OrderId("smart")
set ORDER_ATTACK = OrderId("attack")
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER) // A unit is issued an order targeting a point
call TriggerAddCondition(t, Condition(function Conditions))
call TriggerAddAction(t, function Actions)
endfunction
endscope
Usage:
Create a new trigger, convert to custom script.
Replace whatever shows there with the above.
Adjust constants as needed.
Requires NewGen.
Enjoy.
Yours,
AceHart
Q: OMG, this has been done 1000003 times already!
A: So?
Q: It's MUI I take it?
A: Yep.
Q: The GUI version too?
A: Yep.
Q: Why is there a GUI version actually???
A: Yep.
Q: Looks simple...
A: Yep.
Q: Would be good to have a different max distance per level
A: Well, then get busy.
Q: My unit ended up in some weird spot!
A: Well, it has Blink Move, doesn't it?
Q: I WAITS JUST FOR TAHT!!!1one1LOL!
A: Coincidence
Q: Are there any leaks?
A: ...
Q: Why do you turn the trigger off near the end?
A: If remaining distance greater than minimum distance then call trigger again automatically
Q: ...
A: Me too
The map: