Tutorial Various Trigger Systems

Z

Zell

Guest
Various Trigger Systems
Version 1.2


Foreword:

Firstly, this is a work in progress. Right now I'm just putting in one guide at a time, but have patience. I have a few ideas for some guides, which I will add here at a later date.

Anyways, this is my tutorial. It is, as the title implies, a collection of guides on how to create trigger systems. Most of these aren't all that complicated, and therefore don't really merit their own guide. I will not attach maps with the triggers and objects in them because this is a learning exercise, not a copy and paste one. If you are really having difficulties with it, PM me and we will talk about the matter.

All of the systems are designed to achieve a certain goal. The guides will not, however, give exact directions on which buff to use, the icon to pick, how much damage to deal, or any of the basic aesthetics / balancing. It will merely list the exact steps needed to achieve said goal. Furthermore, some of the triggers will have optional lines that are used to select specific targets only, etc. These lines of code will be marked by ~ (a.k.a. the console button), followed by a number that will be referenced after the trigger for an explanation. All of the systems are written in full GUI (with the exception of the occasional JASS custom script to fix leaks) and are all totally MUI. All of the systems have been designed by myself, and while they might not be 100% unique, they were all built from scratch.

Additionally, there are several references to DotA. If you don't know what it is, DotA (Defense of the Ancients) is one of the all time most played maps in Warcraft. It has some advanced custom skills and a wide variety of heroes and items. To look up anything I mention from DotA, check out www.dota-allstars.com.


Table of Contents:

I. The Basics (tbsc)​
II. Custom Passive Skills (cstmps)​
III. Custom Auras (cstmar)​
IV. Auto-Cast Attack Skills (acats)​
V. Version History (vrhst)​


The code provided in parenthesis next to the topic is a way to jump to the desired guide. Simply hit Ctrl + F and type in that code.


I. The Basics (tbsc)

This section contains links to guides explaining basic techniques you should already be familiar with before attempting anything cool. While they will not all pertain to my systems, they are definitely required knowledge for almost any good map.

Memory Leaks and Custom Scripts: http://www.thehelper.net/forums/showthread.php?t=27219&highlight=dummy+caster
Abilities Guide: http://www.thehelper.net/forums/showthread.php?t=44234
Icon Coordinate Reference: http://www.thehelper.net/forums/showthread.php?t=38305
Dummy Casters: http://www.thehelper.net/forums/showthread.php?t=26751
Makin’ Spellbooks: http://www.thehelper.net/forums/showthread.php?p=274236#post274236


II. Custom Passive Skills (cstmps)

What is a Custom Passive Skill? Well, it is just what the name says. It is a passive skill, like Bash or Critical Strike, that uses custom triggers to create the effects. This type of skill can range from a defensive skill, like the Faceless Void's Backtrack, to an offensive skill, the Twin-Headed Dragon's Autofire. In essence, a custom passive skill is basically a custom spell that automatically casts on a certain chance.

The first step towards your very own custom passive skill, as with anything, is the idea. What do you want it to do? For this guide, let's make a custom passive skill that causes the attacked unit to be frozen solid, as well as cause AoE damage to slow all nearby enemies. Let's call it "Frigid Strike".

The second step is to create a blank standard passive skill. What do I mean by blank? 'Blank' means a skill that does nothing, all of the values are set to zero and is basically just there to be the icon the user sees. So for our blank passive skill, let's take Bash (because there's only one value to worry about). Create a custom Bash and find and set the "Level n - Data - Chance to Bash: 0", where n is the number of levels this skill will have. Set the icon and the tool tip and everything to your liking.

Step 3: the triggered effects. Our effect has 2 phases. The AoE damage and slow and the freezing. The easiest way to achieve these effects is to utilize the pre-existing spells Frost Nova and Entangling Roots. For Frost Nova, the fields you need to worry about are “Stats – Level” (set it to the same n as Frigid Strike), all of the damage and area fields and the durations. As for Entangling Roots, you need to change the same basic fields; duration and damage, as well as “Stats – Buffs” to the buff you want to show on the unit being hit by Frigid Strike. You will also need to change the “Art – Target” for the buff to something more appropriate, such as “Freezing Breath <Target>”.

Now for the fun part: the trigger. The key to any custom passive skill is that they activate on a certain % chance. To achieve this simulation of a roll, we use “Math – Random Number”. After this, it is basically just making the dummy units for the spells and adding any extra damage or special effects. The event (as always) acts as the switch, the thing the trigger is looking for to go off. With passive skills, there are a few events you could use, the three most common being “A unit is attacked” (any sort of Bash or Critical Strike type skill), “A unit starts the effect of an ability” (for the Ogre Magi’s Multicast) and “A unit dies” (for the Necrolyte’s Sadist). For Frigid Strike, we will use the attack event. The conditions are used to make sure that the attacking unit actually has Frigid Strike, and that the target isn’t an ally you might be trying to deny (1). Then the actions, as explained above, create the actual effect of the skill.

Code:
Frigid Strike
    Events
        Unit - A unit Is attacked
    Conditions
        (Level of Frigid Strike  for (Attacking unit)) Greater than 0
        ~ 1 ~((Owner of (Attacking unit)) is an enemy of (Owner of (Attacked unit))) Equal to True
        (Random integer number between 1 and 1000) Less than or equal to (((Level of Frigid Strike  for (Attacking unit)) x 2) + 100)
    Actions
        Set Unit_TemporaryPosition = (Position of (Attacking unit))
        Unit - Create 1 Dummy for (Owner of (Attacking unit)) at Unit_TemporaryPosition facing Default building facing degrees
        Unit - Hide (Last created unit)
        Unit - Add Frigid Strike (Nova Effect) to (Last created unit)
        Unit - Set level of Frigid Strike (Nova Effect) for (Last created unit) to (Level of Frigid Strike  for (Attacking unit))
        Unit - Order (Last created unit) to Undead Lich - Frost Nova (Attacked unit)
        Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ~ 2 ~ ((Attacked unit) has buff Frigid Strike ) Equal to False
            Then - Actions
                Unit - Create 1 Dummy for (Owner of (Attacking unit)) at Unit_TemporaryPosition facing Default building facing degrees
                Unit - Hide (Last created unit)
                Unit - Add Frigid Strike (Freeze Effect) to (Last created unit)
                Unit - Set level of Frigid Strike (Freeze Effect) for (Last created unit) to (Level of Frigid Strike  for (Attacking unit))
                Unit - Order (Last created unit) to Night Elf Keeper Of The Grove - Entangling Roots (Attacked unit)
                Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
            Else - Actions
        Custom script:   call RemoveLocation (udg_Unit_TemporaryPosition)
And that’s it. When a unit attacks, if it has Frigid Strike learnt, roll the number. If it is less than or equal to 100 + 2 per level (a.k.a. 10.2% chance on level 1, 10.4% at level 2, etc)(use whichever % chance you wish to use), nuke it!

1) Explained in the previous paragraph
2) The condition, as well as the entire If/Then/Else basically ensures the unit attacked isn’t still frozen from before. If you don’t want this, put all of the actions under the Frost Nova Effect and delete the If/Then/Else.


III. Custom Auras (cstmar)

Ah! A custom aura you say? Yes. There have been several requests for a method of making a custom aura, and guess what? Here it is. It’s somewhat more complex than most systems, but each step is a logical process (as always).

Custom auras can work for granting any kind of skill; including custom passive and actives (provided they are MUI). Custom auras giving passive skills work on the small “loophole” of spell books in that when they are disabled, they still provide passive effect yet are invisible. As for active skills, well you don’t want that invisible. I will do two examples, one for passive skills (using the Frigid Strike I just made above) and one for active skills. They’re almost identical, but let’s do it anyways!

So what will we need for a passive skill granting custom aura? Well, a spell book, the actual passive you want to give, and a blank aura. We want an aura granting the powerful Frigid Strike, so we’ll call it Frigid Essence. Base Frigid Essence off any old aura with a modified buff, range and art, and remember to set all effect fields to zero (I.E. the bonus mana regeneration if Brilliance Aura was used). We already have the passive skill Frigid Strike, so we need to put that into our custom spell book. The spell book only needs 1 level, whereas Frigid Essence and Frigid Strike should have the same number of levels. There’s one thing to keep in mind here, spell books only take item and unit abilities. So if the passive skill you are granting is a hero ability, you will need a second version of it, as well as a second trigger for the item / unit ability.

We have all of our objects needed; the next thing to do is create the variables. We will need six of them, and they are as follows.

FrigidEssence_Variables-1.jpg


If you’re wondering why I use “Z_” as a prefix, it’s just to keep all of the ability variables together in a row, as opposed to being all over the place. Remember, names of variables never matter, they just help the reader distinguish their use easier.

Now for the trigger. As I said, this one is a bit more complicated, and as such it will be broken down into steps and explained thoroughly. For the event, we will use a periodic one running every 3 seconds. Why so long? Well, if you notice that in-game, even standard auras will actually remain in effect for a brief amount of time after the unit moves outside the range of the aura. You can set the time period smaller, but it will just cause unnecessary strain (as little as it may be; I would suggest staying above 1 second) on the processor. So we have the following so far.

Code:
Events
    Time - Every 3.00 seconds of game time
Next we will need to find all of the units that actually have the aura, Frigid Essence. For this, we use Z_FrigidStrike_Integer to keep track of how many units actually have the aura; instead of using the size of the unit group like we do initially, because we want to destroy that and remove the leak as soon as possible.

Code:
Actions
    Set Z_FrigidEssence_Integer = 0
    Set Z_FrigidEssence_UnitGroupSort = (Units in (Playable map area) matching ((Level of Frigid Essence (Brilliance Aura) for (Matching unit)) Greater than 0))
    For each (Integer A) from 1 to (Number of units in Z_FrigidEssence_UnitGroupSort), do (Actions)
        Loop - Actions
            Set Z_FrigidEssence_Hero[(Integer A)] = (Random unit from Z_FrigidEssence_UnitGroupSort)
            Set Z_FrigidEssence_HeroPosition[(Integer A)] = (Position of Z_FrigidEssence_Hero[(Integer A)])
            Unit Group - Remove Z_FrigidEssence_Hero[(Integer A)] from Z_FrigidEssence_UnitGroupSort
            Set Z_FrigidEssence_Integer = (Z_FrigidEssence_Integer + 1)
    Custom script:   call DestroyGroup(udg_Z_FrigidEssence_UnitGroupSort)
So, step by step, this block of the trigger resets the integer, chooses every unit on the map that has Frigid Essence and sets all of them to their own unit array.

Part two of the trigger will actually grant Frigid Strike to everyone. This will be done in two phases. The first will give the ability to any unit entering the aura. The second phase will adjust the level of the ability, because Frigid Essence will be leveled. You don’t want to have to move every unit out of range (which will be impossible for the unit with the aura) and back in each level, right? The second phase will also increase the level of the granted ability incase a second unit with a better Frigid Essence comes by.
Code:
Actions
    For each (Integer A) from 1 to Z_FrigidEssence_Integer, do (Actions)
        Loop - Actions
            Set Z_FrigidEssence_UnitGroup[(Integer A)] = (Units within 800.00 of Z_FrigidEssence_HeroPosition[(Integer A)])
            Unit Group - Pick every unit in Z_FrigidEssence_UnitGroup[(Integer A)] and do (Actions)
                Loop - Actions
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        If - Conditions
                            ((Picked unit) belongs to an ally of (Owner of Z_FrigidEssence_Hero[(Integer A)])) Equal to True
                            (Level of Frigid Essence’s FS (Spell Book) for (Picked unit)) Equal to 0
                        Then - Actions
                            Unit - Add Frigid Essence’s FS (Spell Book) to (Picked unit)
                            Unit - Set level of Frigid Strike for (Picked unit) to (Level of Frigid Essence (Brilliance Aura) for Z_FrigidEssence_Hero[(Integer A)])
                        Else - Actions
                            If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                If – Conditions
                                    ((Picked unit) belongs to an ally of (Owner of Z_FrigidEssence_Hero[(Integer A)])) Equal to True
                                    (Level of Frigid Essence’s FS (Spell Book) for (Picked unit)) Less than (Level of Frigid Essence (Brilliance Aura) for Z_FrigidEssence_Hero[(Integer A)])
                                Then - Actions
                                    Unit - Set level of Frigid Strike for (Picked unit) to (Level of Frigid Essence (Brilliance Aura) for Z_FrigidEssence_Hero[(Integer A)])
                                Else - Actions
            Custom script:   call RemoveLocation(udg_Z_FrigidEssence_HeroPosition[bj_forLoopAIndex])
The first action in this block, setting the unit group, can be changed to suit your liking. 800 should be the same as the radius of Frigid Essence. After that, the trigger takes everyone under the effect of this aura (I.E. in the radius) and sees if they don’t have the ability yet (this would be phase 1). It also makes sure the unit is an ally; this can be changed to filter out targets to who you want. If you want something like Diffusion Aura, make it take only enemies. You can also filter out buildings, ground units, flying units, etc. Just make sure the “Level n – Stats – Targets Allowed” is the same, so that units with the skill get the buff, and that units that don’t have the buff won’t get the skill. The second If/Then/Else in the Else Actions of the first is phase 2. The trigger checks that the aura isn’t better than the level of the ability. If the aura is leveled or a better one comes in, the ability will be upgraded.

If you thought that was it, then you’ve forgotten a key thing. What about the units that come in range and then leave? We need to take care of that. How? Easy. We basically take every unit in the entire map and make sure it isn’t in any of the Z_FrigidEssence_UnitGroup unit groups (I.E. the units that are still in range). Then we simply remove the spell book and clean up the unit groups and we’re done!
Code:
Actions
            Set Z_FrigidEssence_Other[(Integer A)] = (Units in (Playable map area))
            Unit Group - Pick every unit in Z_FrigidEssence_Other[(Integer A)] and do (Actions)
                Loop - Actions
                    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        If - Conditions
                            Or - Any (Conditions) are true
                                Conditions
                                    And - All (Conditions) are true
                                        Conditions
                                            ((Picked unit) belongs to an ally of (Owner of Z_FrigidEssence_Hero[(Integer A)])) Equal to False
                                            ((Picked unit) is in Z_FrigidEssence_UnitGroup[(Integer A)]) Equal to True
                                    ((Picked unit) is in Z_FrigidEssence_UnitGroup[(Integer A)]) Equal to False
                        Then - Actions
                            Unit - Remove Frigid Essence’s FS (Spell Book) from (Picked unit)
                        Else - Actions
            Custom script:   call DestroyGroup(udg_Z_FrigidEssence_UnitGroup[bj_forLoopAIndex])
            Custom script:   call DestroyGroup(udg_Z_FrigidEssence_Other[bj_forLoopAIndex])
The condition is a little bit tricky, but it basically looks at the unit and says “Is this unit in the range of an aura, but an enemy of the aura holder? Or is it not even in the range of any auras?” If either of these are true, then it will go ahead and Take away the skill. Note: Make sure this block is still inside the For Loop from the previous block of code.

Let’s take a look at the finished product, shall we? Ah, looks nice.

FrigidEssence_Done.jpg


What’s that? The units in the aura have a spell book? Sounds like someone didn’t disable the book like I had said. No worries, the trigger is simple.
Code:
Disable Spell Books
    Events
        Map initialization
    Conditions
    Actions
        For each (Integer A) from 1 to 12, do (Actions)
            Loop - Actions
                Player - Disable Frigid Essence's FS (Spell Book) for (Player((Integer A)))
Now we’re all finished. As for an aura granting an active skill, it is almost the same, only easier. You do not need a spell book, and the ability granted can still be a hero skill. The only change you need is referencing any “Frigid Essence’s FS (Spell Book)” with the active skill. Other than that, it’s identical.


IV. Auto-Cast Attack Skills (acats)

This next system is fairly simple, yet it is a common problem that had seemingly no solution. But fear not, I have one (trust me, it’s not that great)! So what’s an auto-cast attack skill? Well, anything that adds an orb effect, like Searing Arrows or Black Arrows, when set to auto-cast. When the skill is used normally, by clicking the icon and selecting the target, the effects will trigger on “A unit starts the effect of an ability” like normal. However, the problem is when you attack and the skill is on auto-cast, the event won’t trip.

Onto the solution. First thing we will need is a trigger-enhanced auto-cast attack skill. Continuing with my randomly chosen theme of ice skills, let’s make a Crystal Arrow skill that causes AoE damage and slow. Take any of the standard auto-cast attack skills and set the effect values to zero (unless you want bonus damage or slow or spawning a minion or etc); I will use Searing Arrows. Our effect will be, like for Frigid Strike, based on Frost Nova. Get the damage and duration just right and we’re off. Then we go into the Trigger Editor and make our standard trigger-enhanced spell for when it is manually cast.
Code:
Crystal Arrow
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Crystal Arrow
    Actions
        Set Unit_TemporaryPosition = (Position of (Triggering unit))
        Unit - Create 1 Dummy for (Owner of (Triggering unit)) at Unit_TemporaryPosition facing Default building facing degrees
        Unit - Hide (Last created unit)
        Unit - Add Crystal Arrow (Nova Effect) to (Last created unit)
        Unit - Set level of Crystal Arrow (Nova Effect) for (Last created unit) to (Level of Crystal Arrow for (Triggering unit))
        Unit - Order (Last created unit) to Undead Lich - Frost Nova (Target unit of ability being cast)
        Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
        Custom script:   call RemoveLocation (udg_Unit_TemporaryPosition)
That was easy. When the unit cast the skill, a dummy unit pops out to cast Frost Nova. Now the trick comes in finding out when the skill is on auto-cast. For this, we will need to check the “Text – Order String – Use/Turn On” and “Text – Order String – Turn Off”. For Searing Arrows, the string is “flamingarrows” and “unflamingarrows”, respectively. This little string is the key we need to use to unlock this mystery (I told you it wasn’t spectacular). We will need a unit group to keep track of the units with Crystal Arrow on.

Z_CrystalArrow_UnitGroup / Unit Group / -None-

For our event, we use “Unit - A unit Is issued an order with no target”, since you are merely right clicking the icon. We have no main condition, but we will have two in separate Ifs. The condition is an Order Comparison, and checks that the order given is turning on / off the auto-cast (a.k.a. flamingarrows / unflamingarrows). In the first If, where the auto-cast is being turned on, we add the unit to the Unit Group. The second If is just the opposite, it checks if you are turning off the auto-cast and takes it out of the Unit Group.
Code:
Set Autocast
    Events
        Unit - A unit Is issued an order with no target
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Issued order) Equal to (Order(flamingarrows))
            Then - Actions
                Unit Group - Add (Ordered unit) to Z_CrystalArrow_UnitGroup
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Issued order) Equal to (Order(unflamingarrows))
            Then - Actions
                Unit Group - Remove (Ordered unit) from Z_CrystalArrow_UnitGroup
            Else - Actions
Okay, so now we know which units are auto-casting Crystal Arrows. We could make a new trigger based on “A unit is attacked” with the Boolean Comparison condition of “((Attacking unit) is in Z_CrystalArrow_UnitGroup) Equal to True”, but we’ll add it to the first trigger we made to keep it simple. We add the event in, no problem; events are always “or” and will trip on any of the events listed. The condition, however, is always “and”, and we will need to add an “or” in there. Create a condition, scroll to the very bottom and select “Or, Multiple Conditions”. Put the original and the new condition in the ‘Or’ branch and you’re done! And if you think there might be a conflict, relax. If the unit casts something, there is no attacking unit; and if the unit attacks, it isn’t casting Crystal Arrow.

There is also one more issue we need to tackle (thanks to Tiber for bringing it up). What if the hero runs low on mana? The trigger will still run, but no mana will be subtracted. For this, we add a second unit group variable; because the skill is still on, so we don’t want to take them out of the original unit group.

Z_CrystalArrow_OutOfMana / Unit Group / -None-

This trigger is very similar to the ‘Set Autocast’ one, only it moves the units from that unit group to our new one based on their current mana. We use a periodic event, set very frequent since the mana pool is very dynamic. The pair of Ifs will move the units back and forth between the unit groups based on their current mana.
Code:
Autocast Out of Mana
    Events
        Time - Every 0.05 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in Z_CrystalArrow_UnitGroup and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Mana of (Picked unit)) Less than 8.00
                    Then - Actions
                        Unit Group - Add (Picked unit) to Z_CrystalArrow_OutOfMana
                        Unit Group - Remove (Picked unit) from Z_CrystalArrow_UnitGroup
                    Else - Actions
        Unit Group - Pick every unit in Z_CrystalArrow_OutOfMana and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Mana of (Picked unit)) Greater than or equal to 8.00
                    Then - Actions
                        Unit Group - Add (Picked unit) to Z_CrystalArrow_UnitGroup
                        Unit Group - Remove (Picked unit) from Z_CrystalArrow_OutOfMana
                    Else – Actions
Remember that “(Mana of (Picked unit)) Less than 8.00” should compare to the specific mana cost of the auto-cast attack skill, I used 8 because it is the default mana cost of Searing Arrows. Now we’re not done yet, no. We need to go back and add a quick line to ‘Set Autocast’, for when a unit with low mana (therefore in the OutOfMana unit group) deactivates the skill. For this, we simply add the following line to second Then Actions, removing the Ordered Unit from both unit groups.
Code:
Unit Group - Remove (Ordered unit) from Z_CrystalArrow_OutOfMana
So now let’s take a quick look at our set of triggers, eh?

CrystalArrow_Done2.jpg


And remember, the ‘Set Autocast’ will work as a general trigger for all of you auto-cast attack skills, just add a pair of opposite Ifs that add / remove the unit to a skill-specific unit group.


V. Version History (vrhst)

Version 1.2
  • Edited section IV to cover insufficient mana (thanks to Tiber).

Version 1.1
  • Added section IV, Auto-Cast Attack Skills and the Version History.

Version 1.0
  • First release. Contained sections I, II and III.
 

SFilip

Gone but not forgotten
Reaction score
633
Well the Free Trigger Code is kind of made for dumping systems/triggers like this...
 
Z

Zell

Guest
Well the Free Trigger Code is kind of made for dumping systems/triggers like this...
Well, this isn't really a copy and paste thing, I just used examples to demonstrate. Besides, from the number of "how do I make one weapon per hero" / "recipe with 2 items??" / etc questions, not many people look there. If you want to move it, go ahead. Just as logng as I can edit it, I don't really care. You will also, however, need to do the same for almost all of the indexed Spell tutorials, as they are mostly just triggers (other than the trigger basics / advanced).
 

Ninja_sheep

Heavy is credit to team!
Reaction score
64
Good tutorial.
But at Second 1: I believe yours will work, but why not do simpely something like that?

Code:
Event:
   If a unit is attacked
Condition:
   If attacking unit has go Friggen strike (brilliance aura)
Action:
   *insert here the frigged strike action*

:>
 
Z

Zell

Guest
Good tutorial.
But at Second 1: I believe yours will work, but why not do simpely something like that?

Code:
Event:
   If a unit is attacked
Condition:
   If attacking unit has go Friggen strike (brilliance aura)
Action:
   *insert here the frigged strike action*

:>
If you mean for Frigid Essence, just play the Frigid Strike if the unit has the buff from the aura, then yes it will work; but you will also need unique buffs for each level of the aura, and need to run Ifs to detect the specific buff and set the spells on the dummy units to a value, as opposed to a function. However, what about standard passives? And actives? It's a template, which means it works in all cases. Certain cases may have shorter triggers.
 

Ninja_sheep

Heavy is credit to team!
Reaction score
64
If you mean for Frigid Essence, just play the Frigid Strike if the unit has the buff from the aura, then yes it will work. However, what about standard passives? And actives? It's a template, which means it works in all cases. Certain cases may have shorter triggers.

I understodd something wrong :> i thought you want the unit, wich has got the aura-buff do in some cases the ability. But you want, that the units under the effect of the aura HAVE the spell. Isn't it? :>
 
Z

Zell

Guest
I understodd something wrong :> i thought you want the unit, wich has got the aura-buff do in some cases the ability. But you want, that the units under the effect of the aura HAVE the spell. Isn't it? :>
Yes, Frigid Essence is an aura that gives all units affected by it Frigid Strike. That's what auras do.

0 is safe. 8191 is safe. X is safe. Why wouldn't it be safe? You think it may limit the max array amount? No, the limit is pre-fixed to 8191.
I meant to be safe as in you don't fill up the array and end up missing certain units. And if you try to put zero in the array size it will default back to 1.
 

Chocobo

White-Flower
Reaction score
409
Yes, Frigid Essence is an aura that gives all units affected by it Frigid Strike. That's what auras do.


I meant to be safe as in you don't fill up the array and end up missing certain units. And if you try to put zero in the array size it will default back to 1.

How can you miss a unit with a variable unless you use a non-response"d" unit?
 
Z

Zell

Guest
How can you miss a unit with a variable unless you use a non-response"d" unit?
Okay, I said use 100 to be safe. Let's say you used like 5, and you had 6 units with the aura. When the three seconds rolls around, since the array only has 5 indexes, only five of them will be set. Then the sixth unit will not grant the ability to the units around it. Understand? I doubt people will have 100 of the same aura in one map, so it is safe.
 
Reaction score
148
Actually, I used array sizes of 1 for hundreds of values, and it worked fine.

The only thing I needed Array Size was for setting default values.


Anyway, I'd add this to "The Index", if you're not against it.

"... need to do the same for almost all of the indexed Spell tutorials..."

?
 
Z

Zell

Guest
Anyway, I'd add this to "The Index", if you're not against it.

"... need to do the same for almost all of the indexed Spell tutorials..."

?
No, I'm not against that. I was actually just going to add the link there for you to check it out. And that quote was for SFilip, since he said that this should go in the Free Trigger Code section, since it was just triggers. If you look at the Spell tutorials, they're mostly the same idea as this.

And I guess it makes sense, having an array with only one index would be somewhat pointless. Looks like I learned something new =P
 

Chocobo

White-Flower
Reaction score
409
Okay, I said use 100 to be safe. Let's say you used like 5, and you had 6 units with the aura. When the three seconds rolls around, since the array only has 5 indexes, only five of them will be set. Then the sixth unit will not grant the ability to the units around it. Understand? I doubt people will have 100 of the same aura in one map, so it is safe.

Totally Wrong.

Size = Amount of indexes filled at pre-initialization with the pre-defined value of the variable.

Size in-game = Do nothing and doesn't matter.
 
Z

Zell

Guest
So you're telling me that every single array has the capacity to dynamically change its size at any point and time in-game to accomodate up to 8191 values?
 
Reaction score
148
It sure does for me.

For example, make a Player array with size of 1 and assign each player to the array, then order the game to print, for example, the name of Player[7]
 
Z

Zell

Guest
Interesting. I didn't know that. I guess it's my history with Visual Basics, because there the array size when defined was the maximum indexes it could contain.
 

Chocobo

White-Flower
Reaction score
409
Interesting. I didn't know that. I guess it's my history with Visual Basics, because there the array size when defined was the maximum indexes it could contain.

Just remember :
- Size for initialization and pre-defined value
- Size is nothing for indexes after initialization
- Size can be ignored simply if you manually pre-load variables.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top