- Joined
- Sep 10, 2022
- Messages
- 101
Hello again, I am trying to make a new Stasis spell that will work similarly as in SC/SC2.
I know that someone managed to do it a long time ago: Simple Problem with Stasis ability
There are even more requests, I glanced. But what I am creating is something that is more trigger-based.
What I did:
1. Created a custom blizzard spell just to select the target area.
2. Every time I cast custom blizzard, triggers does the following:
1) It counts the number of targets.
2) Puts each target unit into an array. The special effect of "Lich Nova" is created and destroyed.
3) Makes units invulnerable and paused, then creates another special effect on each unit. The Special Effect is a decoration called a crystal (from the Ice Crown landscape set). It has no collision, so unit can literally be in it (or it looks so)...
4) Stores the created effects in the effect array.
5) After 5 seconds returns each unit to its initial state, destroying special effects also.
6) Cleans everything.
The mentioned trigger:
Screenshot.
I don't know what's going on exaclty, so I have few questions:
1) Do arrays work too slow?
2) Is there way to know how many units are affected by the spell without using loop?
3) Does the decoration special effect (basically any) really leak if I don't destroy it immediately?
4) What actually causes the delay of destroying of special effect ?
I know that someone managed to do it a long time ago: Simple Problem with Stasis ability
There are even more requests, I glanced. But what I am creating is something that is more trigger-based.
What I did:
1. Created a custom blizzard spell just to select the target area.
2. Every time I cast custom blizzard, triggers does the following:
1) It counts the number of targets.
2) Puts each target unit into an array. The special effect of "Lich Nova" is created and destroyed.
3) Makes units invulnerable and paused, then creates another special effect on each unit. The Special Effect is a decoration called a crystal (from the Ice Crown landscape set). It has no collision, so unit can literally be in it (or it looks so)...
4) Stores the created effects in the effect array.
5) After 5 seconds returns each unit to its initial state, destroying special effects also.
6) Cleans everything.
The mentioned trigger:
-
Stasis
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Стазис
-
-
Actions
-
Set VariableSet spell_target_area_3 = (Target point of ability being cast)
-
Set VariableSet spell_target_units_2 = (Units within 200.00 of spell_target_area_3.)
-
Unit Group - Pick every unit in spell_target_units_2 and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
((Picked unit) is Magic Immune) Equal to Нет
-
((Picked unit) is A structure) Equal to Нет
-
((Picked unit) is alive) Equal to Да
-
-
Then - Actions
-
Set VariableSet spell_target_2 = (Picked unit)
-
Set VariableSet units_array[number_of_units] = spell_target_2
-
Special Effect - Create a special effect attached to the origin of spell_target_2 using Abilities\Spells\Undead\FrostNova\FrostNovaTarget.mdl
-
Set VariableSet stasis_effect = (Last created special effect)
-
Special Effect - Destroy stasis_effect
-
Unit - Pause spell_target_2
-
Unit - Make spell_target_2 Invulnerable
-
Special Effect - Create a special effect attached to the origin of spell_target_2 using Doodads\Icecrown\Rocks\Icecrown_Crystal\Icecrown_Crystal5.mdl
-
Set VariableSet effect_array[number_of_units] = (Last created special effect)
-
Set VariableSet number_of_units = (number_of_units + 1)
-
-
Else - Actions
-
-
-
-
Wait 5.00 seconds
-
For each (Integer A) from 0 to (number_of_units - 1), do (Actions)
-
Loop - Actions
-
Special Effect - Destroy effect_array[(Integer A)]
-
Unit - Unpause units_array[(Integer A)]
-
Unit - Make units_array[(Integer A)] Vulnerable
-
Custom script: set udg_effect_array[bj_forLoopAIndex] = null
-
Custom script: set udg_units_array[bj_forLoopAIndex] = null
-
-
-
Custom script: call DestroyGroup(udg_spell_target_units_2)
-
Custom script: call RemoveLocation(udg_spell_target_area_3)
-
Custom script: set udg_stasis_effect = null
-
Custom script: set udg_spell_target_2 = null
-
Custom script: set udg_number_of_units = 0
-
-
Screenshot.
I don't know what's going on exaclty, so I have few questions:
1) Do arrays work too slow?
2) Is there way to know how many units are affected by the spell without using loop?
3) Does the decoration special effect (basically any) really leak if I don't destroy it immediately?
4) What actually causes the delay of destroying of special effect ?