- Joined
- Nov 14, 2008
- Messages
- 3,256
Editor's note.I'm getting tired of viewing spells in the spell section lately due to most of them are just bunch of crap (yes you heard me).
They're not MUI and most of them break one or more rule besides the MUI rule. So this will be a selection of tutorials,
same concept as palaslayer had (or was it kwah? dont remember) - From zero to hero -.
~baassee
Requirements
- Decent GUI knowledge - Know about variables and manage to "create a trigger".
- A world editor, either the standard WE or JNGP. WE Unlimited is banished from this tutorial, don't even mention it.
- Time.
Information about the tutorial.
This tutorial do not take leaks into consideration. Nor does it have a test map, I just say what the user should look at and which word/s it should search for in the search engine. Also this is not a complete tutorial how to make spells, this is just the very basics and a few helpers.
The next tutorial will probably tell all about leaks and it's importance to clear them but for now the user should be focused on how to proper code the basics as they say, you cannot build a house without a proper foundation right?
Also the use of BJs might be low but not explained why proper, will come in the next tutorial! Do not worry.
Within the tutorial
Step 1 - Events Part 1
Step 1 - Events Part 2
Step 2 - Conditions
Step 3 - Actions
In this tutorial we are using GUI. In Warcraft III the coding language is call JASS (Just Another Scripting Syntax) and Warcraft III itself is coded in a language called C. GUI stands for Graphic User Interface and is there to make it more easier for beginners to create their own code. Basic GUI is JASS but with pictures and clickable objects. Of course in detail there are a lot more differences but in the end as an old friend said: "What you can do in JASS, I can do in GUI." - Paladon.
Step 1 - Events Part 1
- Back to the top.The first thing you will need in your spell is an event. The spell related events are all in the Unit - Generic Unit Event. There are several of them so which one are you supposed to use? A few of them are quite... tricky.
Hint: Yeah I know that the events are in the Unit - Specific Unit Event as well. We're not supposed to use them, only in very rare occasions which people at this level do not use.
I'll list them here for you.
- Unit - A unit Begins channeling an ability
- Unit - A unit Begins casting an ability
- Unit - A unit Stops casting an ability
- Unit - A unit Starts the effect of an ability
- Unit - A unit Finishes casting an ability
Start of a spell & End of a spell.
So the Start of a spell sub-group will contain:
- Unit - A unit Begins channeling an ability
- Unit - A unit Begins casting an ability
- Unit - A unit Starts the effect of an ability
- Unit - A unit Stops casting an ability
- Unit - A unit Finishes casting an ability
- Unit - A unit Begins channeling an ability
- Unit - A unit Begins casting an ability
- Unit - A unit Starts the effect of an ability
- Unit - A unit Begins channeling an ability
- Unit - A unit Begins casting an ability
- Unit - A unit Starts the effect of an ability
Hint: It's a typical mistake for beginners as they might use
- Unit - A unit Begins casting an ability
- Unit - A unit Starts the effect of an ability
And the last two events of course! With explanation.
- Unit - A unit Stops casting an ability
- Unit - A unit Finishes casting an ability
Hint: With this event you will not be able to retrieve information about the target unit of ability being cast. Special thanks to Pharaoh_ for pointing this out.
Step 1 - Events Part 2
- Back to the top.So if there 3 events that can register when a spell is fired why isn't there only one? Because there are plenty of uses and situations where you don't want manacost and cooldown to trigger. A common example would be that you want a spell to require hp to cast and then you can use the "begins casting" event as it only plays animation and if the current hp is not correct then you can just order the casting unit to stop and therefore will not trigger the next event (the effect).
Or if you want a spell to fire instantly and probably pausing the unit/removing it from the players selection (and therefore it will automatically fire the effect event) you can use the channel event. It can also be used with the example above although animations are nice (first spell and then stand, looks a bit more realistic).
The effect event is of course for most of all spells that you will trigger. Manacost and cooldown are quite relevant things in a map.
Can you combine the events? YES you can! In different triggers of course though. Easiest example is that you wanna stop a unit before as one of the examples above. Let's say this time you create two triggers, trigger 1 and trigger 2.
Trigger 1 has the "begins casting an ability event" and Trigger 2 has the "starts an effect of an ability". Trigger 2 will add a buff to the caster and while the caster has this buff, it will be stopped when trying to fire off the spell again within the interval. Trigger 1 is there to make the magic happen. It checks if the triggering unit has the buff and if it has, then it orders the unit to stop else it does nothing. Piece of cake eh?
Step 2 - Conditions
- Back to the top.This step is rather short as it's so little to do. The whole step is about this rather short line:
- (Ability being cast) Equal to YourSpell
Hint:In JASS you compare the unique object id with an integer comparison but that's a bit much now.
You really thought this step was this short? Well it's not, now what can we do as well just to give you some more inspiration.
In our example with the stop event we had two triggers right? One was checking a buff right? How would have those triggers looked?
-
Trigger 1
-
Events
- Unit - A unit Begins casting an ability
-
Conditions
- ((Triggering unit) has buff YourBuff) Equal to True
-
Actions
- Unit - Order (Triggering unit) to Stop
-
Events
-
Trigger 2
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to YourSpell
- Actions
-
Events
Wooahh now a few more experienced users might think, why in hell don't you check the ability being cast in the first trigger? Well it's just a triggering tip but if there's only one spell that can give this buff then why should we check two booleans instead of one? Lesser code that does the same thing is always better. Beware though that if there are more possibilities to recieve this buff my way will not work (will be unreliable). Either way in trigger 1 we use a "boolean comparison", search for "Unit has specific buff" and change the buff to your custom buff. In the actions you search for in this example Unit - Issue order with no target and change unit into triggering unit. So what we have done is that if the unit has the buff, we stop the unit and it will not proceed to the next step! Great huh?
Step 3 - Actions
- Back to the top.No more no less the most important(?) part - The actions. This part will not tell you everything, will tell you the most basic stuff and not tell about memory leaks (as mentioned in the info).
I'll keep this section rather short and point out the most relevant for users in the beginning.
One thing most users want their spells to do is damage. Alright so there are two different damage functions.
Unit - Damage Area
Unit - Damage Target
These will show up.
- Unit - Cause (Triggering unit) to damage circular area after 0.00 seconds of radius 500.00 at (Center of (Playable map area)), dealing 100.00 damage of attack type Spells and damage type Normal
- Unit - Cause (Triggering unit) to damage (Triggering unit), dealing 500.00 damage of attack type Spells and damage type Normal
- Unit - Cause (Triggering unit) to damage circular area after 0.00 seconds of radius 500.00 at (Center of (Playable map area)), dealing 100.00 damage of attack type Spells and damage type Normal
0.00 -> real amount - The time until it should damage, 0 = instant.
500.00 -> real amount - the damage radius, the area that the damage should be dealt.
Center of (region) - point variable, the point where the action should start count its radius from
playable map area - region, yeah the point will be a point from a region (mostly)
100.00 - real amount, the damage that should be damaged duuh
spells - attack type, 'causes it to deal different damage to different armors
normal - damage type, if it's magic it will deal magic damage along with spells attack type, universal will be pure damage and the rest will not affect the damage
Hint:The Damage area will damage allies, neutrals and enemies within the area so if the hero is standing within the area, it will take damage.
- Unit - Cause (Triggering unit) to damage (Triggering unit), dealing 500.00 damage of attack type Spells and damage type Normal
Triggering Unit (2nd) - the target of the spell that should recieve the damage
500.00 - same as above
spells - same as above
normal - same as above
Hint:You can choose both damage dealer and target so you can actually make the enemy damage the casting hero as well as damaging the enemy. You can also set the damage dealer and the damage reciever to the same unit and basically it will damage itself.
Hint:This applies to both damage functions. With the use of a negative value, the units will be healed instead of damaged. Although I recommend not using this way and using the one below instead.
I hope you now see the differences between them.
What else might you wanna do in your first spell? Maybe you wanna heal something? Yeah and maybe restore mana as well? YEAH! Alrighty then...
So there are 4 different things that can affect your hp to heal (and as well the damage actions as said above)
- Unit - Set life of (Triggering unit) to 100.00%
- Unit - Set mana of (Triggering unit) to 100.00%
- Unit - Set life of (Triggering unit) to (Life of (Triggering unit))
- Unit - Set mana of (Triggering unit) to 0.00
They both have the parameters unit and real. But the thing is that we cannot basic just set the value into 100 because then the hp will be 100 and not "current health + 100". So we look into the real value. It's already set to the current health of the triggering unit BUT we need to do a little bit more. When you double click it, you will see that the function is called "Unit - Property". Now go to the top of that list and find "Arithmetic" which will make it possible to add/reduce/multiply/divide things.
Now it will display itself as 1.00 + 1.00 right? Now press the first one and find the Unit - Property again. And in the second one we change the value to 100 so it will look like this in the end:
- Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + 100.00)
- Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) - 50.00)
I think this will be enough for the action part, there's so much you can do in the action part that will not fit in right here, as said, it's a beginners guide!
Just for last I will say that there are a two more things that are quite useful.
First is comments. Comments are useless textlines that you will only see within the trigger editor and nowhere else (aka not in-game). They are useful as they can explain more within the trigger and as well make it more readable.
Compare this:
-
Trigger 1
-
Events
- Unit - A unit Begins casting an ability
-
Conditions
- ((Triggering unit) has buff YourBuff) Equal to True
-
Actions
- Unit - Order (Triggering unit) to Stop
-
Events
-
Trigger 1
-
Events
- Unit - A unit Begins casting an ability
-
Conditions
- ((Triggering unit) has buff Acid Bomb) Equal to True
-
Actions
- -------- ------------------------------------------- --------
- -------- This is a stop order --------
- -------- It will cause the unit to stop --------
- -------- ----------------------------------- --------
- Unit - Order (Triggering unit) to Stop
-
Events
The last thing is custom script, which are JASS basically in GUI format instead of converting the trigger. Will come up in other tutorials.
Hope you enjoyed this tutorial. More will come. From zero to hero and beyond!
~baassee
Changelog
v1.0 2011-08-18 - Released
v1.0b 2011-08-19 - Fixed a few things mentioned by Pharaoh_, also added a bit more information to a few parts and redid a few sentences. A few hints as been changed as well (more info).
Last edited by a moderator: