• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Spawning units with effects

Level 2
Joined
Nov 27, 2017
Messages
12
So I plan to spawn units via trigger with a bit of animation as I think units appearing out of nowhere is too weird and I just plan to do aesthetics.

For example is if a unit is about to spawn, an effect appears first such as the diamond of summoning effect or raise dead effect. Although it can be done to a unit one at a time, I plan to do them simultaneously with many units. So I wanna know how to do the effect spawn in two ways: 1.) multiple different units appeared at once and 2.) constant unit spawn (ex. units spawn every X second). Moreover, I also plan to do this in a map that involves continuous spawn throughout the game but I fear that leaks may be too prominent on this one. Thanks!
 
So I plan to spawn units via trigger with a bit of animation as I think units appearing out of nowhere is too weird and I just plan to do aesthetics.

For example is if a unit is about to spawn, an effect appears first such as the diamond of summoning effect or raise dead effect. Although it can be done to a unit one at a time, I plan to do them simultaneously with many units. So I wanna know how to do the effect spawn in two ways: 1.) multiple different units appeared at once and 2.) constant unit spawn (ex. units spawn every X second). Moreover, I also plan to do this in a map that involves continuous spawn throughout the game but I fear that leaks may be too prominent on this one. Thanks!
There's no such thing as "leaks may be too prominent", you can clean up every single leak that you create. Unless your issue is that you don't understand how to clean them up - in which case I can help you.

Anyway, moving onto the main topic... For the sake of clarity I'll post these two triggers with examples of creating Special Effects:
  • Actions
    • Set Variable Point = (Somewhere...)
    • Unit - Create 1 Footman for Player at Point
    • Special Effect - Create a special effect at Point using ...
    • Special Effect - Destroy (Last created special effect)
    • Custom script: call RemoveLocation( udg_Point )
  • Actions
    • Set Variable Point = (Somewhere...)
    • Unit - Create 1 Footman for Player at Point
    • Special Effect - Create a special effect attached to the chest of (Last created unit) using ...
    • Special Effect - Destroy (Last created special effect)
    • Custom script: call RemoveLocation( udg_Point )
Both of these triggers are leak free and allow you to create a Special Effect at a Point or attached to the actual Unit. Do note that immediately destroying a Special Effect will attempt to play it's "death" animation, but if the model doesn't have one then it'll simply disappear. In other words, if you don't see the model appear in the first place then assume it's because of this issue (I provide a solution to this in the map I attached below).

But you want to handle these effects over time. I recommend posting your trigger(s) that show how you're creating your units so that we can figure out how to time things better. But if you don't have those yet then I recommend checking out my comment/attached map in this recent thread -> [General] - how-to : assign multiple regions to variable. It includes a TD map template which has a basic spawning system that you could learn from.

Furthermore, I attached a map with a system that can help with delaying both the creation and destruction of your Special Effects - which you could likely take advantage of here. The examples included should be self-explanatory. Note that this is a "quick and dirty" way of doing it, and if you're aiming for the best performance possible then I suggest a more refined system. But it gets the job done and is fairly lightweight, especially if you only use the "Simple" trigger.
 

Attachments

Last edited:
You will need a MUI system so that your spawning works for multiple units at once. Check Visualize: Dynamic Indexing which explains the concept with an example.
In that tutorial's example, it shows how to do a damage over time effect. In your case, you similarly want to track time elapsed/time remaining and at some specific times perform parts of your summoning process, for example:
  • At time=0s you create a special effect like raise dead
  • At time=1.5s you create a skeleton unit at the effect's location, pause the unit, make it invulnerable and play its birth animation
  • At time=1.8s you destroy special effect
  • At time=2.0s you unpause skeleton and make it vulnerable (and deindex instance at this point).

Just like tutorial's example is periodically checking how much time has passed to know if DoT should expire or not, you can periodically check how much time has elapsed to determine what to do.
 
Back
Top