Units are damaged too soon

Solu9

You can change this now in User CP.
Reaction score
216
The trigger:

Trigger:
  • Frag Grenade
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Frag Nade
    • Actions
      • Unit Group - Pick every unit in (Units within 200.00 of (Position of (Target unit of ability being cast))) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Equal to Neutral Hostile
            • Then - Actions
              • Unit - Cause (Casting unit) to damage (Picked unit), dealing 80.00 damage of attack type Magic and damage type Fire
            • Else - Actions


The Frag Nade ability is based on Storm Bolt.
Missile Arc: 0.50
Missile Art: Custom Grenade Model (A simple nade)
Homing Enabled: True
Missile Speed: 500

Damage: 80
AoE: 0
Buffs: Stunned (pause)
Cast Range: 600
Casting Time: 0
Cooldown: 5
Duration Unit: 1
Duration Hero: 1

The ability kinda works as it should. But the picked units are damaged when the target is selected, and thats before the missile even is "thrown". So the grenade lands when all of the units already have been damaged.
 

Sayiain

You can change this now in User CP.
Reaction score
0
I don't know how to do it, but I suggest to add WAIT action until the missile reaches the target.
You can get the moment by adding:
<time from start ability casting to sending the missile> + <distance from hero to target unit / missile speed>
 

Solu9

You can change this now in User CP.
Reaction score
216
Good suggestion.
The problem with wait is that the Frag Grenade is an item, thus more than one unit can cast at the same time, which will mess the wait up.

Edit: Oh, and I know the unit group is leaking.
 

Enki

New Member
Reaction score
0
Create a dummy at target location and check if that dummy is damaged with your storm bolt then trigger the aoe damage.
 

luorax

Invasion in Duskwood
Reaction score
67
Start a timer at the map init with something like 0.1 sec expiration time and create a unit group (well, the less the expiration time, the faster it detects the buff, but the higher the chance to cause lag on spamming the item; but 0.1 is fine IMO). Each time it expires enum all units in the group and check if they have your Storm Bolt stun buff. If they have then do the AoE damage.
Each time a unit uses your Frag Grenade item add the target unit to the group.

It's so simple. (Well, it took me a while to figure out a way in GUI - in vJASS with a custom projectile system it's like 1,2,3 DONE!)
 

Solu9

You can change this now in User CP.
Reaction score
216
Start a timer at the map init with something like 0.1 sec expiration time and create a unit group (well, the less the expiration time, the faster it detects the buff, but the higher the chance to cause lag on spamming the item; but 0.1 is fine IMO). Each time it expires enum all units in the group and check if they have your Storm Bolt stun buff. If they have then do the AoE damage.
Each time a unit uses your Frag Grenade item add the target unit to the group.

It's so simple. (Well, it took me a while to figure out a way in GUI - in vJASS with a custom projectile system it's like 1,2,3 DONE!)

Unit group = units within the 200 of the targeting unit right?

Because enemy units will not be in the map from the beginning but spawn as the story unfolds.
And is it a standard timer or a periodic timer we are talking here?

Uhm, if you could give an example that would be great. I'm one of those people who learn better from seeing it done on beforehand rather than getting the theory explained :)
 

luorax

Invasion in Duskwood
Reaction score
67
Well, something like this:

Trigger:
  • Frag Grenade Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Frag_Grenade_Hashtable = (Last created hashtable)


Trigger:
  • Frag Grenade Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Storm Bolt
    • Actions
      • Unit Group - Add (Target unit of ability being cast) to Frag_Grenade_CheckGroup
      • Hashtable - Save Handle Of(Triggering unit) as (Key of (Target unit of ability being cast)) of 0 in Frag_Grenade_Hashtable


Trigger:
  • Frag Grenade Periodic
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Frag_Grenade_CheckGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Stunned (Pause)) Equal to True
            • Then - Actions
              • Unit Group - Remove (Picked unit) from Frag_Grenade_CheckGroup
              • Set Frag_Grenade_EnumPoint = (Position of (Picked unit))
              • Set Frag_Grenade_EnumGroup = (Units within 200.00 of Frag_Grenade_EnumPoint matching ((Owner of (Matching unit)) Equal to Neutral Hostile))
              • Unit Group - Pick every unit in Frag_Grenade_EnumGroup and do (Actions)
                • Loop - Actions
                  • Unit - Cause (Load (Key of Picked unit) of 0 in Frag_Grenade_Hashtable) to damage (Picked unit), dealing 80.00 damage of attack type Magic and damage type Fire
              • Custom script: call DestroyGroup(udg_Frag_Grenade_EnumGroup)
              • Custom script: call RemoveLocation(udg_Frag_Grenade_EnumPoint)
            • Else - Actions


However I've not written anything in GUI for a while...
 

Solu9

You can change this now in User CP.
Reaction score
216
Wow... I think I'm going to use that trigger. However it seems awful complicated considering what it does.
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
I would have thought that modifying Acid Bomb to damage in a micro-interval would have done the trick.
 

inevit4ble

Well-Known Member
Reaction score
38
With spells similar to this I use "Create x Unit" and order it to attack the target (and make it unable to be selected etc) and detect when it attacks then do the damage effect
 

Solu9

You can change this now in User CP.
Reaction score
216
I would have thought that modifying Acid Bomb to damage in a micro-interval would have done the trick.

I've tried with Acid Bomb but for some reason it lagged when it was thrown. It is the ideal spell to make this from.
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
Well, I tried it myself, and strangely the damage dealt is variable. Damage was set to 150, Damage Interval at 0.01 and Duration - Hero/Normal were both 0.02. Sometimes it did 150 damage, other times it did 300. So I guess triggering it is necessary.
 
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