attack - cast spell

velnias

New Member
Reaction score
13
Hello everyone, here my problem.
Everything work correctly, but when my <casting unit> are surrounded many enemy units (enemy units flying overhead of <casting unit>). <Casting unit> stop making attacks and if he stop trigger stop working too.
What wrong?

here the trigger:
Code:
autocast
    Events
        Unit - A unit Is attacked
    Conditions
        ((Attacking unit) is in autocasters) Equal to True
        Or - Any (Conditions) are true
            Conditions
                (Unit-type of (Attacking unit)) Equal to Spellcaster
                (Unit-type of (Attacking unit)) Equal to |cffffcc00Mage|r
    Actions
        Unit - Order (Attacking unit) to Night Elf Dryad - Abolish Magic (Attacked unit)

and picture of <casting unit> and ability in object editor:
http://img131.imageshack.us/my.php?image=inforc4.jpg

ability based on "Abolish magic"


Thanks
 

shinami

Redirect your complaints to the nearest wall
Reaction score
47
Hello everyone, here my problem.
Everything work correctly, but when my <casting unit> are surrounded many enemy units (enemy units flying overhead of <casting unit>). <Casting unit> stop making attacks and if he stop trigger stop working too.
What wrong?

here the trigger:
Code:
autocast
    Events
        Unit - A unit Is attacked
    Conditions
        ((Attacking unit) is in autocasters) Equal to True
        Or - Any (Conditions) are true
            Conditions
                (Unit-type of (Attacking unit)) Equal to Spellcaster
                (Unit-type of (Attacking unit)) Equal to |cffffcc00Mage|r
    Actions
        Unit - Order (Attacking unit) to Night Elf Dryad - Abolish Magic (Attacked unit)

and picture of <casting unit> and ability in object editor:
http://img131.imageshack.us/my.php?image=inforc4.jpg

ability based on "Abolish magic"


Thanks

Didn't quite understand your problem, refraze it please. Or say " I'm sorry, but i'm going to write in Lithuanian" and then tell me whats wrong in Lithuanian. But it would be best to just refraze it.

P.S Where is the casting unit?
 

shinami

Redirect your complaints to the nearest wall
Reaction score
47
O.k so basically he has a bunch of triggers that make sense to him, i tried understanding whats the point of them, but they are not related to this problem.

So what happens he has a priest with an ability called nature that dispels buffs and damages summoned units. It's an autocast.

So when i tried it, it's autocasting as normal so far, then after about 7 autocasts, the icon shows that he is trying to cast, but nothing just happens and he just stand still there.

Well i didn't quite understand whats the problem, so i refrazed so so maybe someone has some ideas.
 

Bloodcount

Starcraft II Moderator
Reaction score
297
what is the spell exactly?

PS:YOu've got to be kiddin me! I haven't sen one single BUlgarian on the forum bu-hu
 

shinami

Redirect your complaints to the nearest wall
Reaction score
47
what is the spell exactly?

PS:YOu've got to be kiddin me! I haven't sen one single BUlgarian on the forum bu-hu

Emm.. Yeaaah.. Were not Bulgarians :D Learn geography.

Anyway the spell is based of abolish magic, need more information, ask.


EDIT: NOOOO! I DOUBLE POSTED BY MISTAKE. Forgive me
 

Bloodcount

Starcraft II Moderator
Reaction score
297
yes, what is the spell supposed to do?

Edit: you didn't double post
Edit:edit geography is my worst subject
 

shinami

Redirect your complaints to the nearest wall
Reaction score
47
yes, what is the spell supposed to do?

Edit: you didn't double post
Edit:edit geography is my worst subject

Look at my posts, i said it dispels positive buffs from an enemy, and negative from allies. Also deals some damage to enemys.

EDIT: I did double post, but i guess some nice mod deleted the second one, for that i thank him.
 

Bloodcount

Starcraft II Moderator
Reaction score
297
That is what abolish magic does.Read this

XII. Single-Target Spells

This is probably the simplest class of spells, when referring to enchancing. These spells are those which target a single, specific target. This means that the player chooses the target and only it is affected by the spell. Such spells include Cripple, Soul Burn, Storm Bolt, Entangling Roots, Rejuvenation, Possession, Holy Light, Death Coil, Life Drain, Siphon Mana, Mana Burn, Shadow Strike, Finger of Death and others.

Note
Chain Lightning, Healing Wave or other chain spells are not single target. Even though the player selects the first target, to trigger the effect, it’s not that easy, because it affects other units, “in chain”. However, they can be used as dummy spells, if they are supposed to hit only 1 target, and do nothing to that one anyway.

For now, we shall stick to non-channeling or buff spells. Once you learn how to make spells of each category, then channeling/buff spells require separate technique, which once learned, you won’t need to struggle with each category again, theoretically of course.

So, let us begin. I’ll start with the theory and then we will make a practical spell. The idea of the Single Target spells is simple. You check whenever a unit casts the custom ability, and then you create dummy units and order them to cast various spells at the target, or damage it, or maybe something else, depending on your spell. That is for the pure effect of the spell. In this tutorial I won’t explain special effects. Maybe I’ll make a separate one later!

And now, we are getting to do a practical example. Here are the basic steps:

Step 1 – The idea of the spell

We are going to make an apparently difficult spell (especially if you haven’t trigger enchanced a spell before) called Shock Destructor (blah, probably not the best name, you can change that if you want). Its description is pretty tricky so here it is:

->The caster emits a bolt of lightning which targets an enemy unit. Depending on its nature, it does a different effect.
-Buildings take damage (50 at level 1, 75 at level 2 and 100 at level 3)
-Mechanical Units are stunned (6 seconds at level 1, 7 at level 2 and 8 at level 3)
-Organic Units are purge (3 seconds at level 1, 4 level 2 and 5 at level 3)

Step 2 – Making the dummy ability, dummy unit and other abilities

Let’s search for a dummy ability. Remember, it must be an instant, single target spell. I have already mentioned most of the spells up, though they are not all instant spells (their effect lasts a couple of seconds and can be dispelled). However, you can make those abilities instant as well. Just set their duration to 0.01 and it will appear as if they were instant.

Note
A duration of 0.00 doesn’t mean no duration, it means that the spell will last forever, or until it is dispelled. It is a convention.

Note
Some abilities, may leave secondary effects even if their duration is almost unnoticeable. Spells that interrupt channeling abilities (cause stun, sleep, silence etc) may be a problem if your spell is not supposed to actually break the channeling. I suggest you avoid those spells as much as possible, unless you intend to break channeling spells anyway!

Now, looking back at the description of the spell, you will notice that I mentioned that The caster emits a bolt of lightning. Hmm, don’t we already have a spell which does this? In fact, we do. Chain Lightning that’s what it does. It causes the caster to emit a bolt of lightning. However, we want this spell to affect only a single target. Make a copy of the spell, and let’s change some of its fields.

First of all, we will make the spell a dummy spell, meaning that it won’t affect the target in a real way. Set the initial damage to 0 for all the levels, number of targets equal to 1 (it would be strange to bounce but affect only the initial target)… and that’s kinda it. If you would test the spell, it would do nothing.

Now its time to make the spell look realistic. Leaving the old Chain Lightning description, name and icons would make the player think that he is casting Chain Lightning. So change its name to Shock Destructor, all descriptions accordingly, and I would even saw that you change the icon. I for one used the Dark Portal ability icon, but these stuff really don’t matter. Make it look convincing!

And now, we still have some technical things to solve. The spell has the old mana cost and cooldown of Chain Lightning. I have thought as some values, but you may change them as you like, to make the spell balanced. The mana cost I chose is 70/65/55 (level 1/level 2/level 3) and the cooldown 8/8/8. One last thing to change are the targets. Chain Lightning affects only organic targets. Here are the valid targets I gave (and you’d better follow them): Air, Ground, Enemy, Organic, Structure, Mechanical, Vulnerable. Its good to give all the values you find valid to your spell. In this case, not giving Vulnerable may not cause the spell to be cast on Invulnerable units anyway, but you shouldn’t risk. Some spells may have this field bugged.

You can now give the ability to a hero and test it. It will look extremely realistic, but if you order the hero to cast it, you will only get a unit struck by a bolt of lightning, with no consequences, but mana lost and a cooldown fired. It’s a promising start though. Let’s get back to the Object Editor, since we ain’t done.

We will have to give some abilities to the dummy units. We need a single-target ability that stuns (I suggest Storm Bolt) and Purge (the description was kinda obvious). Copy-paste both the abilities, and edit them in the following way.

-> Make them 3 level abilities, but leave them unit abilities.
-> Change their mana cost to 0/0/0, duration to 3/3/3 (usually a high value so you can assure that the dummy unit is able to cast it only when ordered and not again unwillingly), their duration to how long the spell is supposed to affect the target and you should even change their buffs.
-> Watch out for targets. Make sure that the dummy unit is able to cast the ability on the valid unit. In this case, make sure Storm Bolt can target Enemy, Mechanical units and that Purge can target Enemy, Organic units.
-> Icons and descriptions usually should be left blank, because you won’t see them anyway
-> To know for which spells you use the custom abilities, I would suggest that you add an editor suffix, with the name of the dummy spell. In this way, it will make life easier for you. In this case, I got Purge (Shock Destructor) and Storm Bolt (Shock Destructor)

And last but not least, don’t forget the dummy unit. If you don’t remember how to make a dummy unit, go back to chapter 3 and get the instructions from there.

Note: If you're reading this tutorial from the World Edit Tutorials page you should now click here to view the full version.
Last edited by SFilip; September 29th, 2007 at 07:23 PM.
Reply With Quote Multi-Quote This Message Quick reply to this message
Daelin
View Public Profile
Send a private message to Daelin
Visit Daelin's homepage!
Find all posts by Daelin
Add Daelin to Your Contacts
#2 Add to Daelin's Reputation Report Post
Old December 26th, 2005, 10:27 AM
Daelin's Avatar
Daelin Daelin is offline
Kelani Mage

Join Date: Sep 2005
Location: Romania
Posts: 464
Daelin <--- Pretty Cool (+500)Daelin <--- Pretty Cool (+500)Daelin <--- Pretty Cool (+500)Daelin <--- Pretty Cool (+500)Daelin <--- Pretty Cool (+500)Daelin <--- Pretty Cool (+500)
Send a message via AIM to Daelin
(Offtopic note: I can't post the whole tutorial into a single post, because it's too long).

Step 3 – Trigger Enchancing the Ability

Probably the hardest step. It may even seem scary, but in truth, it is not. Let’s take the code step by step. We need events, conditions and actions. If you don’t remember how any of these work, please reread the previous chapter, until you fully understand how triggers work. Do not skip those chapter, because they are extremely important to comprehend trigger enchancing. Keep reading and trying to understand them until you are completely sure you know how triggers work.

Create a new trigger. Again, I suggest that you give triggers the name of your spell (if you need more than one trigger follow them name by something else too), so you can recognize them later, if you ever want to change your spell. It is very important to keep an order into both the object editor and the trigger editor.

Now, we know that this trigger should activate when an unit casts Shock Destructor. In code, it would look like this:

Code:

Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Shock Destructor

It’s nothing new, if you have read chapter VIII. The basic event, the basic condition. Now, let’s get deeper to actions, where things get messy. We know that we need a dummy unit, to either damage or cast an ability at the target. So, create a dummy unit at the position of the target, which belongs to the caster. Moreover, the unit should disappear after a short period of time, so it would be good to add it an expiration timer with a very short life value. The action would look like this:

Code:

Unit - Create 1 Dummy for (Owner of (Triggering unit)) at (Position of (Target unit of ability being cast)) facing 0.00 degrees
Unit - Add a 1.50 second Generic expiration timer to (Last created unit)

Now, things get more complicated, because depending on the type of the target (organic, mechanical or building), the dummy does something. It is clear that this is the step where things get different for each single-target spell. We are going to use multiple Ifs, each to check if the target is Organic, or Mechanical or Building. I don’t suggest you insert in the else of an if another IF because you may slowly realize that you get nothing from the code, especially when more complicated codes come out.

So, we will start with the first IF. It checks if the target is a building, and if it is, it damages the target. However, for the damage you need a formula, because if the level of the ability is bigger, then the damage is bigger as well. So your formula must depend on the level of the ability. Let’s have a look at the damage:

50 for level 1, 75 for level 2 and 100 for level 3. It is clear that with each level, the damage increases by 25. This difference between levels MUST be a constant if you want to use a formula. The difference is called Ratio. Usually the formula is something like this:

Code:

(Level 1 damage – Ratio)+(Ratio*Level of the Ability)

And suddenly things are getting simpler eh? In code, the formula would look like this:

Code:

Damage = (50-25)+(25*(Current Level of (Shocking Destructor) for (Triggering Unit))

This formula can even be simplified, to ease the work of the PC and make your spell more efficient. You already know that 50-25 is 25. Instead of putting the game calculate it everytime the spell targets a building, do it yourself. It doesn’t cost you anything, but it does the PC. Make your formula as efficient as possible!

Now that we have the formula, the next step of the action is just implementing what you learned. Here is what you should get:

Code:

If (((Target unit of ability being cast) is A structure) Equal to True) then do (Unit - Order (Last created unit) to damage (Target unit of ability being cast) for (25.00 + (25.00 x (Real((Level of Shock Destructor for (Triggering unit)))))) using attack type Magic and damage type Fire.) else do (Do nothing)

Real() makes a conversion to real. In this case, I converted an integer, because in an operation you can use numbers of the same type (real or integer) but you can’t mix them. In this case, the damage is supposed to be real so since (Level of Ability for unit) function returns an integer value, you have to convert it yourself. You will encounter this a lot.

Now if you will test your ability on a building, that building will get damaged! However, we still need to make it affect organic and mechanical units. Here, the theory is the same, just that you use different abilities. So I will explain only for organic.

You have to give the dummy unit the custom purge ability, and order it to cast it at the target. But once again, the spell should last more for each level. Still, I didn’t ask you to give the spell three levels for nothing. And if you remember, there is an action which allows you to set the level of normal abilities too. So all you have to do, is give purge ability to the dummy, set its level to the level of Shock Destructor, and order the dummy to cast it at the target. An organic unit is that unit which isn’t either mechanical or structure. Here is the code:

Code:

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) is A structure) Equal to False
((Triggering unit) is Mechanical) Equal to False
Then - Actions
Unit - Add Purge (Shock Destructor) to (Last created unit)
Unit - Set Level of Purge (Shock Destructor) for (Last created unit) to (Level of Shock Destructor for (Triggering unit))
Unit - Order (Last created unit) to Orc Shaman - Purge (Target unit of ability being cast)
Else - Actions

Now change this code for Mechanical Units. Down you can see the complete code. If you’ve copied it correctly, the spell should work:

Code:

Shock Destructor
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Shock Destructor
Actions
Unit - Create 1 Dummy for (Owner of (Triggering unit)) at (Position of (Target unit of ability being cast)) facing 0.00 degrees
Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
If (((Target unit of ability being cast) is A structure) Equal to True) then do (Unit - Order (Last created unit) to damage (Target unit of ability being cast) for (25.00 + (25.00 x (Real((Level of Shock Destructor for (Triggering unit)))))) using attack type Magic and damage type Fire.) else do (Do nothing)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) is A structure) Equal to False
((Triggering unit) is Mechanical) Equal to False
Then - Actions
Unit - Add Purge (Shock Destructor) to (Last created unit)
Unit - Set Level of Purge (Shock Destructor) for (Last created unit) to (Level of Shock Destructor) for (Triggering unit))
Unit - Order (Last created unit) to Orc Shaman - Purge (Target unit of ability being cast)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) is Mechanical) Equal to True
Then - Actions
Unit - Add Storm Bolt (Shock Destructor) to (Last created unit)
Unit - Set Level of Storm Bolt (Shock Destructor) for (Last created unit) to (Level of Shock Destructor for (Triggering unit))
Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Target unit of ability being cast)
Else - Actions

Congratulations, you have completed your first trigger enchanced spell! As you will practice, you will be able to do more complicated single target spells. But now, it’s time to get to the second category.
 

shinami

Redirect your complaints to the nearest wall
Reaction score
47
Never mind, problem was solved. :D

Not sure how, but he did something random and it worked.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top