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

[Trigger] finishes casting an ability Vs. starts the effect of an ability

Status
Not open for further replies.
Level 21
Joined
Mar 29, 2020
Messages
1,237
hey there,

the following trigger is supposed to make unit A cast a storm bolt based spell, and instantly remove unit A and move unit B to the point of the target of the ability.
when I have the "event" as "starts the effect" - all of the actions occur, but unit A never completes casting the spell. when I have the event "finishes casting", everything works except for moving unit B. unit B stays in it's previous location.

before I go and retrigger things to work around this (dummy caster etc') is there some easy fix? did I miss something simple?

  • profile storm bolt
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • ((Triggering unit) is in CritterGroup) Equal to True
      • (Ability being cast) Equal to Shocking Reveal
    • Actions
      • Set TempPoint = (Position of (Target unit of ability being cast))
      • Set TempUnit = (Triggering unit)
      • Set CV = (Custom value of TempUnit)
      • Unit - Move ProfileCaster[CV] instantly to TempPoint, facing (Facing of TempUnit) degrees
      • Animation - Change ProfileCaster[CV]'s size to (100.00%, 100.00%, 100.00%) of its original size
      • Unit - Unpause ProfileCaster[CV]
      • Unit - Make ProfileCaster[CV] Vulnerable
      • Unit Group - Remove ProfileCaster[CV] from ProfileHero
      • Unit - Remove TempUnit from the game
      • Special Effect - Create a special effect at TempPoint using Abilities\Spells\Human\Polymorph\PolyMorphTarget.mdl
      • Custom script: call RemoveLocation (udg_TempPoint)
thanks!!!
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,570
Begins casting/Starts the effect/Begins channeling: These all allow you to reference Target unit of ability being cast and Target point of ability being cast.

Finishes casting/Stops casting: At this stage you no longer have reference to that information.

One of many solutions:

Using the Unit Indexer save the Target unit of ability being cast and Target point of ability being cast in a Starts the effect of an ability trigger.
Then reference these variables in a Finishes casting an ability trigger.
Example:
  • Start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set Variable CV = (Custom value of (Triggering unit))
      • Set Variable TargetUnit[CV] = (Target unit of ability being cast)
      • Set Variable TargetPoint[CV] = (Target point of ability being cast)
  • Finish
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
    • Actions
      • Set Variable CV = (Custom value of (Triggering unit))
      • Unit - Kill TargetUnit[CV]
      • Special Effect - Create a special effect at TargetPoint[CV] using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation (udg_TargetPoint[udg_CV])
In your case you don't need TargetPoint[CV] since your spell targets a Unit but I figured I'd show that as well.
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
I found a small bug with this - If the ability gets interrupted, then only the first half of the trigger (the part that is started by the "starts casting") happens, which isn't great for me. so when a hero turns invul while the storm bolt is coming towards them that causes problems for my trigger.

is there a way to detect if the spell was completed to set up a failsafe?
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,570
I'm confused. What's the problem then? How is the ability NOT finishing casting? Starts the effect/Finishes casting will only go off if the cast is successful. And to clarify, successful as in the effects of the ability are executed (storm bolt is released/mana is spent/spell goes on cd/etc...).

And I'm not sure what you mean about checking if a certain trigger has fired. You can check the Execution Count of a Trigger (It's an Integer value), if it's > 0 then you know it's happened, but why would you need to do this?
 
Last edited:
Level 21
Joined
Mar 29, 2020
Messages
1,237
I'll backtrack - everything was working just fine, but I noticed that on one cast of my my ability the second trigger didn't fire. unit B (referring to my original post here) stayed where it was and didn't appear at the location of the target. I deduced that this was bc the target turned invisible as the storm bolt was coming towards it, and so the trigger that's event is "finishes casting" never ran.

what I want - even when the storm bolt doesn't hit the target - everything else in the second trigger should still happen.

  • Fake profile P1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fake Profile
    • Actions
      • Set TempPoint = (Position of (Triggering unit))
      • Unit - Create 1 dummywinventory for (Triggering player) at TempPoint facing Default building facing degrees
      • Set TempUnit = (Last created unit)
      • Set ID = (Custom value of (Last created unit))
      • Set TempUnitArray[ID] = (Triggering unit)
      • Item - Create Mechanical Critter at TempPoint
      • Hero - Give (Last created item) to TempUnit
      • Hero - Order TempUnit to use (Last created item)
      • Animation - Change (Triggering unit)'s size to (0.01%, 0.01%, 0.01%) of its original size
      • Unit - Pause (Triggering unit)
      • Unit - Make (Triggering unit) Invulnerable
      • Unit - Turn collision for (Triggering unit) Off
      • Unit - Move (Triggering unit) instantly to (Center of Fountain <gen>), facing (Facing of TempUnit) degrees
      • Unit Group - Add (Triggering unit) to ProfileHero
      • Unit - Set Unit: (Triggering unit)'s Boolean Field: Hero - Hide Hero Minimap Display ('uhhm') to Value: True
      • Custom script: call RemoveLocation (udg_TempPoint)
  • FP part2
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoning unit)) Equal to dummywinventory
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Summoned unit)) Equal to Damsel
          • (Unit-type of (Summoned unit)) Equal to Mademoiselle
          • (Unit-type of (Summoned unit)) Equal to Maiden
          • (Unit-type of (Summoned unit)) Equal to Woman
          • (Unit-type of (Summoned unit)) Equal to Foxy Lady
          • (Unit-type of (Summoned unit)) Equal to Lass
    • Actions
      • Unit Group - Add (Summoned unit) to CritterGroup
      • Set CV = (Custom value of (Summoned unit))
      • Set ProfileCaster[CV] = TempUnitArray[ID]
      • Unit - Add Log out to (Summoned unit)
      • Unit - Add Suspicious Behaviour to (Summoned unit)
      • Unit - Add Shocking Revelation to (Summoned unit)
      • Unit - Set level of Shocking Revelation for (Summoned unit) to (Level of Fake Profile for ProfileCaster[ID])
      • Set SightRadius = (Unit: ProfileCaster[CV]'s Real Field: Sight Radius ('usir'))
      • Unit - Set Unit: (Summoned unit)'s Real Field: Sight Radius ('usir') to Value: SightRadius
      • Unit - Set Unit: ProfileCaster[CV]'s Real Field: Sight Radius ('usir') to Value: 100.00
      • Unit - Remove (Summoning unit) from the game
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (ProfileCaster[CV] is selected by (Owner of ProfileCaster[CV])) Equal to True
        • Then - Actions
          • Selection - Select (Summoned unit) for (Triggering player)
        • Else - Actions
  • profile storm bolt start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • ((Triggering unit) is in CritterGroup) Equal to True
      • (Ability being cast) Equal to Shocking Revelation
    • Actions
      • Set TempUnit = (Triggering unit)
      • Set CV = (Custom value of TempUnit)
      • Set ProfileTarget[CV] = (Target unit of ability being cast)
      • Unit - Set Unit: ProfileCaster[CV]'s Real Field: Sight Radius ('usir') to Value: 300.00
      • Set TempPoint = (Position of TempUnit)
      • Set TempPoint1 = (Position of ProfileTarget[CV])
      • Unit - Make TempUnit face TempPoint1 over 0.00 seconds
      • Animation - Change TempUnit's size to (0.01%, 0.01%, 0.01%) of its original size
      • Special Effect - Create a special effect at TempPoint using Abilities\Spells\Human\Polymorph\PolyMorphDoneGround.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation (udg_TempPoint)
      • Custom script: call RemoveLocation (udg_TempPoint1)
  • profile storm bolt end
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • ((Triggering unit) is in CritterGroup) Equal to True
      • (Ability being cast) Equal to Shocking Revelation
    • Actions
      • Set TempUnit = (Triggering unit)
      • Set CV = (Custom value of TempUnit)
      • Set TempPoint = (Position of ProfileTarget[CV])
      • Set TempPoint1 = (Position of TempUnit)
      • Set Temp_Point2 = (TempPoint offset by 40.00 towards (Angle from TempPoint to TempPoint1) degrees)
      • Unit - Move ProfileCaster[CV] instantly to Temp_Point2, facing (Facing of TempUnit) degrees
      • Animation - Change ProfileCaster[CV]'s size to (100.00%, 100.00%, 100.00%) of its original size
      • Unit - Unpause ProfileCaster[CV]
      • Unit - Make ProfileCaster[CV] Vulnerable
      • Unit - Turn collision for ProfileCaster[CV] On
      • Unit Group - Remove ProfileCaster[CV] from ProfileHero
      • Unit - Set Unit: ProfileCaster[CV]'s Boolean Field: Hero - Hide Hero Minimap Display ('uhhm') to Value: False
      • Unit - Set Unit: ProfileCaster[CV]'s Real Field: Sight Radius ('usir') to Value: SightRadius
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (TempUnit is selected by (Owner of TempUnit)) Equal to True
        • Then - Actions
          • Selection - Select ProfileCaster[CV] for (Owner of TempUnit)
        • Else - Actions
      • Unit - Remove TempUnit from the game
      • Custom script: call RemoveLocation (udg_TempPoint)
      • Custom script: call RemoveLocation (udg_TempPoint1)
      • Custom script: call RemoveLocation (udg_Temp_Point2)
ok I lied this isn't the whole spell, just whats relevant. kudos if you understand this mess. also I know the first one is leaking a point...

the last two triggers are the main focus of this post, the first 2 are just to understand the setup..
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,570
Edit:
Pausing/Moving/Interrupting a unit in any way during the Starts the effect Event will cause problems.

Put the Pause/Move Actions in the Finishes Casting Event.

But i'd recommend never using Pauses outside of things like cinematics and character selection when the players aren't casting spells. Unless you're positive that it won't cause problems.
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
Pausing/Moving/Interrupting a unit in any way during the Starts the effect Event will cause problems
it didn't... my problem only occurred on one specific occasion but in general it ran smoothly like this. the unit being paused and moved is not the caster.

the pausing of the unit is instead of hiding it which stopped it from being selectable. is there another way to get the unit to not move or attack anything? and what are the downsides of pausing it besides loosing buffs (which doesn't really matter here)?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,570
You can always Stun the unit with a Dummy.

Anyway, I would create text messages for each Trigger and try to recreate the problem. If the trigger that's supposed to Move the Unit goes off (so the text message is displayed) but the unit doesn't move, then we know this is because of an issue with the Variables. Most likely ProfileTarget[CV] isn't set or CV got mixed up along the way.

But rest assured it has absolutely nothing to do with Storm Bolt failing to hit it's target as these Events don't check for that, they simply check if an Ability effects are initiated (it doesn't care if they fail/succeed to hit their target).

And I noticed that you're referencing ID in FP part2 without setting it. This could cause problems as ID could change to something else in the time between these Events going off.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,570
I see what you mean, I'm not entirely sure if there's a slight delay or not. To be safe, you could order TempUnit to use the Mechanical Critter at the very end of the trigger that way if they are done in conjunction they won't interfere with one another. Then set ID again in the Summoned Trigger.

Note that you can use the action Create Item For Hero instead of creating an Item at a Point and then giving it to a Unit. And I know it says "For HERO" but you can create it for any type of Unit.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,570
That leads me to believe that the variables are getting changed in what could be a very brief moment between the triggers going off.

Maybe that one time the bug happened you had something else trigger that used one or more of the same variables.
 
Status
Not open for further replies.
Top