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

Status
Not open for further replies.
Hello guys,

I made a spell and i want to double check if it lags or leaks.
The spell goes like this, when the unit casts the spell all enemy units in 600 of its range will be slowed.

I used Channel ability as my main spell and Slow as the dummy spell.
I only created 1 dummy and that seems to work perfectly.

  • SF
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to SF
    • Actions
      • Set TempPointSF = (Position of (Casting unit))
      • Unit - Create 1 Dummy for Neutral Passive at TempPointSF facing Default building facing degrees
      • Set TempDummySF = (Last created unit)
      • Unit - Add Slow (Dummy) to TempDummySF
      • Set TempUnitGroupSF = (Units within 600.00 of TempPointSF matching ((((Matching unit) belongs to an ally of (Owner of (Casting unit))) Equal to False) and (((Matching unit) is alive) Equal to True)))
      • Unit Group - Pick every unit in TempUnitGroupSF and do (Actions)
        • Loop - Actions
          • Unit - Order TempDummySF to Human Sorceress - Slow (Picked unit)
      • Unit - Add a 1.00 second Generic expiration timer to TempDummySF
      • Custom script: call RemoveLocation (udg_TempPointSF)
      • Custom script: call DestroyGroup( udg_TempUnitGroupSF )
I used neutral passive as the owner of the dummy so that i won't mess up the number of created units in the scorescreen.

Should i add more matching conditions, like unit not immune to spell and is organic, to optimize the trigger?

Please let me know if there are any problems that might occur with this trigger.

Thank you.
 
Last edited:
Who is "TempDummySoulScream". Inside Add a 1 s expiration timer
Currently your "TempDummySF" will not be removed.

Crap! lol i was in a hurry i didn't edit the code. My bad sorry. :)


Shouldn't i use a variable for the group?

I think the Common Structure in the tutorial is better than the Recomended Structure. I'm sure it's a pain in the ass to go through multiple matching conditions but i think it's an optimum solution because in the Recomended Structure we add the units in the caster's range to the group then we do the filtering while in the Common Structure we do the filtering then we add the matching units to the group. For example, the caster has 20 units in its range when only 5 of those units apply to our spell's conditions. It's better to add only 5 units to the group than to add 20 and apply the actions on 5 of them. (I might be talking nonsense here lol but i just wanted to know if there's a harmful difference between the two). :)

Edit: There will be a first time cast lag to load up the used dummy slow spell.

Do you advice me to preload the spell? In that case how? :p

One more question please: Should i set the Base Order ID of the channel spell, that i used as the main spell, to NONE?

Thank you. :)
 
Last edited:
"Recommented way":
As mentioned in the linked post, it is most about easy Read- & Edit-Ability.
Edit: Have to correct my talk. As more matching elements you have to check for, the better the if inside the group becomes.

One more question please: Should i set the Base Order ID of the channel spell, that i used as the main spell, to NONE?
"None" is a bad idea. How you know what he is doing in that case?
Make sure it does not colide with other abilities the unit has.
And it does not use an order you issue with triggers.
 
Last edited:
Level 38
Joined
Feb 27, 2007
Messages
4,951
I think the Common Structure in the tutorial is better than the Recomended Structure. I'm sure it's a pain in the ass to go through multiple matching conditions but i think it's an optimum solution because in the Recomended Structure we add the units in the caster's range to the group then we do the filtering while in the Common Structure we do the filtering then we add the matching units to the group. For example, the caster has 20 units in its range when only 5 of those units apply to our spell's conditions. It's better to add only 5 units to the group than to add 20 and apply the actions on 5 of them. (I might be talking nonsense here lol but i just wanted to know if there's a harmful difference between the two). :)
Should i add more matching conditions, like unit not immune to spell and is organic, to optimize the trigger?
Magic Immune is already automatically filtered out because the dummy can't cast Slow on a magic immune target. If you want to be able to easily modify your targeting/filtering then yeah it's a good idea to use the method suggested in that tutorial. IMO it really is better to do it that way (and take the performance hit when there are 20 units nearby but only 3 are valid targets) because the way JASS (and GUI) condition checking works is it will immediately skip to the Else whenever any single If condition is not met. So if your first if is "(TargetUnit is a Structure) equal to true" and the first unit is a not a structure then it won't even check the rest of the conditions for that unit and will move on instead. You don't really take a performance hit because of that.
 
Status
Not open for further replies.
Top