- Joined
- Jan 30, 2013
- Messages
- 12,450
Spell System for GUI MUI Coding
By Daffa the MageRequired Materials
- World Editor
- GUI Spell System v1.8.0.0 by Bribe
- Basic knowledge of how to import Spell System into your map
- Knows how to open Trigger Editor and making a new trigger
- Have basic knowledge of trigger editor workings
Introduction
Greetings,
This tutorial is aimed at newbie GUI triggerer to be able to make simple spells that fit the MUI criteria by utilizing spell event. This is part of my aim to make Spell Section a more interesting place with more MUI resources to boot and the first tutorial of a series of tutorial related to this.
This tutorial is aimed at newbie GUI triggerer to be able to make simple spells that fit the MUI criteria by utilizing spell event. This is part of my aim to make Spell Section a more interesting place with more MUI resources to boot and the first tutorial of a series of tutorial related to this.
Making Your First Spell
So, for the startup, we will make a simple 'Heal' spell using the Spell System. I'm talking about Priest 'Heal', but instead of just healing, we want it to increase our max health per second for a few seconds.
So, buckle up and get yourself ready. First, follow instruction to install the Spell System. Then, open the trigger editor and copy the Spell System Sample Config. Let's call the new trigger Heal Config. Enable Heal Config and set your ability to your healing ability. Create 2 empty triggers called Heal Cast and Heal Loop.
Then, configure the config to be somewhat like the following. This is configuration is based on Bribe's documentation on example config trigger.
So, buckle up and get yourself ready. First, follow instruction to install the Spell System. Then, open the trigger editor and copy the Spell System Sample Config. Let's call the new trigger Heal Config. Enable Heal Config and set your ability to your healing ability. Create 2 empty triggers called Heal Cast and Heal Loop.
Then, configure the config to be somewhat like the following. This is configuration is based on Bribe's documentation on example config trigger.
-
Heal Config
-
Events
- Map initialization
- Conditions
-
Actions
- -------- You must assign an ability ID to let the system know which spell you're using: --------
- Set Spell__Ability = Heal
- -------- Next, you must pick at least one of the following types of triggers to run at a phase of the spell: --------
- Set Spell__Trigger_OnCast = Heal Cast <gen>
- -------- Next, you can specify a trigger to run periodically, if you want that type of behavior. --------
- Set Spell__Trigger_OnLoop = Heal Loop <gen>
- -------- Added 28 Feb 2016: You can now specify Spell__Time, Spell__Duration and Spell__DurationPerLevel from the Config trigger. --------
- -------- NOTE: With these settings, the OnLoop trigger will run every 1 second for 4/5/6 seconds --------
- Set Spell__Time = 1.00
- Set Spell__Duration = 3.00
- Set Spell__DurationPerLevel = 1.00
- -------- The next ones are for the InRange filter, if you use it. You don't have to include any of these for many typical spells. --------
- -------- TIPS: --------
- -------- > For healing spells, you'll want to set AllowAllies to True and AllowEnemies to False. --------
- -------- > If you are creating a "kill unit" spell, you'll want to set AllowHero to False. --------
- -------- > If you are making a custom "Resurrect", you'll want to set AllowDead to True and AllowLiving to False. --------
- -------- > AllowMagicImmune as False also prevents invulnerable units from being picked, which is a plus in my opinion. --------
- Set Spell__Filter_AllowEnemy = True
- Set Spell__Filter_AllowLiving = True
- Set Spell__Filter_AllowHero = True
- Set Spell__Filter_AllowNonHero = True
- Set Spell__Filter_AllowAlly = False
- Set Spell__Filter_AllowDead = False
- Set Spell__Filter_AllowFlying = False
- Set Spell__Filter_AllowMechanical = False
- Set Spell__Filter_AllowStructure = False
- Set Spell__Filter_AllowMagicImmune = False
- -------- NEW: Added 17 May 2016 - you can specify your own trigger conditions to add to the InRange check --------
- -------- The trigger conditions reference the unit "Spell__InRangeUnit" --------
- Set Spell__Trigger_InRangeFilter = Spell System Sample Filter <gen>
- -------- If you want to keep track of which units have already been hit by the spell, set UseTargetGroup to True --------
- -------- TIPS: --------
- -------- > The group is called Spell__TargetGroup. It starts empty and will destroy itself when the spell is finished --------
- -------- > After using a Spell__InRange check, you can use "Add all units in Spell__InRangeGroup to Spell__TargetGroup" --------
- Set Spell__UseTargetGroup = True
- -------- When everything is set the way you want it, run Spell System <gen>: --------
- Trigger - Run Spell System <gen> (ignoring conditions)
-
Events
We will not use the filters, so I just skim it. You can alter the duration as needed.
-
Heal Cast
- Events
- Conditions
-
Actions
- Set Spell__StartDuration = True
Heal Cast is only for duration triggering. Without it, the spell loop effect will not run.
-
Heal Loop
- Events
- Conditions
-
Actions
- Unit - Set Max HP of Spell__Target to ((Max HP of Spell__Target) + 10)
Heal Loop will add 10 Max HP per second. Something odd I found with my test map running the spell 5 times despite I set it to 4 seconds. It can easily be fixed by checking the remaining duration as shown below:
-
Heal Loop
- Events
- Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Spell__Duration Greater than 0.00
-
Then - Actions
- Unit - Set Max HP of Spell__Target to ((Max HP of Spell__Target) + 10)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Now, it works as intended. I provided a test map for you to look at the final result. If you don't get the same result, feel free to compare your code with the provided attachment.
~Daffa the Mage
Attachments
Last edited: