• 🏆 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!

Target location unit finishes casting

Status
Not open for further replies.
Level 7
Joined
Nov 19, 2015
Messages
283
I'm using the event unit finishes casting a spell. The problem is that there is no target point of the ability and my spell just shoots towards the center of the map.

I base my ability of channel and give it a short follow through time. This allows enemy units with bash and stuns to cancel the spell while they are casting it. Welcome to better methods. I'm not a fan of the casting time since you can't cancel it yourself if you want to since some spell have huge casting times.
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
Use the "Unit - A unit Starts the effect of an ability" event and make the follow through time the actual cast time. Then use a loop that keeps track of the duration of the cast time, and unless it reaches the full follow through time, then you can put necessary actions. This will obviously will have to be MUI, so I will show you how I would do it.

I want my cast time to be 3 seconds. So I make the follow through time 3 seconds and do this:
  • Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • Set Index = (Index + 1)
      • Set Counter[Index] = 0.00
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Index Equal to 1
        • Then - Actions
          • Trigger - Turn on Loop <gen>
        • Else - Actions

  • Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Loop_Int) from 1 to Index, do (Actions)
        • Loop - Actions
          • Set Counter[Loop_Int] = (Counter[Loop_Int] + 0.03)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Counter[Loop_Int] Greater than or equal to 3.00
            • Then - Actions
              • -------- spell actions --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • -------- are spell actions over? --------
                • Then - Actions
                  • -------- deindex --------
                  • Set Counter[Loop_Int] = Counter[Index]
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Index Equal to 0
                    • Then - Actions
                      • Trigger - Turn off Loop <gen>
                    • Else - Actions
                • Else - Actions
            • Else - Actions
 
Level 7
Joined
Nov 19, 2015
Messages
283
At least show us a trigger... because that is the thing where it goes wrong.
Maybe also provide a screenshot of the Object Editor.

Its a simple

Unit finishes casting an ability

Set Temp_Loc = target point of ability being cast
Create SFX at Temp_Loc
Game display X,Y of Temp_Loc to player

Always 0.000 & 0,000
At the centre of the map

I don't think I want to make a loop every time a unit casts a spell. Is there no fix for unit finishes casting? If I can't find a fix, I may just use the index thingy or just stick with the basic cast time.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
I am about 99% certain that you dont want to use the Finishes Casting an ability as event in the first place...

But yea, you could store the last cast location in a hashtable...
Or you could ask Bribe why his spell system doesnt have features that make this even better possible... (assuming it doesnt have them based on that he didnt mention it.)
 
Status
Not open for further replies.
Top