• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] How does this even work?

Status
Not open for further replies.
Level 8
Joined
Jun 13, 2010
Messages
344
Hi

I am just doing a simply 'revive all Heroes in a region' trigger.
To explain in short, the Integer (Variable) will take all Heroes[player number] and revive them at a random point or move other living Heroes to the point.

This is what I've done:

  • Set Integer_Roll = 1
  • For each (Integer Integer_Roll) from 1 to PlayerCount, do (Actions)
    • Loop - Actions
      • Set PointDefault = (Random point in Event 2 Heroes Spawn <gen>)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero[Integer_Roll] is dead) Equal to True
        • Then - Actions
          • Hero - Instantly revive Hero[Integer_Roll] at PointDefault, Hide revival graphics
        • Else - Actions
          • Unit - Move Hero[Integer_Roll] instantly to PointDefault
      • Special Effect - Create a special effect at PointDefault using Abilities\Spells\Human\MassTeleport\MassTeleportCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • Camera - Pan camera for (Player(Integer_Roll)) to PointDefault over 0.00 seconds
      • Custom script: call RemoveLocation (udg_PointDefault)
      • Unit - Set life of Hero[Integer_Roll] to 100.00%
      • Unit - Set mana of Hero[Integer_Roll] to 100.00%
      • Unit - Reset ability cooldowns for Hero[Integer_Roll]
If I let it stay like this, a shadow will appear at the random PointDefault in the region. However, do I change the revive trigger to this:

  • Hero - Instantly revive Hero[2] at PointDefault, Hide revival graphics
... the Hero will revive with no problem (where [2] indicates the array for the Hero for player 2).

How does this work?

Thanks for taking a look!
 
Level 13
Joined
Oct 12, 2016
Messages
769
What's the maximum array size for variable Hero[x]?
I personally see no problems with this. Try deleting the first line where you set the integer variable to 1 before the loop (typically, I don't set it to anything before loops)
 
Last edited:
Level 8
Joined
Jun 13, 2010
Messages
344
Oh man I'm afraid you guys are right. I have a trigger wich counts the numbers of players and sets Playercount = number of active players. So the Integer_Roll will never reach Hero[2] ofc..
Man I was so tired yesterday when I made this post, I should've just went to bed. Sorry, but thanks anyway. :)
 
Status
Not open for further replies.
Top