• 🏆 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] Acquiring Target for Channel-based Ability

Status
Not open for further replies.
Level 3
Joined
Nov 18, 2015
Messages
41
Somewhere somehow I've got some issues. The trigger will run through, however the problem I'm having is that it won't pick up the unit type of the target unit.

36f2ad4ebe3c4091a55deee6332b2956.png


  • HS Select
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Hero Select
    • Actions
      • Set tempP = (Owner of (Casting unit))
      • Player Group - Add tempP to tempPGroup
      • Set tempInt = (Player number of tempP)
      • Set tempLoc = (Random point in hr rev1 <gen>)
      • Unit - Explode (Casting unit)
      • Unit - Create 1 (Unit-type of (Target unit of ability being cast)) for tempP at tempLoc facing 270.00 degrees
      • Set p_hero[tempInt] = (Last created unit)
      • Selection - Select (Last created unit) for tempP
      • Cinematic - Clear the screen of text messages for tempPGroup
      • Game - Display to tempPGroup for 12.00 seconds the text: (You've selected the |cffffcc00 + ((String((Unit-type of (Target unit of ability being cast)))) + |r. To repick re-enter the selection area.))
      • Camera - Pan camera for tempP to tempLoc over 0.00 seconds
      • Special Effect - Create a special effect at tempLoc using Abilities\Spells\Other\Awaken\Awaken.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set hr_reviveLoc[tempInt] = tempLoc
      • Custom script: call RemoveLocation(udg_tempLoc)
      • Custom script: call DestroyForce(udg_tempPGroup)
 
Level 3
Joined
Nov 18, 2015
Messages
41
Well I fiddled around for about an hour and came up with a solution. It seems the explode function was essentially removing any "targets" that the unit had before death.

For those curious, I relocated where I call the function, and used this trigger...
  • HS SetTarget
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Hero Select
    • Actions
      • Set tempP = (Owner of (Casting unit))
      • Set tempInt = (Player number of tempP)
      • Set hs_targetHero[tempInt] = (Target unit of ability being cast)
...to solve my issue with using this event...
  • Unit - A unit Finishes casting an ability
...Eventually coming up with this.
  • HS Select
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Hero Select
    • Actions
      • Set tempP = (Owner of (Casting unit))
      • Player Group - Add tempP to tempPGroup
      • Set tempInt = (Player number of tempP)
      • Set tempLoc = (Random point in hr rev1 <gen>)
      • Unit - Create 1 (Unit-type of hs_targetHero[tempInt]) for tempP at tempLoc facing 270.00 degrees
      • Set p_hero[tempInt] = (Last created unit)
      • Selection - Select p_hero[tempInt] for tempP
      • Cinematic - Clear the screen of text messages for tempPGroup
      • Game - Display to tempPGroup for 12.00 seconds the text: You've chosen your ...
      • Camera - Pan camera for tempP to tempLoc over 0.00 seconds
      • Special Effect - Create a special effect at tempLoc using Abilities\Spells\Other\Awaken\Awaken.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set hr_reviveLoc[tempInt] = tempLoc
      • Unit - Remove (Casting unit) from the game
      • For each (Integer tempInt) from 1 to 8, do (Actions)
        • Loop - Actions
          • Player - Make tempP treat (Player(tempInt)) as an Ally with shared vision
      • Custom script: call RemoveLocation(udg_tempLoc)
      • Player Group - Pick every player in tempPGroup and do (Player Group - Remove (Picked player) from tempPGroup)
 
Level 3
Joined
Nov 18, 2015
Messages
41
IIrc, Target Unit of ability being cast doesnt work on "A unit finishes casting an ability".
That event is also not meant to be used as spell effect event.
You should only use "A unit starts the effect of an ability".
Well the problem with using that is it cuts my ability short. It will go ahead and run the trigger before the ability is finished channeling and I do other things while it's channeling.
I just went ahead and used an event for when the ability is started and carried over the initial target in to my trigger so I can reference it at will.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
But it has already gone on cooldown and it already took the mana cost.
The channeling part should happen between the casting and the effect.
If you mess up the channeling part, fix it instead of accepting it is not how it should be and mess it up even more.
 
Level 3
Joined
Nov 18, 2015
Messages
41
But it has already gone on cooldown and it already took the mana cost.
The channeling part should happen between the casting and the effect.
If you mess up the channeling part, fix it instead of accepting it is not how it should be and mess it up even more.

My ability is a little different and I don't rely on mana cost or cooldown for the function of the ability. I'm basing my ability off of the channel ability which has these options. The art is also a feature of the ability and not triggered, as there is absolutely no need to trigger any of the special effects for channeling. However if you use a trigger to begin something with that event then you bypass the channeling effect entirely ending the ability instead of waiting for the channeling to be completed.

An easy way to picture this is something like life-drain. When the ability starts, you're draining life but it will continue for X amount of seconds. However using that event, instead of waiting for it to finish, you'll cut it short and immediately begin the effect of your triggering.
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
However using that event, instead of waiting for it to finish, you'll cut it short and immediately begin the effect of your triggering.
What...? How does triggering anything cut the channeling short (unless youre ordering the caster to do something). If you keep the follow through time the same as however long you want the periodic trigger to run, then nothing is interrupted.
 
Level 3
Joined
Nov 18, 2015
Messages
41
What...? How does triggering anything cut the channeling short (unless youre ordering the caster to do something). If you keep the follow through time the same as however long you want the periodic trigger to run, then nothing is interrupted.

Using the suggested event fires the trigger before the follow-through time is finished.
 
Level 3
Joined
Nov 18, 2015
Messages
41
The follow through time is the duration of the channel, not when the ability actually starts.
I assure you, the trigger will fire before the channeling follow through duration has finished, I've posted my triggers in the first and second posts you're welcome to test the theory, I just did it again to double check and make sure I wasn't going crazy. I had tried that event long before I made this post, and it wouldn't work as I wanted so I found another way to do it as I stated in the second post.
 
Status
Not open for further replies.
Top