• 🏆 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!

[Solved] The Farther I cast the spell, the longer the delay in effect

Status
Not open for further replies.
Level 2
Joined
Sep 8, 2016
Messages
8
Projectile has an arc of 0.35, but I'm pretty sure that isn't the problem since the effect is being DELAYED at long distances instead of it being early. Spell is based off of cluster rockets.

Works completely fine in short distances. ( <300 )

  • Frag Grenade
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Frag Grenade
    • Actions
      • Set grenade_count = (grenade_count + 1)
      • Set grenade_caster[grenade_count] = (Triggering unit)
      • Set grenade_pos[grenade_count] = (Position of (Triggering unit))
      • Set grenade_targetpos[grenade_count] = (Target point of ability being cast)
      • Set grenade_wait[grenade_count] = ((Distance between (Position of (Triggering unit)) and (Target point of ability being cast)) / 300.00)
      • Wait grenade_wait[grenade_count] seconds
      • Set grenade_index = (grenade_index + 1)
      • Special Effect - Create a special effect at grenade_targetpos[grenade_index] using Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
      • Special Effect - Destroy (Last created special effect)
      • Unit - Cause grenade_caster[grenade_index] to damage circular area after 0.00 seconds of radius 300.00 at grenade_targetpos[grenade_index], dealing 100.00 damage of attack type Spells and damage type Demolition
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • grenade_index Equal to grenade_count
        • Then - Actions
          • Set grenade_count = 0
          • Set grenade_index = 0
        • Else - Actions
          • Do nothing
 
Level 13
Joined
Jan 2, 2016
Messages
973
I see that you have location leaks xP You should start clearing them..
I also notice that once 8191 granades have been cast on your map - the skill will stop working :p

And... "Wait" isn't as accurate as you'd like it to be. The longer the wait - the less accurete it becomes (in multiplayer games).
And are you sure the projectile speed is 300? xP

EDIT: And I also notice, that if a hero/unit casts the skill far away - it will be indexed as (f. ex 3), then another one casts the skill close to it, and it will be indexed as 4.
Then the 4-th one will arrive to its location before the 3-rd one (since it's closer to its destination), thus the wrong unit will deal the damage...
 
Last edited:
Level 8
Joined
Sep 7, 2008
Messages
320
Leak at :
Set grenade_wait[grenade_count] = ((Distance between (Position of (Triggering unit)) and (Target point of ability being cast)) / 300.00)

Suggesttion:
For 1 shoot skill, you should use local variable instead
 
Level 2
Joined
Sep 8, 2016
Messages
8
I see, thanks a lot guys, really eye opening. I have the JASS version of this trigger but it didn't seem to fix the issue I had with it being delayed.

I resorted to using pocket factory to spawn a grenade that expires in 3 seconds, and then I used this trigger:

  • Frag Grenade Explosion
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Grenade (Dummy)
    • Actions
      • Unit - Create 1 Ambush Dummy for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Unit - Cause (Last created unit) to damage circular area after 0.00 seconds of radius 300.00 at (Position of (Triggering unit)), dealing 100.00 damage of attack type Spells and damage type Demolition
      • Special Effect - Create a special effect at (Position of (Triggering unit)) using Objects\Spawnmodels\Other\NeutralBuildingExplosion\NeutralBuildingExplosion.mdl
      • Special Effect - Destroy (Last created special effect)
Works like a charm since it doesn't spawn the grenade until the projectile hits, thanks for the help guys!
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
To make things easy, you have to remove the "Wait" functions from your GUI function list. (Yes, it makes things easier as you will try to use a proper solution... or at least a working one.)

Waits arent synced, so once a wait ends, it has to poll the other clients to see if their waits also ended. (I think this is how it works, but at least it requires some net traffic an syncing stuff.)
Apart from waits not taking game speed into account, they also have a slight delay up to 0.2 seconds in single player, and because of the syncing, it could be 0.2 seconds + sync time (which could be up to 10 seconds if someone has a bad connection) in multiplayer.

IIrc, Cluster Rockets is point targeted instead of unit targeted, so your calculation would be correct (a unit could walk away which increases the total duration).

To do this properly, you could either start a timer with that duration (as it is point targeted), use a missile system and trigger/script the missile's behavior or have a unit targeted spell at a dummy unit and use a DDS to catch the on-hit effect.
Ofcourse, for obvious reasons, the missile system approach is the best one... and sometimes even easier as well.
 
Status
Not open for further replies.
Top