• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Why is making a Blink Strike spell so difficult?

Status
Not open for further replies.
Level 3
Joined
Aug 24, 2014
Messages
22
  • Blink Strike
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Blink Strike
    • Actions
      • Set temp_point = (Position of (Target unit of ability being cast))
      • Unit - Move (Triggering unit) instantly to (temp_point offset by 140.00 towards ((Facing of (Target unit of ability being cast)) - 180.00) degrees)
      • Unit - Order (Triggering unit) to Attack (Target unit of ability being cast)
      • Custom script: call RemoveLocation (udg_temp_point)
Basically a blink strike is a spell when you cast on an enemy, you will be teleported to the position of the enemy. Very simple but I can't make it :oops:

Whenever I cast this spell the skill will not go on cooldown. The ability is based on Channel.

If I change the Event to Finish casting an ability, the skill will go on cooldown but you will get teleported to the middle of the map instead.

Edit: solved
 
Last edited:
Level 8
Joined
Jan 28, 2016
Messages
486
Well I did a quick search on Google and found this spellpack on The Helper by popo80000. I can't check the map at this moment but I assume it's in GUI so it should help you figure out how to code a functioning Blink Strike.
 
Level 20
Joined
Aug 13, 2013
Messages
1,696
It's either the GUI function for moving
( interrupts the order ) or a user-fault in modifying the custom channel ability. As Dracolich said, JASS functions are useful;
( In this case you may need custom script action and coordinates for moving a unit )
  • Custom Script: local real x = GetSpellTargetX()
  • Custom Script: local real y = GetSpellTargetY()
  • Custom Script: call SetUnitX(GetTriggerUnit(),x)
  • Custom Script: call SetUnitY(GetTriggerUnit(),y)
^ In this way it will not interrupt your caster and moves smoothly.
 

Kyrbi0

Arena Moderator
Level 45
Joined
Jul 29, 2008
Messages
9,504
Whatever happened to simply using Blink, catching the cast, and then damaging the area he lands in (there's a Damage Area trigger, or my favorite, spawn a Dummy Caster who insta-dies with an AoE Explode Upon Death ability)?

//EDIT// - Ha, actually read the first post in detail; unit-target, eh? I mean, I guess... I'm surprised that simply trigger-Moving him doesn't work. Any old unit-target spell should work (e.g. Chain Lightning)
 
Level 39
Joined
Feb 27, 2007
Messages
5,019
I'm with Kyrbi0 on this one. This spell is so simple that
  • Blink Strike
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Blink Strike
    • Actions
      • Set temp_point = (Position of (Target unit of ability being cast))
      • Unit - Move (Triggering unit) instantly to (temp_point offset by 140.00 towards ((Facing of (Target unit of ability being cast)) - 180.00) degrees)
      • Unit - Order (Triggering unit) to Attack (Target unit of ability being cast)
      • Custom script: call RemoveLocation (udg_temp_point)
should work 100% with no problems. I'd say picking Channel was probably the issue, though that's been the staple base ability as far back as I can remember so idk.
 
Level 4
Joined
Nov 25, 2013
Messages
132
Instead of using the "attack target of ability being cast" you could also use "deal xxx damage to target of ability being cast". The purpose of that is you could just blink to the target unit and press attack button.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
"should work 100% with no problems."
That is wrong.
The ability cooldowns are applied on the spells immediately AFTER the onAbilityEffect event runs.
This means that issueing an order (Unit - Order (Triggering unit) to Attack (Target unit of ability being cast)), or any other kind of interruption (Unit - Move (Triggering unit) instantly to (temp_point offset by 140.00 towards ((Facing of (Target unit of ability being cast)) - 180.00) degrees)), will cause the ability to stop processing the remaining actions such as the cooldown.
(Removing the ability also does not start the cooldown... or at least, it just loses the data of the cooldown essentially resetting it if you give the ability back immediately.)

In JASS, you have the same problem.
You can remove the issue of the movement, but you cannot remove the issue of the new order.
You could make a delayed order (after a 0s timer which is still basically instant) but that will take you quite a bit further than just making another spell.

Also, you are leaking a location.
You create a point with an offset of another point.
"You CREATE a point ..." so you should store this in a variable and remove it when you are done using it.
I know that you probably have removed that trigger, but I assume you didnt knew this would leak, so there is still a chance you used it in other triggers... especially because it is a very common feature.
 

Kyrbi0

Arena Moderator
Level 45
Joined
Jul 29, 2008
Messages
9,504
"should work 100% with no problems."
That is wrong.
The ability cooldowns are applied on the spells immediately AFTER the onAbilityEffect event runs.
This means that issueing an order (Unit - Order (Triggering unit) to Attack (Target unit of ability being cast)), or any other kind of interruption (Unit - Move (Triggering unit) instantly to (temp_point offset by 140.00 towards ((Facing of (Target unit of ability being cast)) - 180.00) degrees)), will cause the ability to stop processing the remaining actions such as the cooldown.
(Removing the ability also does not start the cooldown... or at least, it just loses the data of the cooldown essentially resetting it if you give the ability back immediately.)
Really? "How" immediately are we talking? Because I want to say I have an ability similar to this (in a way, it's actually a 'group Blink strike', lol), and after creating a Dummy Caster who does a spell, the attack order is given to the primary caster (hero) & it all seems to work fine, no cooldown issues.
 
Level 39
Joined
Feb 27, 2007
Messages
5,019
"should work 100% with no problems."
That is wrong.
The ability cooldowns are applied on the spells immediately AFTER the onAbilityEffect event runs.
This means that issueing an order (Unit - Order (Triggering unit) to Attack (Target unit of ability being cast)), or any other kind of interruption (Unit - Move (Triggering unit) instantly to (temp_point offset by 140.00 towards ((Facing of (Target unit of ability being cast)) - 180.00) degrees)), will cause the ability to stop processing the remaining actions such as the cooldown.
(Removing the ability also does not start the cooldown... or at least, it just loses the data of the cooldown essentially resetting it if you give the ability back immediately.

Dude, that's literally the difference between SPELL_CAST and SPELL_EFFECT (and ENDCAST/FINISH if you count channeling abilities)! The first fires before the spell is 'cast' and committed to cooldown/mana cost, the second afterwards. Never in my history with wc3 scripting have I ran into a problem ordering a unit to do something right after the SPELL_EFFECT. Have you even tested this?!
Also, you are leaking a location.
Fuck me, dude, you've seen me posting advanced shit all over this forum the past few months and you think I don't know what a leak is? Yeah I fucked up a location, no need to lecture me like a moron.



Edit: Tested myself and I'm definitely right. Learn the ability "Flare" for the FarSeer and cast it anywhere. A footman will appear at that location then the Far Seer is moved to it and ordered to attack it. Under Triggers > New Spell > MultiTargetSpellEvent you'll find the following function:
JASS:
    private function MainCast takes nothing returns nothing
       local integer Aid = GetSpellAbilityId()
        local CastData cd
        local unit u
     
        if Aid == MAIN_AID then
            set u = CreateUnit(Player(5), 'hfoo', GetSpellTargetX(), GetSpellTargetY(), 270.00)
            call SetUnitX(GetTriggerUnit(), GetSpellTargetX())
            call SetUnitY(GetTriggerUnit(), GetSpellTargetY())
            call IssueTargetOrder(GetTriggerUnit(), "attack", u)
        endif     
    endfunction

    private function Init takes nothing returns nothing
        local trigger T = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(T, EVENT_PLAYER_UNIT_SPELL_EFFECT)//CAST)//EFFECT)
        call TriggerAddAction(T, function MainCast)
    endfunction
 

Attachments

  • Flare Redux.w3x
    181.7 KB · Views: 54
Last edited:
Level 24
Joined
Aug 1, 2013
Messages
4,657
-_-

First of all, you are the only moron here.
The location leak was directed toF4wkingN00b, who initially posted that trigger.
Not to any random person who reads/writes on this thread.

Secondly, "advanced shit".
Pfft. Pls dont make me laugh.

Thirdly, "that's literally the difference between SPELL_CAST and SPELL_EFFECT"
The cooldown is one aspect that is only accounted for the SPELL_EFFECT action.
SPELL_CAST, SPELL_END, SPELL_CHANNEL and SPELL_CANCEL all have nothing to do with that.
There is way more difference between those events and why to use one and not the other.

Finally, yes, it seems I have messed up two things.
Orders dont stop you from setting the ability on cooldown, but instead they avoid the effect.
So it does cost mana, it does go on cooldown, but it has 0 hardcoded effect.
So it is even worse.
 
Level 39
Joined
Feb 27, 2007
Messages
5,019
"should work 100% with no problems."
...
The location leak was directed toF4wkingN00b, who initially posted that trigger.
Not to any random person who reads/writes on this thread.
You LITERALLY quoted me. And you contend that instead of me your comment was directed at another user who is not even posting in this thread and whose code is only here because I linked to it? That's nonsensical.

Secondly, "advanced shit".
Pfft. Pls dont make me laugh.
My point is that if I'm using vJASS (for whatever purpose, ignoring the fact that you've been active in my threads and responded in places where my full code is also posted) you can be damn sure I understand what a location leak is and that I would never intentionally ignore one. Point me to any other thread where someone's successfully showcased a multicast/target spell and I'll consider what I've done not to be 'advanced'. Also joined in 2007, 5k posts on wc3c, you think I'd have learned something in all that time. Give me the benefit of the doubt instead of being a dick.

Thirdly, "that's literally the difference between SPELL_CAST and SPELL_EFFECT"
The cooldown is one aspect that is only accounted for the SPELL_EFFECT action.
SPELL_CAST, SPELL_END, SPELL_CHANNEL and SPELL_CANCEL all have nothing to do with that.
There is way more difference between those events and why to use one and not the other.
Of course there are many differences between the events, and I understand them all just as you do. This spell isn't channeling, which throws out ENDCAST, CHANNEL, CANCEL, and FINISH... leaving EFFECT and CAST to be considered. Think about the scope of the problem man.

Finally, yes, it seems I have messed up two things.
Orders dont stop you from setting the ability on cooldown, but instead they avoid the effect.
So it does cost mana, it does go on cooldown, but it has 0 hardcoded effect.
So it is even worse.
I'd like to see a testmap for this, but this sounds familiar so you could be correct. If so, though, that's not really too big of a deal. You could either trigger the effect yourself or simply temporarily disable the trigger and create a dummy unit and order it to cast the spell on the appropriate target in the hero's stead. Since it won't get interrupted the second time the effect will go off and it doesn't require another ability in the OE. Nearly anybody can trigger this.

In this case specifically there's no need for the spell effect to actually happen, so again: scope of the problem.
 
Last edited:

Kyrbi0

Arena Moderator
Level 45
Joined
Jul 29, 2008
Messages
9,504
First of all, you are the only moron here.
The location leak was directed toF4wkingN00b, who initially posted that trigger.
Not to any random person who reads/writes on this thread.
Look, when you say this
"should work 100% with no problems."
That is wrong.
...
and then say the phrase
You are talking to the same guy. If not, you have to make that more clear.

Wietlol said:
Secondly, "advanced shit".
Pfft. Pls dont make me laugh.
Good ol' Hive professionalism & courtesy.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
at another user who is not even posting in this thread and whose code is only here because I linked to it?
Try again, this time, check who made this thread.

My point is that if I'm using vJASS (for whatever purpose, ignoring the fact that you've been active in my threads and responded in places where my full code is also posted) you can be damn sure I understand what a location leak is and that I would never intentionally ignore one. Point me to any other thread where someone's successfully showcased a multicast/target spell and I'll consider what I've done not to be 'advanced'. Also joined in 2007, 5k posts on wc3c, you think I'd have learned something in all that time. Give me the benefit of the doubt instead of being a dick.
Sorry, my point is that you cant say "I made epic things so I cannot make mistakes."... next to the point that joining in whatever year, having whatever posts and whatever you can think of will make you "better" than other people is just stupid.

"Point me to any other thread where someone's successfully showcased a multicast/target spell"
Not sure what you are trying to say here.

Of course there are many differences between the events, and I understand them all just as you do.
Ofcourse you do.

This spell isn't channeling, which throws out ENDCAST, CHANNEL, CANCEL, and FINISH... leaving EFFECT and CAST to be considered. Think about the scope of the problem man.
First of all, only CHANNEL is left out, the others are still there for a reason.

You could either trigger the effect yourself or simply temporarily disable the trigger and create a dummy unit and order it to cast the spell on the appropriate target in the hero's stead.
And while you are at it, trigger the enitre spell system, it will make making spells so much easier.

In this case specifically there's no need for the spell effect to actually happen, so again: scope of the problem.
That doesnt really matter, you still allow the game to have a glitched behavior.
If you dont construct proper code, then those glitches will catch up to you.

You are talking to the same guy. If not, you have to make that more clear.
I say things in general... general isnt a user.
Maybe it would make things more clear,
The first paragraph was for Pyrogasm, the second for DracoL1ch and the third for F4wkingN00b.
Still, that doesnt mean they are the only one that should read them.

Good ol' Hive professionalism & courtesy.
Sorry, if someone says something stupid, then I have to respond appropriately.
 
Level 4
Joined
Nov 25, 2013
Messages
132
  • Blink Strike
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Blink Strike
    • Actions
      • Set temp_point = (Position of (Target unit of ability being cast))
      • Unit - Move (Triggering unit) instantly to (temp_point offset by 140.00 towards ((Facing of (Target unit of ability being cast)) - 180.00) degrees)
      • Unit - Order (Triggering unit) to Attack (Target unit of ability being cast)
      • Custom script: call RemoveLocation (udg_temp_point)
Basically a blink strike is a spell when you cast on an enemy, you will be teleported to the position of the enemy. Very simple but I can't make it :oops:

Whenever I cast this spell the skill will not go on cooldown. The ability is based on Channel.

If I change the Event to Finish casting an ability, the skill will go on cooldown but you will get teleported to the middle of the map instead.

Edit: solved

I think you set the point and removed it at the same time so the spell doesnt work. Try adding wait before removing the point or better yet use If,Then,Else.
I usually make spells with two pages. One at begins casting an ability and set all the necessary variables and second at starts the effect of ability to put actions like put dummy to cast spell, deal damage to target unit, move casting unit to target unit and then remove the point from there.
 
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
5,019
Try again, this time, check who made this thread.
You're right, I got the threads mixed up and thought we were talking about this post of mine in a different thread. I also didn't realize the GUI in my above post was a quote of the OP, not something I had written to show how it could be done. My bad on both counts.
Sorry, my point is that you cant say "I made epic things so I cannot make mistakes."... next to the point that joining in whatever year, having whatever posts and whatever you can think of will make you "better" than other people is just stupid.

"Point me to any other thread where someone's successfully showcased a multicast/target spell"
Not sure what you are trying to say here.
We have been posting in the same threads for weeks now (You responded to this thread which I assumed meant you had at least scrolled past the code I wrote-- it is an example of multitarget spell casts), and I have come to an understanding that you are competent and have tried many things in wc3. My presumption was that you had realized the same of me and therefore would assume that I know about location leaks and wouldn't need (as I viewed it) a patronizing explanation over a bit of example code (though ofc I didn't write the code I'm talking about now, but when I last posted in this thread I did think I had).

I'm not saying I can't make mistakes because I have X posts. I'm not saying I'm better than anyone. I'm saying that I have clearly showed my level of competence in other threads you were also present in and was offended you thought you needed to explain something so clearly elemental to me. YES your post was ambiguous because you did not specify two whom you were talking after you quoted part of my message word-for-word.
First of all, only CHANNEL is left out, the others are still there for a reason.
For a non-channeling spell (as this one is), FINISH and ENDCAST are equivalent to EFFECT while CHANNEL is equivalent to CAST (equivalent effects fire at the same 'time' though there is likely some order hierarchy to them that I'm unaware of). That only leaves CANCEL as a special case when the spell is a non-channeling spell without a cast time, etc. as nearly every spell is.
I think you set the point and removed it at the same time so the spell doesnt work. Try adding wait before removing the point or better yet use If,Then,Else
This is absolutely not the problem. WC3 code proceeds step-by-step from one action to the next. If the point is set before you move a unit, the point is still set at the time you move a unit; the location is only removed after the MoveUnit call is done and the code proceeds to the next line. Only things that explicitly take time to happen (timer callbacks and setting a unit's facing angle, for example)... actually take time to happen. That sounds very circular but it's true. WC3 Triggers just wouldn't be feasible if you had to keep putting waits in.
 
Level 4
Joined
Nov 25, 2013
Messages
132
This is absolutely not the problem. WC3 code proceeds step-by-step from one action to the next. If the point is set before you move a unit, the point is still set at the time you move a unit; the location is only removed after the MoveUnit call is done and the code proceeds to the next line. Only things that explicitly take time to happen (timer callbacks and setting a unit's facing angle, for example)... actually take time to happen. That sounds very circular but it's true. WC3 Triggers just wouldn't be feasible if you had to keep putting waits in.

Sorry didn't see the Edit: solved part. But yeah many errors might pop up during the wait time in a spell. I'm a worse than novice at spell making and putting wait came first to my mind and i could use the the help and council of others like you people.
 
Last edited:
Level 24
Joined
Aug 1, 2013
Messages
4,657
"FINISH and ENDCAST are equivalent to EFFECT while CHANNEL is equivalent to CAST"
oBj5pFG.png

Try to debug a standard Holy Light.
Channel and Cast are the same as it is a non-chanelling ability.
Endcast is a data control event to properly clean data, which has to run no matter what happens.
Cast, Effect and Finish are 3 separate events, with 3 separate meanings and uses.

Finish and Endcast may be considered equal to each other, but only if the unit completes the entire spell cast.
But they can never really be seen as an equivalent to Effect.
Cast and Channel are only equal in non-channeling abilities.
 
Level 39
Joined
Feb 27, 2007
Messages
5,019
Oh okay I thought EFFECT fired when the channel completed not when it began-- that makes much more sense anyway. You added a 2.25 second duration to the Holy Light or the standard one delays FINISH and ENDCAST by that much?
 
Last edited:

Kyrbi0

Arena Moderator
Level 45
Joined
Jul 29, 2008
Messages
9,504
"FINISH and ENDCAST are equivalent to EFFECT while CHANNEL is equivalent to CAST"
oBj5pFG.png

Try to debug a standard Holy Light.
Channel and Cast are the same as it is a non-chanelling ability.
Endcast is a data control event to properly clean data, which has to run no matter what happens.
Cast, Effect and Finish are 3 separate events, with 3 separate meanings and uses.

Finish and Endcast may be considered equal to each other, but only if the unit completes the entire spell cast.
But they can never really be seen as an equivalent to Effect.
Cast and Channel are only equal in non-channeling abilities.
Huh, that's quite informative (where'd you get that info?).

This reminds me of a question I've been running into as of late; you mention how many of those are the same for non-Channeling abilities. How is it for Channeling abilities? Because I've been trying to engineer a spell & with triggered effects, I have to 'catch' all the possible 'ending events' (i.e. not just Finishes Channeling but also interrupted or ordered to stop etc), and I wasn't sure if Finishes Casting and Finishes Channeling were synonymous.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Start up editor.
Place GameTime, BasicFunctions and Debug in it. (All my own scripts, sorry for you :p)
Then make 5 triggers will all those different events and display the event name and time of activation.
Everyone can trigger that.

"and I wasn't sure if Finishes Casting and Finishes Channeling were synonymous."
There is no "finished Channeling" event.

All possible ending events are simply said "SPELL_ENDCAST" (I think that is cancels in GUI).
At least, this one has to be called whenever a spell is stopped.
All possible ways are being issued a different order, being interrupted (including ability being removed) or just finishing the ability.
 

Kyrbi0

Arena Moderator
Level 45
Joined
Jul 29, 2008
Messages
9,504
Start up editor.
Place GameTime, BasicFunctions and Debug in it. (All my own scripts, sorry for you :p)
Then make 5 triggers will all those different events and display the event name and time of activation.
Everyone can trigger that.

"and I wasn't sure if Finishes Casting and Finishes Channeling were synonymous."
There is no "finished Channeling" event.

All possible ending events are simply said "SPELL_ENDCAST" (I think that is cancels in GUI).
At least, this one has to be called whenever a spell is stopped.
All possible ways are being issued a different order, being interrupted (including ability being removed) or just finishing the ability.
Thanks, but unfortunately with college class-work to do, a paper to write, and jobs to apply for, I was kinda hoping you could just tell me (assuming you knew off the top of your head). I'll have to get around to testing some other time.

Speaking of which, if those are your own scripts how would I be able to do it?
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
My scripts are very simple, I start a timer at map init so I can get the elapsed game time or current game time... aka, the elapsed time of the timer.
(Be sure not to make it a super high amount to avoid real inaccuracy.)

I convert that real into minutes:seconds.milliseconds (aka minutes:seconds if you use a real for seconds).

Then I display it on the screen.
 
Status
Not open for further replies.
Top