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

[Spell] adding spell animation before effect, progress bar

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

this should be super simple but I can't get it to work. I'm trying to make a spell thats like charm but on buildings, and only comes into effect and changes the ownership of the building after a minute of channeling. the ability itself was easy to setup based on charm, but i can't figure out how to get a channeling animation before the spell comes into effect. modifying fields in the object editor i could only get the animation going when the spell comes into effect, and I couldn't get it to work by triggering it with
Animation - Play (Triggering unit)'s (spell + channel) animation or any of the nearby options. It seems like it should be super simple.
also, if I'm raising the subject of this spell - how can i give it a progress bar so the caster can tell how close the spell is to completion?

thx!
 
Level 3
Joined
May 17, 2019
Messages
45
Hi,

Two methods, one easy, one harder.

The easier is to create a trigger with event Unit starts channeling an ability, using needed conditions, and use Animation - Play unit animation with desired animation.

The harder is to edit the model and add an animation named with Stand Channeling, with the animation you need.

Needless to say that the first method is what you are looking for.

PS: Use the model viewer on the left of the World Editor while your unit is selected to check all of its animations and their string names (use arrows).
 
Last edited:
Level 21
Joined
Mar 29, 2020
Messages
1,237
The easier is to create a trigger with event Unit starts channeling an ability, using needed conditions, and use Animation - Play unit animation with desired animation
I tried this, it didn't work. and i used the animation string from the sidebar. the model has a spell,channel animation, but for some reason it did not do anything. only stand animation.

maybe I'll have more success basing the ability off of channel.
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
Try this :

I couldn't open that...(apparently I'm using the wonderful retro - 1.20 and have heard i shouldn't update in the middle of making a map or I might bug it out)

I got it working by basing the ability off of channel - rigging the animation with "follow through time" in the OE and triggering the actual unit steal to start after "wait" the desired amount of time. but now I have a more complex problem to work around -

I'm trying to make the channeling time change according to the target unit type (ideally somehow relative to their build time but even just 50 sec for regular buildings and 100 for town hall type buildings is also fine).



ProgressBars v2.0.1
thanks! super useful and maybe I'll use this too, but what i meant was the kind of bar you see in the unit's info on the bottom panel like during a morph or for a summoned unit. is there a way to stick one of those on other spells?
 
Level 28
Joined
Feb 18, 2014
Messages
3,579
thanks! super useful and maybe I'll use this too, but what i meant was the kind of bar you see in the unit's info on the bottom panel like during a morph or for a summoned unit. is there a way to stick one of those on other spells?
Only if you trigger it. I'm using replace unit because there is no way to cancel an expiration timer.
  • Progress Bar
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Death and Decay
    • Actions
      • Set Integer = (Integer + 1)
      • Set Caster[Integer] = (Triggering unit)
      • Unit - Add a 10.00 second Generic expiration timer to Caster[Integer]
      • Unit Group - Add Caster[Integer] to CastingGroup
      • -------- If your spell has 10 seconds duration, change wait to 9.75 --------
      • Wait 9.75 seconds
      • Set Recycle = (Recycle + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Caster[Recycle] is in CastingGroup) Equal to TRUE
        • Then - Actions
          • Unit Group - Remove Caster[Recycle] from CastingGroup
          • Unit - Replace Caster[Recycle] with a (Unit-type of Caster[Recycle]) using Old unit's life and mana
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Recycle Equal to Integer
        • Then - Actions
          • Set Integer = 0
          • Set Recycle = 0
        • Else - Actions
  • Channel Interupt
    • Events
      • Unit - A unit Stops casting an ability
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Death and Decay
      • ((Triggering unit) is in CastingGroup) Equal to TRUE
    • Actions
      • Unit Group - Remove (Triggering unit) from CastingGroup
      • Unit - Replace (Triggering unit) with a (Unit-type of (Triggering unit)) using Old unit's life and mana
 

Attachments

  • Progress Bar.w3x
    17.9 KB · Views: 19
Level 28
Joined
Feb 18, 2014
Messages
3,579
does this save exp, items, name etc'?
I think not. You will have to set them manually.

Edit : Actually you don't need those integers, you can just do this :
  • Progress Bar
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Death and Decay
    • Actions
      • Unit Group - Add (Triggering unit) to Group
      • -------- If your spell duration is for example 10 seconds, then set expiration timer to "Current Duration + .50 " --------
      • Unit - Add a 10.50 second Generic expiration timer to (Triggering unit)
  • Finish or Cancel Channel
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to Death and Decay
      • ((Triggering unit) is A hero) Equal to TRUE
      • ((Triggering unit) is in Group) Equal to TRUE
    • Actions
      • Set Point = (Position of (Triggering unit))
      • Set Life = (Vie of (Triggering unit))
      • Set Mana = (Mana of (Triggering unit))
      • Unit - Kill (Triggering unit)
      • Hero - Instantly revive (Triggering unit) at Point, Hide revival graphics
      • Custom script: call RemoveLocation (udg_Point)
      • Unit - Set life of (Triggering unit) to Life
      • Unit - Set mana of (Triggering unit) to Mana
      • Unit Group - Remove (Triggering unit) from Group
      • If (((Triggering unit) is selected by (Owner of (Triggering unit))) Equal to TRUE) then do (Selection - Select (Triggering unit) for (Owner of (Triggering unit))) else do (Do nothing)
This should work just fine, the only issue is that all buffs the hero had before resurrection will be lost.
 
Last edited:
Level 21
Joined
Mar 29, 2020
Messages
1,237
[summary till here - trying to make a spell that is like charm but on buildings, that only comes into effect after X seconds of channeling - and when cast on town hall type structures channeling time is double. also has a progress bar over the unit being converted showing spell progress]

ok. so I looked at the different options and found out what I think looks best, and built it in a way where i understood what I was doing, now there's just a little functionality problem. background - the way I built the spell to differentiate between town hall and non town hall and cast accordingly was by making a second ability that is actually the one that gets cast on all the town hall types. I also made two types of dummy bar so I could simply set two different progress rates.

the problems I currently have are:

1. when I cast the spell on buildings that are not town hall type it only works sometimes. I haven't figured out what affects the success rate.

2. I can't figure out how to trigger the spell not working when it gets interrupted (as the effect happens after a "wait"). currently it changes ownership of the unit even if the caster walked away in the middle.

I'm attaching all of my related triggers bc maybe this will help figure out what I'm doing wrong:

  • New management regular
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to New Management
      • ((Target unit of ability being cast) is A town-hall-type unit) Equal to False
    • Actions
      • Set TempPoint = (Position of (Target unit of ability being cast))
      • Unit - Create 1 Progress Bar for (Triggering player) at TempPoint facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Wait 4.90 seconds
      • Unit - Change ownership of (Target unit of ability being cast) to (Owner of (Casting unit)) and Change color
      • Unit - Remove (Last created unit) from the game
  • New management townhall
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to New Management
      • ((Target unit of ability being cast) is A town-hall-type unit) Equal to True
    • Actions
      • Set TempPoint = (Position of (Target unit of ability being cast))
      • Set Temptarget = (Target unit of ability being cast)
      • Unit - Order (Triggering unit) to Stop
      • Wait 0.00 seconds
      • Unit - Order (Triggering unit) to Neutral Dark Ranger - Charm Temptarget
      • Unit - Create 1 Long Progress Bar for (Triggering player) at TempPoint facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Wait 9.90 seconds
      • Unit - Change ownership of Temptarget to (Triggering player) and Change color
      • Unit - Kill (Last created unit)
      • Unit - Remove (Last created unit) from the game
this one is to kill the progress bar when spell is interrupted:
  • Interrupt NM
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • ((Ability being cast) Equal to New Management ) or ((Ability being cast) Equal to New Management(townhall) )
    • Actions
      • Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) of type Long Progress Bar) and do (Actions)
        • Loop - Actions
          • Unit - Remove (Picked unit) from the game
      • Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) of type Progress Bar) and do (Actions)
        • Loop - Actions
          • Unit - Remove (Picked unit) from the game
this adds the hidden ability which is actually the one cast on great halls (this one's ID is charm, the regular one's ID is devour)
  • give hidden NMTH
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to New Management
    • Actions
      • Hero - Learn skill for (Triggering unit): New Management(townhall)
these set the respective dummy bar progress rates:

  • DummyBar
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Progress Bar
    • Actions
      • Animation - Change (Triggering unit)'s animation speed to 20.00% of its original speed
  • DummyBar
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Progress Bar
    • Actions
      • Animation - Change (Triggering unit)'s animation speed to 20.00% of its original speed

so to recap - A - why isn't the regular (non town hall) ability working consistantly, and B - how should I make the ability get interrupted? thanks!
 
Last edited:
Level 21
Joined
Mar 29, 2020
Messages
1,237
I got it to work - I solved problem #1 (see previous post) by making the spell duration 1 second longer. somehow that made it always work. I solved #2 by doing what @Warseeker suggested to do with the progress bar - detect whether the unit is casting or not by putting it in and taking it out of a unit group.

the only thing I'm still stuck in with this is that I can't figure out how to get a special effect to appear on the unit for the duration of the channeling. this is supposed to be the simplest part of the whole thing but I ust can't get it to work :con:. I tried altering all of the fields that look relevant in the OE but I can't get more than a 1 second effect. and i can't figure out how to trigger it.

help plz

thanks!
 
Level 28
Joined
Feb 18, 2014
Messages
3,579
I can't figure out how to get a special effect to appear on the unit for the duration of the channeling
You can trigger it.
  • Add Special Effect
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Death and Decay
    • Actions
      • Set Integer = (Integer + 1)
      • Unit - Set the custom value of (Triggering unit) to Integer
      • Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
      • Set SFX[Integer] = (Last created special effect)
  • Remove Special Effect
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to Death and Decay
      • (Custom value of (Triggering unit)) Greater than 0
    • Actions
      • Special Effect - Destroy SFX[(Custom value of (Triggering unit))]
 
Status
Not open for further replies.
Top