Invunarable problem?

Status
Not open for further replies.
Level 11
Joined
Jun 26, 2014
Messages
513
  • Voodo Shield
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Voodo Shield
    • Actions
      • Set temp_voodoshield = (Position of (Triggering unit))
      • Unit Group - Pick every unit in (Units within 1000.00 of temp_voodoshield) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A peon-type unit) Equal to True
            • Then - Actions
              • Unit - Make (Picked unit) Invulnerable
              • Wait 10.00 seconds
              • Unit - Make (Picked unit) Vulnerable
            • Else - Actions
The idea is, when I activate the "Voodo Shield" from my town hall every peon should be invunarable and it works, but after 10 seconds they have to be vunarable again but they don't, they stay invunarable. Does anyone know why?
 
Level 12
Joined
May 22, 2015
Messages
1,051
You can't use wait like that because it doesn't know who "picked unit" is by the time the wait is done.

What you could do is save the group into a variable, do the loop as is, except without the wait and without the removing invulnerable part. Then have a the wait after the loop. Then do the loop again over the same group (using the variable) and remove invulnerable.

You would have to work out which town hall owns which group so that you don't overlap and cause bugs.

--------------------------------------------------

Another solution could be to temporarily give those peons an inventory (if they don't have one normally) and give them a powerup that has divine shield on it.
 
Level 11
Joined
Jun 26, 2014
Messages
513
You can't use wait like that because it doesn't know who "picked unit" is by the time the wait is done.

What you could do is save the group into a variable, do the loop as is, except without the wait and without the removing invulnerable part. Then have a the wait after the loop. Then do the loop again over the same group (using the variable) and remove invulnerable.

You would have to work out which town hall owns which group so that you don't overlap and cause bugs.

--------------------------------------------------

Another solution could be to temporarily give those peons an inventory (if they don't have one normally) and give them a powerup that has divine shield on it.

Could you post the triggers please?
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
"
icon5.gif
Invunarable problem?"
Now I have a question ofcourse... how can a problem be invulnerable?

  • Voodo Shield
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Voodo Shield
    • Actions
      • Custom script: local group udg_TempGroup
      • -------- - --------
      • Set TempLocation = (Position of (Triggering unit))
      • Set TempGroup = (Units within 1000.00 of TempLocation)
      • Custom script: call RemoveLocation(udg_TempLocation)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is A peon-type unit) Equal to True
            • Then - Actions
              • Unit - Make (Picked unit) Invulnerable
            • Else - Actions
              • Unit Group - Remove (Picked unit) from TempGroup
      • Wait 10.00 game-time seconds
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Unit - Make (Picked unit) Vulnerable
      • Custom script: call DestroyGroup(udg_TempGroup)
      • -------- - --------
      • Custom script: set udg_TempGroup = null
Because of the local group custom script, the variable TempGroup is a different variable than the global one.
So it will not be overwritten during the wait.
Also, the wait leaks a timer handle so you should have a custom script to do the wait. But that doesnt really matter for now.
 
Level 24
Joined
Aug 1, 2013
Messages
4,658
That trigger only leaks a timer handle.
And only once per cast.
(Already mentioned that and "I don't think leaking this would be a problem because it's not going to be used very often" is enough for me.)

The inaccurracy in waits is hard to notice in these numbers (as it will be something like 10.2 seconds) but in multiplayer, it is indeed much worse.
 
Level 12
Joined
May 22, 2015
Messages
1,051
How bad can it get? If it's like a bonus second it doesn't matter. The purpose of this spell is to make the Peons invulnerable when you get attacked.

In multiplayer, it is not so much the inaccuracy, but there can be a delay if there are too many "wait" actions happening at the same time. Get a feel for it yourself before changing it, I say. It is more an issue if you have something that happens frequently.
 
Level 11
Joined
Jun 26, 2014
Messages
513
In multiplayer, it is not so much the inaccuracy, but there can be a delay if there are too many "wait" actions happening at the same time. Get a feel for it yourself before changing it, I say. It is more an issue if you have something that happens frequently.

Nah it's an altered melee map, there aren't many triggers for spells, especially spells using the wait function. So I don't think there will be a noticeable delay.
 
Status
Not open for further replies.
Top