• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Proccing spells - chance to cast on attack

Status
Not open for further replies.
Level 2
Joined
Sep 1, 2009
Messages
7
Proccing spells - chance to cast on attack - need new approach not listed in forums

I've been trying to update (that is, "recreate") a RoC Tower Defense into a TFT version, and add some new abilities with the enhanced editor.

Our team's hope is that we will be able to have some towers have a chance to cast spells on their attacks (that is, proc spells like chain lightning, cripple, etc.). The only auto-cast spells that seem to trigger without the caster being attacked (that I can find) are Bloodlust and the missile enhancers (searing arrows, cold arrows, black arrow, parasite, orb of annihilation, etc.), and I know of no way to adjust these to cast a spell like Chain Lightning, and suspect it might be impossible.

The standard approach to proc a spell on attack is to write some triggers based on "whenever a unit takes damage" which then runs a check as to the damage source to decide if an additional spell should be triggered. However, with a Tower Defense, it has been our experience that many towers attacking many units and running a trigger like this often would be a sure fire way to lag the game into unplayability. :cry:

The second approach to accomplish something like this is to use the "Orb of Lightning" and adjust the spell from Purge to whatever we want. This would be a highly promising approach, if not for the bug that causes the spells to never proc when the attacking unit is auto-attacking (rather than force-attacking a specific unit or ground).

My recent attempts at forcing a tower to effectively use the proccing ability on a modified Orb of Lightning were somewhat promising at first. I gave the tower an inventory (for ease of testing) and used the modified orbs, but at first the only way I could get the spells to proc was if I force-attacked a specific unit, and such micro-management is not in the spirit of a tower defense. :thumbs_down:

Secondly, I attempted to give the tower the ability to force-attack-ground (as a melee unit would, not as an artillery unit would) by giving the tower the impression it could move. (Towers will complain about distant ground being "out of range" if they have no movement.) This worked great initially, as I had test targets within range of the tower, but further testing showed that the towers would move with 1 movement speed when targets were not in range, despite attempting to decrease their movement speed by 100% through aura buffs (Tornado) and upgrades (Ghoul Frenzy) and having set the gameplay constant for the minimum movement speed of buildings to 0.

I thought I might be able to modify Entangling Roots to take advantage of the forced inability to move. Throwing the Entangling Roots buff onto an aura I believe causes the same problem as before - the towers can still move with 1 movement speed. Forcibly casting Entangling Roots on the tower will disable its ability to move, but it also disables its ability to attack, and without the ability to attack the spells will not be able to be procced by the Orb of Lightning. (Note: Mixing an Entangling Roots aura buff with a direct cast of Entangling Roots caused TFT to horribly crash, and should be avoided. :hohum:)

So, I am potentially looking for a few things, but any solution that causes lag is worthless to us:

  1. A way of auto-casting Chain Lightning on enemy units that are not attacking the caster.
  2. A way to trigger a spell on an attack from a specific tower without the lag caused by running a trigger for every attack from every tower to every unit in the game.
  3. A way to allow an immobile tower to attack-ground outside of its range, possibly by giving the tower positive base-movement, only to disable the movement, while maintaining the attack-ground option.
  4. A way to continue to allow the ability to attack while under the Entangling Roots spell, while keeping the incapacitation of movement.
  5. A creative non-laggy approach to our problem that I have not considered.

Honestly, I am pissed off at Blizzard that they never bothered to make something like Searing Arrows that triggered direct spells when the missile struck. :angry: Additionally their voodoo magic in the Orb of Lightning is restricted to force-attacks, which makes no sense to me. :confused: It seems like life would be a lot easier for map makers if one of these two problems were fixed.

This is my first venture into this forum, and if you guys can solve my problem, I will love you forever. :cute:
 
Last edited:
Level 2
Joined
Sep 1, 2009
Messages
7
Anyone out there?

I've been wondering if a trigger which caught towers casting modified versions of Bloodlust (which might autocast properly, being based on a spell which autocasts even when the caster is not under attack) then triggering the desired spell upon detection, might just work out without horribly lagging the world.

What do you guys think?

It's ok if you respond with "there is no other way I know of besides ______."

It'd be nice to know that a few people put some thought into my problem, even if they could not contribute anything new.
 
Level 7
Joined
Jun 14, 2009
Messages
235
Im a ittle confused on what you mean, are you saying you want it so you can auto cast spells, like chain lightning, with out the unit attacking the tower? If so then I think this will work (i assume you know how dummy units work)

  • Events
    • Unit - A unit is attacked
  • Conditions
    • Unit type of attacking unit is "Lightning Tower"
  • Action
    • Create 1 Dummy for owner of attacking unit at position of attacking unit
    • Add 3 second Water Elemental timer to last created unit
    • Give "Chain Lightning" to last created unit
    • Order last created unit to Orc Far Seer - Chain Lightning attacked unit.
THis should make it look like the tower is casting chain lightning, you can set an ability level for diffrent effects, and use a dummy icon (like an edited Flying machine bombs to show it will chain lightning)
 
Level 6
Joined
May 1, 2009
Messages
215
Well, for chain lightning, all you need is to spawn a locust unit with a huntress bounce attack and give it lightning art. You could have this unit spawn through:

A) From a black arrow ability (you could call it, "Static Explosion: Units killed by this tower explode, casting chain lightning on a nearby enemy unit.", of course it's not chain lightning, but who'll know the difference?)

B) Parasite Variation

Of course, you want a "proc" attack which implies you want it to happen % of the time. Really I don't think there's anyway to accomplish this without Triggers if you want it like that. JASS might be best suited for this, if you're really worried about leaks, so I'd suggest finding a JASSer.

But I'm skeptical that a "unit is attacked, spawn dummy unit, cast chain lightning at attacked unit" type trigger would cause massive lag, even if it's ocurring a lot in a TD. As long as you get rid of the leaks (the position where the unit is spawned), it should be fine right? You should make a trigger you think will leak, put it on a single tower, and put a whole bunch of those towers in a line, then spawn units continuously through triggers. Leave the game running and return 30-60 mins later, monitor for lag. If it's laggy, there's a problem, if it's not laggy, you can proceed further, trying another tower and seeing if there's any lag, etc.
 
Level 11
Joined
May 31, 2008
Messages
698
Making a huntress with a bounce attack would give no benefit over simply using a chain lightning spell, neither of them should cause lag and the only difference is that you order a unit to cast an ability rather than attack. JASS is also not necessary, finding and removing leaks really isnt hard and doesnt require testing, you just have to look. go to the Thingds that leak thread to learn how to identify/remove leaks.

Also u said u were using the entangling roots thing to disable the "moving tower". I would try ensnare because im pretty sure that doesnt disable attack. Hope i helped
 
Level 2
Joined
Sep 1, 2009
Messages
7
Possible solution :-D

Killd0zer, Battle_Shipper, wolfman, and FlowerofSpeech - many thanks for the ideas. :smile:

Our team is desperately attempting to avoid running a trigger like this:
  • Events
    • Unit - A unit is attacked
In a tower defense, there are a lot of towers attacking a lot of units, and that trigger would run unnecessarily way too often, and we fear it would cause lag. We've made great efforts to allow our map to run even on old machines without lag. It is something our JASS coder prides himself on.

We're open to a few different solutions to our problem of automatically casting spells. Here are the most promising:

  • Autocasting - towers will briefly pause attacking to cast a spell:
    • Modify a copy of Bloodlust to do nothing (which will still autocast when hostiles are within combat attack range, even when the hostiles are not attacking the tower)
    • use a trigger to catch whenever the tower uses this spell, and then force the tower to use the spell you really want it to cast via triggers.
  • Proccing - A chance to cast a spell on each attack:
    • Modify the item Orb of Slow/Lightning to use a modified ability Orb of Slow/Lightning (new), with the Data - Effect Ability adjusted to the spell you really want to cast when your tower attacks.
    • If your tower is given an inventory, and you write a trigger to place this item in its inventory, it will proc the spell you want whenever you force-attack a specific unit (or an area, though immobile towers cannot do this), but it will never proc the spell when the tower auto-attacks nearby units.
    • If you give your tower 1 movement speed, it will gain the ability to attack an area, which will allow your proccing to take effect. However, no one wants their towers marching ever-so-slowly across the map, so if you also have a trigger that immediately casts a very long modified version of Ensnare, the tower will be able to be told to attack-area (via a trigger), but will not be able to move.

In the second solution, if some chump takes the tower and overrides the attack-area command, the tower will stop proccing the spell on attack until the attack-area command is reenacted, but I am willing to live with that.

Wolfman's suggestion that I try Ensnare has looked like it works in initial testing. :thumbs_up:

I don't know how the Rep system works, but I think Wolfman directly helped to solve our problem, so perhaps he deserves something for it. Is +Rep appropriate?
 
Level 6
Joined
May 1, 2009
Messages
215
Making a huntress with a bounce attack would give no benefit over simply using a chain lightning spell, neither of them should cause lag and the only difference is that you order a unit to cast an ability rather than attack. JASS is also not necessary, finding and removing leaks really isnt hard and doesnt require testing, you just have to look. go to the Thingds that leak thread to learn how to identify/remove leaks.

Of course I know that, but the OP is under the impression that using a trigger will cause lag. I was suggesting he experiment and really see if that's the case.

While I'm happy you guys found a solution I'm still goin to advocate that you do some testing, just to see if you'll really have lag with a trigger running all the time. I seriously doubt it, but testing could really give you a definitive answer and you could save yourselves the trouble of using a weird system.
 
Level 3
Joined
Aug 6, 2009
Messages
45
Use a modified spell like bloostlust with duration 0.01 and targets: enemies
and make a trigger.

  • Bloodlust
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to YourSpell
      • (Triggering unit) Equal to YourTower
    • Actions
      • Set Chance = (Random integer number between 1 and 10)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • Chance Equal to 1
              • Chance Equal to 2
        • Then - Actions
          • Unit - Unit - Order (Triggering unit) to Orc Far Seer - Chain Lightning (Target unit of ability being cast)
        • Else - Actions
This should work and give a 20% chance per bloodlust, so give bloodlust a smaller cooldown. If you want it to not have a chance use
  • Bloodlust
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to YourSpell
      • (Triggering unit) Equal to YourTower
    • Actions
      • Unit - Order (Triggering unit) to Orc Far Seer - Chain Lightning (Target unit of ability being cast)
I used 'Orc Far Seer - Chain lightning' at the end because triggers work off orderstrings don't they, not names?
So you'd have to make chain lightning stronger and one for each rank of tower or something.
I have really no idea how to make a trigger cast a spell, or order a unit to cast a custom spell, so could someone help me with that for tasty rep cookies?

Anyway that's just my guess :)
 
Level 5
Joined
Mar 17, 2005
Messages
135
I may have misunderstood, but about the autocasting chain lightning.

Couldn't you just use the orb effect to cast chain lightning? Just change the ability of the Orb of Lightning to cast chain of lightning instead of purge. You could give it whatever percent you want and it does not use triggers.
 
Level 3
Joined
Aug 6, 2009
Messages
45
He said previously, that Orb of Lightning only proc's on Forced attacks, not just random attacks
(Forced attacks means when you right click)

My recent attempts at forcing a tower to effectively use the proccing ability on a modified Orb of Lightning were somewhat promising at first. I gave the tower an inventory (for ease of testing) and used the modified orbs, but at first the only way I could get the spells to proc was if I force-attacked a specific unit, and such micro-management is not in the spirit of a tower defense.
 
Status
Not open for further replies.
Top