• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

(Help) Agility-based stun duration

Status
Not open for further replies.
Level 1
Joined
Mar 8, 2008
Messages
3
Hello,
I've been trying to figure out how I could make a spell that stuns for a duration that's based on the caster's agility, however, I've tried a few different ways (all I could think of) using triggers (due to my lack of JASS knowledge) and none seem to work perfectly.

The idea is basically to have a ranger-type character shoot an arrow straight in front that stuns everything in its path for a duration that's agility-based (and deals agility-based damage as well - but I'll be fine for that part). The stun duration formula I took was d = 0.23a^(0.5), where d is the stun duration and a is the agility of the caster and that part seems to work fine in every case. The spell is based on Impale.

This is the closest I got to making it work :

  • Concussive Shot
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Concussive Shot
    • Actions
      • Set ConcussiveShotTimer = (0.23 x (Power((Real((Agility of (Casting unit) (Include bonuses)))), 0.50)))
      • Trigger - Run Concussive Shot group <gen> (ignoring conditions)
  • Concussive Shot group
    • Events
    • Conditions
    • Actions
      • Custom script: local real udg_ConcussiveShotTimer2
      • Set ConcussiveShotTimer2 = ConcussiveShotTimer
      • Wait 0.50 seconds
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((((Matching unit) has buff Concussive Shot ) Equal to True) and ((Number of units in (Units within 20.00 of (Position of (Matching unit)) matching ((Unit-type of (Matching unit)) Equal to Concussive Shot Placeholder))) and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Concussive Shot Placeholder for Player 1 (Red) at (Position of (Picked unit)) facing Default building facing degrees
          • Unit - Add a ConcussiveShotTimer second Generic expiration timer to (Last created unit)
These 2 triggers can probably be merged together, but I (miserably) failed to do so correctly, so I left it that way

  • Concussive Shot Expire
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Concussive Shot Placeholder
    • Actions
      • Unit Group - Pick every unit in (Units within 15.00 of (Position of (Dying unit))) and do (Actions)
        • Loop - Actions
          • Unit - Remove Concussive Shot buff from (Picked unit)

These 3 triggers work when the spell hits only a single target (it worked on a few tries on multiple targets, but I couldn't figure out exactly why). The Concussive Shot Placeholder unit is an invisible, unselectable 0-collision, walkable unit that cannot move or attack. (I've been thinking that unit might actually be the problem, if it's not trigger-related; if the triggers are fine, I might have missed changing something on that unit, though I can't personally find what. The information I posted is what I believe has some importance in these triggers.) That was my most fruitful attempt.

Here's the first thing I tried; in case it could work just by fixing this small trigger a little bit (my few other attempts are not worth mentioning; they're only slight modifications to the 3 triggers above, which didn't work) :

  • Concussive Shot stun
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Concussive Shot
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) has buff Concussive Shot ) Equal to True)) and do (Actions)
        • Loop - Actions
          • Wait (0.23 x (Power((Real((Agility of (Casting unit) (Include bonuses)))), 0.50))) seconds
          • Unit - Remove Concussive Shot buff from (Picked Unit)

Any suggestion is welcome :cgrin:. Thanks in advance!

Oh and for the record, my skills with WE aren't very much better than this, and my skills in JASS are limited to one single line: local <variable type> udg_<variable name>, so my apologies if I failed at going further than this.
 
Last edited:
Level 3
Joined
Mar 2, 2008
Messages
62
could probably do it with one trigger... have the concussive shot be based on breath of fire, with a buff of duration 3 or so seconds. then:

  • Concussive Shot
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Concussive Shot
    • Actions
      • Wait 0.30 seconds
      • Unit Group - Pick every unit in (Units within 1000.00 of (Position of (Triggering unit)) matching (((Matching unit) has buff Concussive Shot) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Footman for (Owner of (Triggering unit)) at (Position of (Picked unit)) facing Default building facing degrees
          • Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Picked unit)
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Wait (Square root((0.23 x (Real((Agility of (Triggering unit) (Include bonuses))))))) seconds
      • Unit Group - Pick every unit in (Units within 1800.00 of (Position of (Triggering unit)) matching (((Matching unit) has buff Concussive Shot Stun) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Remove Concussive Shot Stun buff from (Picked unit)
need to do it that way, wait functions dont mix with unit group functions. the dummy has a storm bolt with infinite stun and buff Concussive Shot Stun. change the pick units in x range to the casting range for ther first one, and casting range + however far the ranger can run/move in the stun duration.

hope that last part made sense
 
Level 1
Joined
Mar 8, 2008
Messages
3
This seems to work, however, would that trigger cause conflicts if there were more than 1 unit capable of casting this spell on the map (i.e. if 2 of them cast the spell at the same time or such situations)? If so, I'd like to get a hint on how to fix the issue.

And if possible, I'd like to know what's wrong in the first 3 triggers; which part causes conflicts when more than 1 unit is affected by a single cast of the spell?

Thanks a lot for the help, much appreciated :csmile:
 
Level 3
Joined
Mar 2, 2008
Messages
62
that ability should be able to run with multiple casts, but you might have some issues with stun duration if two units cast it too close to one another. it can be done perfectly using JASS, but i dont know how to do that.

and your probably didnt work because you used a global variable, meaning any future casts will mess up that original one. and using a wait action inside a 'pick every unit' loop is rather messy. it waits, affects one unit, and repeats. ie waiting a long time.

and np, happy to help :grin:
 
Level 3
Joined
Oct 19, 2007
Messages
51
Well, I could think of a couple ways to do this. You could make a stun spell with a stun length of .5, and have a dummy unit constantly cast it until it expires, and have the expiration timer depend on the amount of agility.

Alternatively, you could just have the dummy have a version of aerial shackles with the art changed to the normal stun swirl or whatever you want, again using an expiration timer to control the length.

That should do you, but if you need code written, I can post something later. That is, of course, if you need it.
 
Level 1
Joined
Mar 8, 2008
Messages
3
I like your idea of using Aerial Shackles, as I think it would fix possible duration issues caused by multiple casts. This following part could also become a problem, if the caster somehow manages to run out of the set range:
  • Unit Group - Pick every unit in (Units within 1800.00 of (Position of (Triggering unit)) matching (((Matching unit) has buff Concussive Shot Stun) Equal to True)) and do (Actions)
  • Loop - Actions
  • Unit - Remove Concussive Shot Stun buff from (Picked unit)
I'll try it out when I get some time. The trigger would probably be something like this, I think:

  • Events
  • Unit - A unit Starts the effect of an ability
  • Conditions
  • (Ability being cast) Equal to Concussive Shot
  • Actions
  • Wait 0.30 seconds
  • Unit Group - Pick every unit in (Units within 1000.00 of (Position of (Triggering unit)) matching (((Matching unit) has buff Concussive Shot) Equal to True)) and do (Actions)
  • Loop - Actions
    • Unit - Create 1 ConcussiveShotDummy for (Owner of (Triggering unit)) at (Position of (Picked unit)) facing Default building facing degrees
    • Unit - Order (Last created unit) to Human Dragonhawk - Cast Aerial Shackles(Picked unit)
    • Unit - Add a (Square root((0.23 x (Real((Agility of (Triggering unit) (Include bonuses))))))) second Generic expiration timer to (Last created unit)
(sorry for the shitty formatting, this doesn't come from WE, as I don't have time to work on it at the moment)

Thanks a lot :csmile:
 
Level 3
Joined
Oct 19, 2007
Messages
51
In your "pick every unit in 1000 range" loop, that could cause issues with multiple instances in the same range...stunning one unit, then stunning another before the first stun is up would reset the length of the original stun...

You only want to pick one unit, so you should not deal with a group at all (saves you leaks too!)

Can't you say "at position of triggering unit" or "target of spell being cast" or somesuch? (As opposed to picked unit, doing away with the loop entirely)

I'm not sure how the functions work exactly, but I'm pretty sure there's some function that returns the unit with the buff. The question is "does a unit starts the effect of an ability" refer to the unit gaining the buff from your stun skill, or the unit causing the effect? If it's the former, you can get rid of the loop and change "Picked unit" to "triggering unit". If it's the latter, you should have some option like "Targetted unit" or somesuch similar event response.
 
Status
Not open for further replies.
Top