Question about triggered spells.

M

Masterfrog

Guest
When doing a triggered spell, well, for example something like:

E: A unit starts the even of an ability
C: Ability being cast = <my spell>
A: If
target of ability being cast is undead
then
make casting unit do 500 damage to target of ability being cast
else
do nothing

That is a spell that would only affect undead. But even if it targeted something that wasn't undead, it would still deduct the mana cost, right? How to make a spell cancel, so it doesn't cost mana if it's not the right target (because the spell wouldn't do anything then)?
 

0cossin77

Yes, I am awesome.
Reaction score
17
Its been awhile, but in the "targets allowed" under the spell options in the object editor, i think its called, only select undead. Then it wont even let you target anything other than undead.
 
F

FullMetalBoy

Guest
Im not sure how to do this in trigger. But u can make a spell that only damage undead with the ability human/holy light in object editor.

The ability target type: Set unable target allies unit.

But since holy light only deal half damage to undead. So make the damage double.

u want: 250 damage
Set to : 500 damage

or u can set your spell only for targeting undead in object editor.
 
M

Masterfrog

Guest
Yes, I know all this. That spell was only an example. I know that what I want is doable with trigger, just now exactly how, and I really need it. I have alot of races in my (too many to to change unit class., you can only cahnge 4 unit class.es anyway). I can make another example where I'll be more specific.

Here is a detailed trigger of how a spell might look like. And that part will surely work. However what I need is an action to put in Else that will cancel the spell before it is cast so it does not deduct any mana from the casting unit.

Code:
Untitled Trigger 004
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Banish
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Substring((Name of (Triggering unit)), 11, 15)) Equal to Human
            Then - Actions
                Unit - Kill (Target unit of ability being cast)
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Substring((Name of (Triggering unit)), 11, 16)) Equal to Undead
            Then - Actions
                Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) + 100.00)
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Substring((Name of (Triggering unit)), 11, 13)) Equal to Orc
            Then - Actions
                Unit - Cause (Casting unit) to damage (Target unit of ability being cast), dealing 500.00 damage of attack type Spells and damage type Normal
            Else - Actions
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
You can add the mana back, with "Unit - Set mana to value".
Though this won't help with cooldowns for example.

Or try with "begins casting" and order it to "stop" if the target isn't valid.
 
M

Masterfrog

Guest
actually it seems I would have to both order him to stop (this makes the animation and special effect not being played) and add the mana. But there's still the cooldown thing. All I can find is Unit - Reset ability Cooldowns, but this affect all of the abilities, so that's no good. Do you think removing then adding the spell again instantly would work?
 

Battlemapsta

I am the Conduit of Change
Reaction score
101
Can't you just use something like..

Conditions
And - All (Conditions) are true
Conditions
(Ability being cast) Equal to Firebolt
((Targeted unit) is Undead) Equal to True

Or have I misread you?
 
M

Masterfrog

Guest
Yes, because that is a classification, and as I then would need a classification for all my races that would make it... 1...5... 9! 9 classifications and possibly more, and you can make as most 4 custom classifications. And besides, the system I use now isn't that bad. Once I've set up one condition for each race, I can just copepaste them.
 
P

Pacos33s

Guest
Re: Question about triggered spells

I did what I think you're trying with a charged spell, so try this:

E-Unit begins casting a spell
C-And
-Ability being cast is <your ability>
A-If/Then/Else
If - Target of ability is not equal to undead
Then - Order unit to stop
Else - Do nothing

What it does with mine is that the unit stops casting (no mana lost and no cooldown used) if the condition is true, but lets the cast continue if it's not true.

PS: Mine is an instant cast spell and uses integers to see if the unit has a "Charge" variable active, but I threw that out and put your undead thing.
 
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