• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Vote for the theme of Hive's HD Modeling Contest #7! Click here to vote! - Please only vote if you plan on participating❗️

Blink ability issue.

Status
Not open for further replies.
Level 12
Joined
Dec 2, 2016
Messages
733

Rheiko

Spell Reviewer
Level 25
Joined
Aug 27, 2013
Messages
4,126
If you can see in the gif, I try to use the blink ability up that ledge but it doesn't allow me to blink there. I have the range set to 100, I need to have it so no matter where you blink it trys to blink there even if it's out of range. Anyone know what the issue is?
Sadly, you can't achieve that with simple blink ability since it can only be cast at terrain with pathing on. You need to find a point target ability that can be cast at terrain with pathing off first before we can code it because I don't have WE right now.
 
Level 12
Joined
Dec 2, 2016
Messages
733
This blizzard ability, it's working. But I need it so that no matter where you are it tries teleporting to that location. Like it will blink you X amount of distance closer to the target point. With this blizzard ability it will only blink you if you are within range of the position, if you're not character walks to that position. Do I need to use a different ability or?
 
Level 12
Joined
Dec 2, 2016
Messages
733
I can't seem to figure out how to put the final coordinates into a region or way for the 'Move' action to recognize it as a viable position. Any help? I'm pretty sure all I need to do now is move the unit to 'SphereBlinkFinalRange' variable position.

  • Sphere Blink
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set SphereBlinkTarget = (Target point of ability being cast)
      • Set SphereBlinkMagnitude = (Distance between (Position of (Triggering unit)) and SphereBlinkTarget)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SphereBlinkMagnitude Greater than or equal to 500.00
          • (Ability being cast) Equal to Sphere of Doom Blink Custom
        • Then - Actions
          • Set SphereBlinkFinalRange = (SphereBlinkMagnitude - 500.00)
          • Unit - Move (Triggering unit) instantly to (Target point of ability being cast)
          • Game - Display to (All players) the text: Too far
        • Else - Actions
          • Unit - Move (Triggering unit) instantly to (Target point of ability being cast)
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,266
There are many ways this could be done.
  • Separate X/Y coordinates. Find delta between caster and target point. Use Pythagoras theorem to get distance. If less than 500 use target point. If more than 500 then divide 500 by the actual distance to get the fraction of the distance that is 500. Multiply the X/Y delta by this fraction. Add this new X/Y delta to the caster point and use the result.
  • If distance between caster and target point is less than or equal to 500, then move the unit there. Otherwise move the unit to caster point offset by 500 towards angle between caster and target point.
If using location objects remember to pass them to RemoveLocation before losing references to them to prevent resource leaks.
 
Level 12
Joined
Dec 2, 2016
Messages
733
There are many ways this could be done.
  • Separate X/Y coordinates. Find delta between caster and target point. Use Pythagoras theorem to get distance. If less than 500 use target point. If more than 500 then divide 500 by the actual distance to get the fraction of the distance that is 500. Multiply the X/Y delta by this fraction. Add this new X/Y delta to the caster point and use the result.
  • If distance between caster and target point is less than or equal to 500, then move the unit there. Otherwise move the unit to caster point offset by 500 towards angle between caster and target point.
If using location objects remember to pass them to RemoveLocation before losing references to them to prevent resource leaks.

If I use your second method which is a lot simpler :p

This ability can be cast anywhere on the map, so if he teleports to the other side of the map offset by 500 not sure what that will accomplish?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,266
This ability can be cast anywhere on the map, so if he teleports to the other side of the map offset by 500 not sure what that will accomplish?
He would be moved 500 in the direction pressed, similar to Stalker Blink in SC2.
Sorry I'm really lost, been trying to figure this out but my math skills aren't sufficient enough.
It needs maths skills? You are using polar offset from the caster position by 500 units facing the angle between the caster and the target point. There is a dedicated real function to return the angle between one point and another.

One just must remember to remove all the location objects after they are no longer needed otherwise they leak. This is a WC3/programming problem and not maths related.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,266
Well, offset by 500 just means 500 less than the actual end distance. Wouldn't it be distance between the 2 points - 500?
If that is what you want. I thought you wanted Stalker blink which could be cast anywhere on the map but would only move the casting unit up to a maximum distance (this case) from where it currently is.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,266
You can try embedding the unit into the location using SetUnitX and SetUnitY natives. There is no GUI action for this so you will need to use custom script (JASS).

Assuming a location variable named TargetPoint and a unit variable name CasterUnit...
JASS:
call SetUnitX(udg_CasterUnit, GetLocationX(udg_TargetPoint))
call SetUnitY(udg_CasterUnit, GetLocationY(udg_TargetPoint))
Each line would be a separate custom script action.
 
Level 12
Joined
Dec 2, 2016
Messages
733
If doing that do you mean he can like for lack of a better word bug himself into a position, or would that only allow the blink if the path is viable otherwise just teleport him in that direction but not actually ending up in the target point?

Because I don't want him to actually get to the position if it's out of range, I just want it too look like he's blinking at the ledge and then be stopped at the ledge.
 
Level 4
Joined
Jan 17, 2018
Messages
112
Vampirism Fire actually. I don't see how that dagger post has to do with this ability though?

Blink dagger from Dota works like how you want it, port a distance forward regardless of specified distance and doesn't move you sideways.
 
Level 12
Joined
Dec 2, 2016
Messages
733
Yeah but I don't want him to go to the nearest possible location unless it's within his blink range. Like I don't want him to end up in a bugged spot where he can't move.

The whole idea of using a custom blink is because the normal blink wasn't working properly and required a pathable area, even in a pathable area it was giving me a message I couldn't blink.

I just need it so that I can't blink and end up in the nearest pathable location only legit spot within his blink range. Does that make sense?
 
Level 4
Joined
Jan 17, 2018
Messages
112
I'm not home to try, but check if vamps speed is protected or not, there's a sphere of doom in there that teleports you 2 tiles forward or 100 range or something like that, then you can copy the code from there.
 
Level 12
Joined
Dec 2, 2016
Messages
733
It's not open source.

I also messaged that guy about the dagger but that post was made in 2010 unlikely to get a response.

In the current version of Vampirism Fire 5.12 it acts just like a normal blink ability but never gives you a error message because you can't blink there. Basically if it's unpathable it will show a blink animation and not teleport you there, which is what I need to happen. Any other ideas? Can I detect if the path is not pathable and then just do the animation and not move?
 
Last edited:
Level 12
Joined
Dec 2, 2016
Messages
733
  • Sphere Blink
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set SphereBlinkTarget = (Target point of ability being cast)
      • Set SphereBlinkMagnitude = (Distance between (Position of (Triggering unit)) and SphereBlinkTarget)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain pathing at (Target point of ability being cast) of type Buildability is off) Equal to True
          • SphereBlinkMagnitude Greater than or equal to 150.00
          • (Ability being cast) Equal to Sphere of Doom Blink Custom
        • Then - Actions
          • Game - Display to (All players) the text: Too far
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SphereBlinkMagnitude Greater than or equal to 150.00
              • (Ability being cast) Equal to Sphere of Doom Blink Custom
            • Then - Actions
              • Unit - Move (Triggering unit) instantly to ((Target point of ability being cast) offset by ((Distance between (Target point of ability being cast) and (Position of (Triggering unit))) - 175.00) towards (Angle from (Target point of ability being cast) to (Position of (Triggering unit))) degrees)
            • Else - Actions
              • Unit - Move (Triggering unit) instantly to (Target point of ability being cast)

Is there a way to detect if a unit had a displacement and position was corrected? If so I could revert the unit back to the original position if that happens.
 
Level 12
Joined
Dec 2, 2016
Messages
733
One needs to use a custom pathability check that involves either an item or unit. The standard one only looks at the pathing map file, so destructable and building pathing is ignored.
So I create an item at the ability target point and then check if distance between player and item is less than X? And if it's greater teleport back to origin point?

Edit: ^ and if that will work, I can't figure out how to compare an items position and a units positon. No if statement seems to have that property.
 
Last edited:
Level 12
Joined
Dec 2, 2016
Messages
733
Well figured it out, makes like no sense to me but it works haha.

  • Sphere Blink
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set SphereBlinkTarget = (Target point of ability being cast)
      • Set SphereBlinkMagnitude = (Distance between (Position of (Triggering unit)) and SphereBlinkTarget)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain pathing at (Target point of ability being cast) of type Buildability is off) Equal to True
          • SphereBlinkMagnitude Greater than or equal to 150.00
          • (Ability being cast) Equal to Sphere of Doom Blink Custom
        • Then - Actions
          • Game - Display to (All players) the text: Too far
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SphereBlinkMagnitude Greater than or equal to 150.00
              • (Ability being cast) Equal to Sphere of Doom Blink Custom
            • Then - Actions
              • Item - Create Tome of Experience at ((Target point of ability being cast) offset by ((Distance between (Target point of ability being cast) and (Position of (Triggering unit))) - 175.00) towards (Angle from (Target point of ability being cast) to (Position of (Triggering unit))) degrees)
              • Unit - Move (Triggering unit) instantly to ((Target point of ability being cast) offset by ((Distance between (Target point of ability being cast) and (Position of (Triggering unit))) - 175.00) towards (Angle from (Target point of ability being cast) to (Position of (Triggering unit))) degrees)
              • Unit - Move (Triggering unit) instantly to (Position of (Last created item))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Region((Position of (Triggering unit)), (Position of (Triggering unit)))) contains (Position of (Last created item))) Equal to True
                • Then - Actions
                  • Game - Display to (All players) the text: Yes it does
                • Else - Actions
                  • Game - Display to (All players) the text: No it doesnt
            • Else - Actions
              • Unit - Move (Triggering unit) instantly to (Target point of ability being cast)
I noticed that when my player blinked up the ledge the experience tome stayed at the bottom. So I make my unit teleport to the item right after and it doesn't do the displacement. I'm guessing the size of the player causes the displacement while the tomb doesn't?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,266
The idea is that the target point is not pathable if the item is displaced more than a small distance from it. There are like a dozen standard systems to do this so I would advise using one of them than trying to reinvent your own.

Also your trigger leaks a lot.
 
Level 12
Joined
Dec 2, 2016
Messages
733
So I know how would I remove the leaks of my trigger?

I'm assuming the item leaks, so would I create a variable and assign the item to the variable and then destroy the variable?

Anything else that leaks?
 
Level 12
Joined
Dec 2, 2016
Messages
733
  • Sphere Blink
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set SphereBlinkTarget = (Target point of ability being cast)
      • Set SphereBlinkMagnitude = (Distance between (Position of (Triggering unit)) and SphereBlinkTarget)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain pathing at (Target point of ability being cast) of type Buildability is off) Equal to True
          • SphereBlinkMagnitude Greater than or equal to 150.00
          • (Ability being cast) Equal to Sphere of Doom Blink Custom
        • Then - Actions
          • Game - Display to (All players) the text: Too far
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SphereBlinkMagnitude Greater than or equal to 150.00
              • (Ability being cast) Equal to Sphere of Doom Blink Custom
            • Then - Actions
              • Item - Create Tome of Experience at ((Target point of ability being cast) offset by ((Distance between (Target point of ability being cast) and (Position of (Triggering unit))) - 175.00) towards (Angle from (Target point of ability being cast) to (Position of (Triggering unit))) degrees)
              • Set TempItem = (Last created item)
              • Unit - Move (Triggering unit) instantly to ((Target point of ability being cast) offset by ((Distance between (Target point of ability being cast) and (Position of (Triggering unit))) - 175.00) towards (Angle from (Target point of ability being cast) to (Position of (Triggering unit))) degrees)
              • Unit - Move (Triggering unit) instantly to (Position of (Last created item))
              • Item - Remove TempItem
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Region((Position of (Triggering unit)), (Position of (Triggering unit)))) contains (Position of (Last created item))) Equal to True
                • Then - Actions
                  • Game - Display to (All players) the text: Yes it does
                • Else - Actions
                  • Game - Display to (All players) the text: No it doesnt
            • Else - Actions
              • Unit - Move (Triggering unit) instantly to (Target point of ability being cast)
Is there anything wrong with using this ^? Or would it be in my best interest to redo it like suggested above^?
And regarding my trigger above, is there any current leaks?

Also a 2nd question, my ability no longer has a mouse cursor. How do I add that back? And if I want an effect played when the ability is used, should I create the effect via trigger or how do I add the effect to the ability. I can't seem to figure out where I should add that to display an effect.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,266
Sorry what do you mean by removal script?
You pass the object as an argument to a call to the appropriate destructor native.

For example...
JASS:
call RemoveLocation(udg_YourPointVariable) // Cleans up Point object.
call DestroyGroup(udg_YourUnitGroup) // Cleans up Unit Group object.
call DestroyForce(udg_YourPlayerGroup) // Cleans up Player Group object.

Fixing leaks is one of the most common questions asked on this forum. There are thousands of threads involving it.

Why remove leaks? Would you like to be on a ship that's hull is leaking? Pretty much the same reason. After enough leaks occur WC3 starts to perform very badly and can even crash.

In StarCraft II this problem was solved by an automatic garbage collector. In that game simple objects like points cannot leak as they are automatically destroyed once the last reference to them is lost. Similar to how languages like C# and Java work.
 
Level 12
Joined
Dec 2, 2016
Messages
733
You pass the object as an argument to a call to the appropriate destructor native.

For example...
JASS:
call RemoveLocation(udg_YourPointVariable) // Cleans up Point object.
call DestroyGroup(udg_YourUnitGroup) // Cleans up Unit Group object.
call DestroyForce(udg_YourPlayerGroup) // Cleans up Player Group object.

Fixing leaks is one of the most common questions asked on this forum. There are thousands of threads involving it.

Why remove leaks? Would you like to be on a ship that's hull is leaking? Pretty much the same reason. After enough leaks occur WC3 starts to perform very badly and can even crash.

In StarCraft II this problem was solved by an automatic garbage collector. In that game simple objects like points cannot leak as they are automatically destroyed once the last reference to them is lost. Similar to how languages like C# and Java work.


Would you be able to link me a list of all possible things that leak? I can't seem to find a good page for it.
Or a page with all the Jass destructors?

Like for example, how do I remove an item?

Code:
call Destroy(udg_YourItem)

Do I need to remove all those variables like distance between two objects?
 
Status
Not open for further replies.
Top