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

Triggered Spell Not Working

Status
Not open for further replies.
Level 11
Joined
Jan 23, 2015
Messages
788
Hi, I have a problem with a triggered spell, here it is:

  • Blink Strike
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Blink Strike
    • Actions
      • Special Effect - Create a special effect at (Position of (Casting unit)) using Abilities\Spells\Undead\CarrionSwarm\CarrionSwarmDamage.mdl
      • Unit - Cause (Casting unit) to damage (Target unit of ability being cast), dealing 50.00 damage of attack type Hero and damage type Normal
      • Special Effect - Create a special effect at (Position of (Target unit of ability being cast)) using Abilities\Spells\Undead\CarrionSwarm\CarrionSwarmDamage.mdl
      • Unit - Move (Casting unit) instantly to (Position of (Target unit of ability being cast))
      • Animation - Play (Casting unit)'s standready animation
      • Floating Text - Create floating text that reads 50 at (Position of (Casting unit)) with Z offset 10.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
      • Floating Text - Set the velocity of (Last created floating text) to 30.00 towards 90.00 degrees
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
      • Floating Text - Change the age of (Last created floating text) to 5.00 seconds
      • Game - Display to (All players) the text: cast
      • Game - Display to (All players) the text: (Name of (Casting unit))
      • Game - Display to (All players) the text: (Name of (Target unit of ability being cast))
Everything works fine except for the floating text, animation and last debug message which shows the name of the targeted unit, to check if the trigger detects it.. but it actually does detect it, cause the caster jumps to the target and damages it.. -_-

edit: also, after the casting, the spell is still cooled down and no mana is reduced by it.. why?
 
Level 18
Joined
May 11, 2012
Messages
2,103
Create new variables
TempPoint
TempTrigUnit
TempUnit
TempPoint2
TempFloatingText

Change event into "A Unit Start The Effect of an ability"

then do this

Set TempTrigUnit = (Triggering unit)
Set TempUnit = (Target unit of ability being cast)
Set TempPoint = (Position of (TempTrigUnit))
Set TempPoint2 = (Position of (TempUnit))

After your create floating text, set it to a variable and refer to the variable.

then in your actions where you use position of casting unit refer to "TempPoint" variable, where you use (Casting Unit) refer to "TempTrigUnit" variable, where you refer to position of Casting unit refer to "TempPoint2" variable and where you refer to position of target unit refer to "TempPoint2" variable.

At the end of the trigger: put these 2 lines to remove leaks:
Custom Script: call RemoveLocation(udg_TempPoint)
Custom Script: call RemoveLocation(udg_TempPoint2)

Now when we settled that up, to the problem: animation is not displayed because you move the unit and also cooldown will be reseted probably because you are using Channel ability and have Disable Other Abilities Checked. Uncheck that. Moving units with this action resets animation.
Use this instead of your move action:
Custom Script: call SetUnitX(udg_TempTrigUnit, GetLocationX(udg_TempPoint)
Custom Script: call SetUnitY(udg_TempTrigUnit, GetLocationY(udg_TempPoint)

What is wrong with your floating text?
 
Last edited:
Level 21
Joined
Nov 4, 2013
Messages
2,017
Well of course your ability doesn't consume mana or go on cooldown. Whenever a unit/hero casts an ability (except Berserk, Fan of Knives and a few others), you notice that there is a half second delay before the ability actually goes on cooldown. When you use "Begins casting the ability", it means that just exactly when you finish clicking, the ability is cast instantaneously, leaving no time for the ability to go on cooldown or consume mana, that's why you should use "A Unit Start The Effect of an ability".
 
Level 11
Joined
Jan 23, 2015
Messages
788
Create new variables
TempPoint
TempTrigUnit
TempUnit
TempPoint2
TempFloatingText

Change event into "A Unit Start The Effect of an ability"

then do this

Set TempTrigUnit = (Triggering unit)
Set TempUnit = (Target unit of ability being cast)
Set TempPoint = (Position of (TempTrigUnit))
Set TempPoint2 = (Position of (TempUnit))

After your create floating text, set it to a variable and refer to the variable.

then in your actions where you use position of casting unit refer to "TempPoint" variable, where you use (Casting Unit) refer to "TempTrigUnit" variable, where you refer to position of Casting unit refer to "TempPoint2" variable and where you refer to position of target unit refer to "TempPoint2" variable.

At the end of the trigger: put these 2 lines to remove leaks:
Custom Script: call RemoveLocation(udg_TempPoint)
Custom Script: call RemoveLocation(udg_TempPoint2)

Now when we settled that up, to the problem: animation is not displayed because you move the unit and also cooldown will be reseted probably because you are using Channel ability and have Disable Other Abilities Checked. Uncheck that. Moving units with this action resets animation.
Use this instead of your move action:
Custom Script: call SetUnitX(udg_TempTrigUnit, GetLocationX(udg_TempPoint)
Custom Script: call SetUnitY(udg_TempTrigUnit, GetLocationY(udg_TempPoint)

What is wrong with your floating text?

Thanks mate, but you could simply say 'use variables' xD

edit: how do I use indexes in the script (i know how, but my index is a variable :/ ) ?

Well of course your ability doesn't consume mana or go on cooldown. Whenever a unit/hero casts an ability (except Berserk, Fan of Knives and a few others), you notice that there is a half second delay before the ability actually goes on cooldown. When you use "Begins casting the ability", it means that just exactly when you finish clicking, the ability is cast instantaneously, leaving no time for the ability to go on cooldown or consume mana, that's why you should use "A Unit Start The Effect of an ability".

This only works for mana, but there's still no cd
 
Level 18
Joined
May 11, 2012
Messages
2,103
Use this:
Custom script: call RemoveLocation(udg_TempPoint[udg_yourvariablenamehere])

Incase you're using A/B integers in loops (never use them), write the following to refer to the index:

For Integer A:
RemoveLocation(udg_TempPoint[GetForLoopAIndex()])
OR
RemoveLocation(udg_TempPoint[bj_ForLoopAIndex])

For Integer B:
RemoveLocation(udg_TempPoint[GetForLoopBIndex()])
OR
RemoveLocation(udg_TempPoint[bj_ForLoopBIndex])
 
Level 11
Joined
Jan 23, 2015
Messages
788
  • Blink Strike
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Blink Strike
    • Actions
      • Set TempBlStrCastOwnerNum = (Player number of (Owner of (Casting unit)))
      • Set TempBlStrCastUnit[TempBlStrCastOwnerNum] = (Casting unit)
      • Set TempBlStrTarget[TempBlStrCastOwnerNum] = (Target unit of ability being cast)
      • Set TempBlStrCastPos[TempBlStrCastOwnerNum] = (Position of (Casting unit))
      • Set TempBlStrTargetPos[TempBlStrCastOwnerNum] = (Position of (Target unit of ability being cast))
      • Special Effect - Create a special effect at TempBlStrCastPos[TempBlStrCastOwnerNum] using Abilities\Spells\Undead\CarrionSwarm\CarrionSwarmDamage.mdl
      • Unit - Cause TempBlStrCastUnit[TempBlStrCastOwnerNum] to damage TempBlStrTarget[TempBlStrCastOwnerNum], dealing 50.00 damage of attack type Hero and damage type Normal
      • Special Effect - Create a special effect at TempBlStrTargetPos[TempBlStrCastOwnerNum] using Abilities\Spells\Undead\CarrionSwarm\CarrionSwarmDamage.mdl
      • Custom script: call SetUnitX(udg_TempBlStrCastUnit[udg_TempBlStrCastOwnerNum], GetLocationX(udg_TempBlStrTargetPos[udg_TempBlStrCastOwnerNum] )
      • Custom script: call SetUnitY(udg_TempBlStrCastUnit[udg_TempBlStrCastOwnerNum], GetLocationY(udg_TempBlStrTargetPos[udg_TempBlStrCastOwnerNum] )
      • Wait 0.20 game-time seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (TempBlStrTarget[TempBlStrCastOwnerNum] is dead) Equal to True
        • Then - Actions
          • Animation - Play TempBlStrCastUnit[TempBlStrCastOwnerNum]'s standready animation
        • Else - Actions
 
Status
Not open for further replies.
Top