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

Need help with resurrect all dead ally heroes trigger?

Status
Not open for further replies.
Level 6
Joined
Jul 12, 2017
Messages
139
So I don't know where to start with this trigger. I do have resurrect one ally hero ability though which is this one.

  • Hero Revive 1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Death Negater (Revive Ability)
    • Actions
      • Set VariableSet TempUnit = (Target unit of ability being cast)
      • Set VariableSet TempLoc = (Position of TempUnit)
      • Set VariableSet TempInteger = (Player number of (Owner of TempUnit))
      • Unit - Remove TempUnit from the game
      • Special Effect - Create a special effect at TempLoc using Abilities\Spells\Other\Awaken\Awaken.mdl
      • Special Effect - Destroy (Last created special effect)
      • Hero - Instantly revive PlayerHero[TempInteger] at TempLoc, Hide revival graphics
      • Camera - Pan camera for (Owner of (Target unit of ability being cast)) to (Position of (Target unit of ability being cast)) over 0.00 seconds
      • Unit - Set life of PlayerHero[TempInteger] to 100.00%
      • Unit - Set mana of PlayerHero[TempInteger] to 100.00%
      • Custom script: call RemoveLocation (udg_TempLoc)
      • Set VariableSet Point1 = (Position of (Target unit of ability being cast))
      • Game - Display to (All players) the text: ((Name of (Owner of (Target unit of ability being cast))) + |c00FFFF00has been revived!|r )
      • Unit - Create 1 No summon (Jaina Dummy) for (Owner of (Target unit of ability being cast)) at Point1 facing (Facing of (Casting unit)) degrees
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Unit - Add Revival Invincible Shield (Revive Hero) to (Last created unit)
      • Unit - Order (Last created unit) to Night Elf Druid Of The Claw - Rejuvenation PlayerHero[TempInteger]
      • Custom script: call RemoveLocation(udg_Point1)
But I'm not sure how to resurrect all allies. I kinda want it to be done like, I cast resurrection and boom! All fallen ally heroes are back in action. By the way, when player's hero in my map die, they spawn a circle that need specific target ability to resurrect them so if it possible, I want the dead hero to come back and remove the circle, but when they die again, they will still spawn a circle.

Right now, I'm trying to do it like resurrection ability, plus giving all heroes bonus movement speed and mana regeneration like this, will appreciate any help!

  • Valient Sacrifice
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Valient Sacrifice (Mograine)
    • Actions
      • Set VariableSet Real1 = (Real((Intelligence of (Casting unit) (Include bonuses))))
      • Set VariableSet Point1 = (Position of (Casting unit))
      • Unit - Create 1 No summon (Jaina Dummy) for (Owner of (Casting unit)) at Point1 facing Default building facing degrees
      • Unit - Add Endurance Aura (Valient Sacrifice) to (Last created unit)
      • Unit - Add Mana Regeneration Aura (Valient Sacrifice) to (Last created unit)
      • Custom script: call RemoveLocation(udg_Point1)
 

Cokemonkey11

Code Reviewer
Level 29
Joined
May 9, 2006
Messages
3,522
Hey, it sounds like you have an existing trigger that does something, but not what you want.

Your question is of the form: can you please fix my trigger for me?

Someone on this forum might be willing to do that, but not me.

I think we should fix one problem at a time. It seems that you have a few different questions:

- How do I revive heroes for all players on a team?
- How do I add a bonus movement speed and mana regeneration to a unit?
- I have special semantics for revival where there's a surrogate unit in place of my hero for an unrelated ability - how do I make this work with that?

Let's solve the first problem first. What you're looking for is tools that let you "iterate" over players matching a category. In GUI triggers, you'd use the action "For Loop" and a nested condition that checks Player [Loop Index A] is an ally of Triggering Player

Please try that, see how far you can get, and when you get stuck, post your updated triggers and let us know what progress you've made.
 
Level 6
Joined
Jul 12, 2017
Messages
139
so I did manage to resurrect ally but the problem is it can only be done once, dunno why.

here's the trigger I set up

  • Valient Sacrifice Set Up
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • ((Owner of (Triggering unit)) slot status) Equal to Is playing
    • Actions
      • Unit Group - Add (Triggering unit) to DyingHero_Group
then this one

  • Valient Sacrifice
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Valient Sacrifice (Mograine)
    • Actions
      • Set VariableSet Real1 = (Real((Intelligence of (Casting unit) (Include bonuses))))
      • Set VariableSet Point1 = (Position of (Casting unit))
      • Set VariableSet UnitGroup1 = DyingHero_Group
      • Set VariableSet UnitGroup2 = (Units of type Circle of Revival)
      • Unit - Create 1 No summon (Jaina Dummy) for (Owner of (Casting unit)) at Point1 facing Default building facing degrees
      • Unit - Add a 15.00 second Generic expiration timer to (Last created unit)
      • Unit - Add Endurance Aura (Valient Sacrifice) to (Last created unit)
      • Unit - Add Mana Regeneration Aura (Valient Sacrifice) to (Last created unit)
      • Unit - Set life of (Casting unit) to ((Percentage life of (Casting unit)) - 75.00)%
      • -------- --------
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in UnitGroup1 and do (Actions)
        • Loop - Actions
          • Set VariableSet TempUnit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of living Circle of Revival units owned by (Owner of TempUnit)) Greater than or equal to 1
            • Then - Actions
              • Set VariableSet Point2 = (Position of (Casting unit))
              • Hero - Instantly revive TempUnit at Point2, Hide revival graphics
              • Custom script: call RemoveLocation(udg_Point2)
            • Else - Actions
      • Unit Group - Pick every unit in UnitGroup2 and do (Actions)
        • Loop - Actions
          • Unit - Remove (Picked unit) from the game
      • Special Effect - Create a special effect at Point1 using Abilities\Spells\Other\Awaken\Awaken.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_Point1)
I guess I need to loop them? But how?

Maybe because I destroy it so they got cancelled?
 

Cokemonkey11

Code Reviewer
Level 29
Joined
May 9, 2006
Messages
3,522
> so I did manage to resurrect ally but the problem is it can only be done once, dunno why.

Please be more specific. Do you mean that your spell works as intended the first time it's cast, and subsequent casts don't work properly?

What happens on subsequent casts? What do you expect to happen that doesn't happen?
 
Level 6
Joined
Jul 12, 2017
Messages
139
> so I did manage to resurrect ally but the problem is it can only be done once, dunno why.

Please be more specific. Do you mean that your spell works as intended the first time it's cast, and subsequent casts don't work properly?

What happens on subsequent casts? What do you expect to happen that doesn't happen?

How specific do you want me to be? Like "My spell is working, I did manage to resurrect the team, it works as I intended but then the second time it fails to do so which I don't know why" does that suffice enough for you?

I already stated as above that I want to a trigger that revives my team but I dunno how and I didn't even ask for you to fix it for me. I just asked for the guide or something along that line pls.

Man, I used to visit this place and ask for help from time to time but after this 'refunded' version released, this place seems to be emptier than I thought.
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
this should work for the basic spell of reviving all dead allied heros:

  • revive allied heros
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to 'you die when I say you can die'
    • Actions
      • Set PlayerGroup = (All allies of (Triggering player))
      • Player Group - Pick every player in PlayerGroup and do (Actions)
        • Loop - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Set UnitGroup = (Units owned by (Picked player) matching (((Matching unit) is A Hero) Equal to True))
          • Unit Group - Pick every unit in UnitGroup and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is dead) Equal to True
                • Then - Actions
                  • Set Point = (Random point in (Region centered at (Position of (Triggering unit)) with size (500.00, 500.00)))
                  • Hero - Instantly revive (Picked unit) at Point, Show revival graphics
                  • Custom script: call RemoveLocation(udg_Point)
                • Else - Actions
      • Custom script: call DestroyForce(udg_PlayerGroup)
If the game saves the location every hero dies at, idk how to access that information, so I just made them all revive near the casting hero. seems like you know how to apply all the buffs you want - just add them to (picked unit) in side the loop right after reviving the hero.

Man, I used to visit this place and ask for help from time to time but after this 'refunded' version released, this place seems to be emptier than I thought.
Don't know about the glory days. I joined a few months ago and have gotten loads of help in a wide variation of topics. If you have patience I'm pretty sure you'll get the help you came for.

also, this is just my opinion, but it seems to me like lashing out at the person trying to help you (@Cokemonkey11 ) isn't a very smart strategy when asking for help.. but again, that's just my personal opinion...

good luck!
 
Level 6
Joined
Jul 12, 2017
Messages
139
this should work for the basic spell of reviving all dead allied heros:

  • revive allied heros
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to 'you die when I say you can die'
    • Actions
      • Set PlayerGroup = (All allies of (Triggering player))
      • Player Group - Pick every player in PlayerGroup and do (Actions)
        • Loop - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Set UnitGroup = (Units owned by (Picked player) matching (((Matching unit) is A Hero) Equal to True))
          • Unit Group - Pick every unit in UnitGroup and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is dead) Equal to True
                • Then - Actions
                  • Set Point = (Random point in (Region centered at (Position of (Triggering unit)) with size (500.00, 500.00)))
                  • Hero - Instantly revive (Picked unit) at Point, Show revival graphics
                  • Custom script: call RemoveLocation(udg_Point)
                • Else - Actions
      • Custom script: call DestroyForce(udg_PlayerGroup)
If the game saves the location every hero dies at, idk how to access that information, so I just made them all revive near the casting hero. seems like you know how to apply all the buffs you want - just add them to (picked unit) in side the loop right after reviving the hero.


Don't know about the glory days. I joined a few months ago and have gotten loads of help in a wide variation of topics. If you have patience I'm pretty sure you'll get the help you came for.

also, this is just my opinion, but it seems to me like lashing out at the person trying to help you (@Cokemonkey11 ) isn't a very smart strategy when asking for help.. but again, that's just my personal opinion...

good luck!

Alright, I'll try this one, thanks for the help, very appreciated it. I know I may be a bit harsh but I don't know how specific do you want me to be because I thought that clearly state the situation I'm in.

I'll post progress when I'm done testing it.
 
Level 6
Joined
Jul 12, 2017
Messages
139
this should work for the basic spell of reviving all dead allied heros:

  • revive allied heros
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to 'you die when I say you can die'
    • Actions
      • Set PlayerGroup = (All allies of (Triggering player))
      • Player Group - Pick every player in PlayerGroup and do (Actions)
        • Loop - Actions
          • Custom script: set bj_wantDestroyGroup = true
          • Set UnitGroup = (Units owned by (Picked player) matching (((Matching unit) is A Hero) Equal to True))
          • Unit Group - Pick every unit in UnitGroup and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is dead) Equal to True
                • Then - Actions
                  • Set Point = (Random point in (Region centered at (Position of (Triggering unit)) with size (500.00, 500.00)))
                  • Hero - Instantly revive (Picked unit) at Point, Show revival graphics
                  • Custom script: call RemoveLocation(udg_Point)
                • Else - Actions
      • Custom script: call DestroyForce(udg_PlayerGroup)
If the game saves the location every hero dies at, idk how to access that information, so I just made them all revive near the casting hero. seems like you know how to apply all the buffs you want - just add them to (picked unit) in side the loop right after reviving the hero.


Don't know about the glory days. I joined a few months ago and have gotten loads of help in a wide variation of topics. If you have patience I'm pretty sure you'll get the help you came for.

also, this is just my opinion, but it seems to me like lashing out at the person trying to help you (@Cokemonkey11 ) isn't a very smart strategy when asking for help.. but again, that's just my personal opinion...

good luck!

That is amazing, working just as I needed it to be! REP to you my savior!
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,517
@Ender Wiggins
That's pretty good! One small issue though, I believe you leak a Rect (Region) with that "Region centered at position of unit..." function. In most cases you can use Point with Polar Offset instead.

So you could change it to: Position of triggering unit offset by random real between 0 and 500 towards random angle.

This results in the same effect, at least in this case.

@gogeta55
And some tips for efficiency and making your life easier:

1) If each player has only 1 Hero, keep track of these units using a Unit Array variable with the owner's Player Number as the Index []. It would look something like: Hero[Player number]

With this setup you'll always be able to access a Hero. Need Player 7's Hero? Simply reference Hero[7]. Want to loop through all of the Heroes in the game? Use Pick Every Player and reference Hero[Player number of picked player].

2) You can keep track of the Revive Circle of Power using the same method as above.

So as long as you have access to a Player, you will also have access to their Hero/Circle of Power.

3) Learn how to use a Unit Indexer, it's basically the next step after learning how to use Arrays with Player Numbers.
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
cool, I didn't know regions leak. so this removes them? - Custom Script: call RemoveRect(udg_TempRegion)

another cool thing you could do with the way uncle suggested it is -

Position of triggering unit offset by 500 towards random angle.

this way they don't appear in a random spot nearby, but in a circle around the hero (albeit randomly spaced out) which could add to the affect. - purely aesthetic.
 
Last edited:
Level 6
Joined
Jul 12, 2017
Messages
139
@Ender Wiggins
That's pretty good! One small issue though, I believe you leak a Rect (Region) with that "Region centered at position of unit..." function. In most cases you can use Point with Polar Offset instead.

So you could change it to: Position of triggering unit offset by random real between 0 and 500 towards random angle.

This results in the same effect, at least in this case.

@gogeta55
And some tips for efficiency and making your life easier:

1) If each player has only 1 Hero, keep track of these units using a Unit Array variable with the owner's Player Number as the Index []. It would look something like: Hero[Player number]

With this setup you'll always be able to access a Hero. Need Player 7's Hero? Simply reference Hero[7]. Want to loop through all of the Heroes in the game? Use Pick Every Player and reference Hero[Player number of picked player].

2) You can keep track of the Revive Circle of Power using the same method as above.

So as long as you have access to a Player, you will also have access to their Hero/Circle of Power.

3) Learn how to use a Unit Indexer, it's basically the next step after learning how to use Arrays with Player Numbers.

All right, I'll see what I can do with that information thanks!

cool, I didn't know regions leak. so this removes them? - Custom Script: call RemoveRect(udg_TempRegion)

another cool thing you could do with the way uncle suggested it is -

Position of triggering unit offset by 500 towards random angle.

this way they don't appear in a random spot nearby, but in a circle around the hero (albeit randomly spaced out) which could add to the affect. - purely aesthetic.

I'll try that too then but not sure how it will go so probably gotta be a mess for my first time doing this, but thanks!
 
Status
Not open for further replies.
Top