Adding a "wait" kills my code

Xebarsis

New Member
Reaction score
7
In my game, every time you die you immediately respawn with a new unit. I want to make it so that if you're killed by the unit called "Dummy killer" that the new unit you respawn with will be invulnerable for a split second, and then have the invulnerability removed.

Adding invulnerable isn't the problem. Once I add a wait after it, nothing after the wait ever happens, so I can't remove the ability.

Trigger:
  • Death Via Nuke
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Killing unit)) Equal to Dummy Killer
    • Actions
      • Set NukePreventionGroup[(Player number of (Owner of (Dying unit)))] = (Units in (Playable map area) owned by (Owner of (Dying unit)))
      • Unit Group - Pick every unit in NukePreventionGroup[(Player number of (Owner of (Dying unit)))] and do (Actions)
        • Loop - Actions
          • Unit - Add Invulnerable (Neutral) to (Picked unit)
          • Wait 0.50 seconds
          • Unit - Remove Invulnerable (Neutral) from (Picked unit)
          • Unit Group - Remove (Picked unit) from NukePreventionGroup[(Player number of (Owner of (Dying unit)))]


I can't get any trigger to work past the 0.50 second wait, and I'm not sure why. Even if I make it a .01 second wait, everything past it never happens. Even if I add just a simple chat message after the wait, that doesn't even happen.

How do I get any code past the wait to work? The invulnerability MUST remain on the unit for at least a brief amount of time.
 

Romek

Super Moderator
Reaction score
964
You can't put waits in 'Pick every unit' loops.

Frankly, I can't think of any non-crappy, simply way to do what you want in GUI.
Oh, the joy. :p
 

Admit

New Member
Reaction score
25
Wait dosn't work in "pick every player loop".

Edit* You could try to pick it 2 times.. No idea if it works.

Trigger:
  • Death Via Nuke
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Killing unit)) Equal to Dummy Killer
    • Actions
      • Set Temp_UnitGroup[(Player number of (Owner of (Dying unit)))] = (Units in (Playable map area) owned by (Owner of (Dying unit)))
      • Unit Group - Pick every unit in Temp_UnitGroup[(Player number of (Owner of (Dying unit)))] and do (Actions)
        • Loop - Actions
          • Unit - Make (Picked unit) Invulnerable
      • Wait 0.50 seconds
      • Unit Group - Pick every unit in Temp_UnitGroup[(Player number of (Owner of (Dying unit)))] and do (Actions)
        • Loop - Actions
          • Unit - Make (Picked unit) Vulnerable
          • Unit Group - Remove (Picked unit) from Temp_UnitGroup[(Player number of (Owner of (Dying unit)))]
 

Xebarsis

New Member
Reaction score
7
Nope, NOTHING can possibly work after the wait.. but I tried what you posted just in case. Unfortunately it didn't work. :(
 

Admit

New Member
Reaction score
25
I tried my trigger and it did work.

You must have done something wrong.
 

Sartan

New Member
Reaction score
23
Trigger:
  • Death Via Nuke
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Killing unit)) Equal to Dummy Killer
    • Actions
      • Set Temp_UnitGroup[(Player number of (Owner of (Dying unit)))] = (Units in (Playable map area) owned by (Owner of (Dying unit)))
      • Unit Group - Pick every unit in Temp_UnitGroup[(Player number of (Owner of (Dying unit)))] and do (Actions)
        • Loop - Actions
          • Unit - Add Divine Shield to (Picked unit)
          • Unit - Order (Picked unit) to Human Paladin - Activate Divine Shield

Trigger:
  • Untitled Trigger 001 Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Divine Shield
    • Actions
      • Unit - Remove Divine Shield from (Triggering unit)

divine shield is a remade ability of the orginal with 1 lvl and no mana cost and no hero ability
 

ChaosWarlock

New Member
Reaction score
7
just a couple ideas... sorry no editor in front of me.

Could try running the wait in another trigger. Not sure if this will work inside a loop though.

Delete everything after "Unit - Add Invulnerable (Neutral) to (Picked unit)" and add this action instead.

Action: Run Trigger "Remove Invulnerable"

Make a new trigger named "Remove Invulnerable" that looks like the following:

Event:
Condition:
Action: Wait .5 sec
Remove Invulnerable from picked unit
Remove picked unit from unitgroup

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

If that doesn't work you could try this.

have a dummy unit cast the invulnerability spell on each unit.
Add a buff to your Invulnerability spell
make the spell effect only last .5 sec

Delete everything after "Unit - Add Invulnerable (Neutral) to (Picked unit)" and add this action instead.

Create another trigger that looks like this:

Event: Every .1 sec of game time
Condition: Units in NukePreventionGroup greater than 0
Action: Unit group - pick every unit in NukePreventionGroup
Loop
If unit has buff Invulnerability = false
Then remove unit from unit group NukePreventionGroup
Else do nothing

the invulnerable spell will wear off on its own so all you have to do is remove the unit from the group.
 

Xebarsis

New Member
Reaction score
7
I tried my trigger and it did work.

You must have done something wrong.

Is this wrong?

Trigger:
  • Death Via Nuke
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Killing unit)) Equal to Dummy Killer
    • Actions
      • Set NukePreventionGroup[(Player number of (Owner of (Dying unit)))] = (Units in (Playable map area) owned by (Owner of (Dying unit)))
      • Unit Group - Pick every unit in NukePreventionGroup[(Player number of (Owner of (Dying unit)))] and do (Actions)
        • Loop - Actions
          • Unit - Make (Picked unit) Invulnerable
          • Wait 0.50 seconds
          • Unit Group - Pick every unit in NukePreventionGroup[(Player number of (Owner of (Dying unit)))] and do (Actions)
            • Loop - Actions
              • Unit - Make (Picked unit) Vulnerable
              • Unit Group - Remove (Picked unit) from NukePreventionGroup[(Player number of (Owner of (Dying unit)))]
 

Sartan

New Member
Reaction score
23
Is this wrong?

Trigger:
  • Death Via Nuke
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Killing unit)) Equal to Dummy Killer
    • Actions
      • Set NukePreventionGroup[(Player number of (Owner of (Dying unit)))] = (Units in (Playable map area) owned by (Owner of (Dying unit)))
      • Unit Group - Pick every unit in NukePreventionGroup[(Player number of (Owner of (Dying unit)))] and do (Actions)
        • Loop - Actions
          • Unit - Make (Picked unit) Invulnerable
          • Wait 0.50 seconds
          • Unit Group - Pick every unit in NukePreventionGroup[(Player number of (Owner of (Dying unit)))] and do (Actions)
            • Loop - Actions
              • Unit - Make (Picked unit) Vulnerable
              • Unit Group - Remove (Picked unit) from NukePreventionGroup[(Player number of (Owner of (Dying unit)))]

yes, thats wrong, you got your loops inside your first loop, but use my trigger 2 posts above
 

Xebarsis

New Member
Reaction score
7
Will the divine shield interfere if the unit that spawns already has a divine shield spell?

Edit: Okay, I fixed the above trigger to be exactly like Admit's and now it works. The respawned unit receives the invulnerability and it is removed immediately after the wait.

Thank you all for helping me with this trigger!
 

Admit

New Member
Reaction score
25
Is this wrong?

Trigger:
  • Death Via Nuke
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Killing unit)) Equal to Dummy Killer
    • Actions
      • Set NukePreventionGroup[(Player number of (Owner of (Dying unit)))] = (Units in (Playable map area) owned by (Owner of (Dying unit)))
      • Unit Group - Pick every unit in NukePreventionGroup[(Player number of (Owner of (Dying unit)))] and do (Actions)
        • Loop - Actions
          • Unit - Make (Picked unit) Invulnerable
          • Wait 0.50 seconds
          • Unit Group - Pick every unit in NukePreventionGroup[(Player number of (Owner of (Dying unit)))] and do (Actions)
            • Loop - Actions
              • Unit - Make (Picked unit) Vulnerable
              • Unit Group - Remove (Picked unit) from NukePreventionGroup[(Player number of (Owner of (Dying unit)))]


Yes thats wrong you have the loop inside the loop, you should have 2 invidual loops.

Here is the trigger, just copy paste it.

Edit* Removed the map.
 

Xebarsis

New Member
Reaction score
7
Wow, unbelievable. It was working... and I changed nothing, but now it stopped working. I don't understand, I didn't mess with any triggers. Some reason now I can't even get the invulnerability to go ON the unit unless I add a wait at the very beginning. But even if I add a wait of .01 second, units that respawn immediately die again to the "dummy killer" so I have to have the invulnerability up right away. But.. how in the hell is the trigger not working anymore? Here's what I have:

Trigger:
  • Death Via Nuke
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Killing unit)) Equal to Dummy Killer
    • Actions
      • Set NukePreventionGroup[(Player number of (Owner of (Dying unit)))] = (Units in (Playable map area) owned by (Owner of (Dying unit)))
      • Unit Group - Pick every unit in NukePreventionGroup[(Player number of (Owner of (Dying unit)))] and do (Actions)
        • Loop - Actions
          • Unit - Make (Picked unit) Invulnerable
      • Wait 0.50 seconds
      • Unit Group - Pick every unit in NukePreventionGroup[(Player number of (Owner of (Dying unit)))] and do (Actions)
        • Loop - Actions
          • Unit - Make (Picked unit) Vulnerable
          • Unit Group - Remove (Picked unit) from NukePreventionGroup[(Player number of (Owner of (Dying unit)))]
 

bOb666777

Stand against the ugly world domination face!
Reaction score
117
I don't know, that trigger should work perfectly fine.
And by the way why are you removing all units in that group?
Clearing the group isnt clearing the leak if that's what you want to do. And maybe that's also what's messing with your trigger.

Btw (again) the array size of NukePreventionGroup in the variable editor must match the number of players.
 

Xebarsis

New Member
Reaction score
7
I array size is 12. Even if I disable every line of code in this trigger past the first loop, invulnerability does not get put on my units.
 

bOb666777

Stand against the ugly world domination face!
Reaction score
117
Try adding the Invulnerability (Neutral Hostile) instead of Making the unit invulnerable?
 

ludnica

Long gone
Reaction score
61
Or make a rune item with the invulnerability (Potion of Divinity, or something) skill, then give the item to the hero.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top