• 🏆 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!
  • ✅ HD Level Design Contest #1 POLL is now OPEN! Check out the stunning visuals of the final entries. 🔗Click here to cast your vote!

[Trigger] Resurrection Aura?

Status
Not open for further replies.

vhx

vhx

Level 3
Joined
Jan 15, 2008
Messages
36
I was considering making an aura that would give like a 10%, 20% etc chance of resurrecting a unit for a % of their total HP. This doesn't seem like it'd be a big problem. If a unit dies and it has a specific buff then run the trigger for doing it.

However the problem is obviously when a unit dies, it has no buff. ;P I also considered like, if a unit takes damage and it's below or 0.402 HP (i think this is the considered value for death) then run a resurrection on the unit. Problem is, that is a specific unit event (have to pick a unit already on the map) and can't really apply to generic units. I could make it for when a unit is attacked... however would that apply to DoTs? Like a shadow strike dot killing him, since that would be an on damage event not an on attack or am I wrong in that sense? Perhaps I shouldn't even bother with the DoT since it's practically something so small no one will notice.

I guess the other part would be for setting a % of health which is easy. But doing that based on another units skill level?

Any insight/input or help would be appreciated.
 
Last edited:
Level 5
Joined
Jul 11, 2007
Messages
152
Unit - Dies
Isn't that generic enough?

Then run a random integer system say 1-5 and if the integer is 1 then create last killed unit with its relative life and mana OR the life % you want, I believe you can do that as well.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
  • Events
    • Unit - A unit dies
  • Conditions
    • Level of (Your_Ability) for (Triggering unit) is higher then 0 // this is just so it won't run on any death and possibly lag if you have a lot of deaths in your map
  • Actions
    • Set Point = (Position of (Triggering unit))
    • If/Then/Else
      • If
        • Level of (Your_Ability) for (Triggering unit) is equal to 1
      • Then
        • Set integer = random integer beetwin 1 and someNumber
        • if integer = 1 revive hero at Point
      • Else
        • If
          • Level of (Your_Ability) for (Triggering unit) is equal to 2
        • Then
          • Set integer = random integer beetwin 1 and someSmallerNumber
          • if integer = 1 revive hero at Point
        • Else
          • continue with all your levels
  • Custom script: call RemoveLocation(udg_Point)

LOL ! I guess im starting to get used to writing in JASS after constantly writting in it for 3 days... can't do "if integer = ..." in GUI :D

Instead of those lines create other If/Then/Else's BUT be sure they are INSIDE the main If/Then/Else's !
 

vhx

vhx

Level 3
Joined
Jan 15, 2008
Messages
36
Maddawg, no that will not work. As I said in the beginning, when a unit dies it has no buff. This is an aura effect, the units under effect of the buff are only eligible for the resurrection.

Ghost, thanks, this would work if the unit itself had the ability (the triggering unit, AKA the dying unit), but this is an aura. So only the hero will have the skill and the units will have the buff. I guess what I could do is just make a global variable for just the skill and have them base it off that and when it goes to the next level just increase it. That would solve that issue.

However the issue remains of only having people under the effect of the aura, be eligible for resurrecting...
 
Last edited:
Level 29
Joined
Jul 29, 2007
Messages
5,174
  • Events
    • A unit dies
  • Actions
    • Pick every unit within Your_Aura's_Range matching (matching unit is a hero)
    • If Your_Ability's level for picked unit greater then 0
    • Then
      • If a random number beetwin 1 and someNumber = 1
      • Then ressoruct (Triggering unit)

Sorry if I aint typing correctly, its just too annoying to open the editor and make this trigger there :p
 
Level 15
Joined
Feb 15, 2006
Messages
851
The best way to do it is with JASS, because you need to detect if the unit under X aura is dead after a small period of time. That implies: a timer that runs a code which groups the living units with the buff and then, after the small period of time (0.1 sec is fine), it checks in that group if any unit is dead. If so, do your stuff.
 

vhx

vhx

Level 3
Joined
Jan 15, 2008
Messages
36
Ghost Wolf: Hehe thanks, that works for the ability check, however still won't function for the units that die are under the aura. :] Appreciate trying though.

Moyacks idea seems the way to go. Unfortunately Jass would be a little too much for me. Is doing this is still possible using the UI functions?
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
Okay, here's my method...
  • Resurrection Aura Timely
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) has buff Resurrection Aura (Level 1)) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Set the custom value of (Picked unit) to 10
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) has buff Resurrection Aura (Level 2)) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Set the custom value of (Picked unit) to 20
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) has buff Resurrection Aura (Level 3)) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Set the custom value of (Picked unit) to 30
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Custom value of (Matching unit)) Not equal to 0) and ((((Matching unit) has buff Resurrection Aura (Level 1)) Equal to False) and ((((Matching unit) has buff Resurrection Aura (Level 2)) Equal to False) and ((((Matching unit) has buff Resurrection Aura (Level 3)) Equal to False) and do (Actions)
        • Loop - Actions
          • Unit - Set the custom value of (Picked unit) to 0
  • Resurrection Aura Revive
    • Events
      • Unit - A unit Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Custom value of (Dying unit)) Equal to 10
          • (Custom value of (Dying unit)) Equal to 20
          • (Custom value of (Dying unit)) Equal to 30
    • Actions
      • Set random = (Random integer number between 1 and 100)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Custom value of (Dying unit)) Equal to 10
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • random Less than or equal to 10
            • Then - Actions
              • Unit - Remove (Dying unit) from the game
              • Unit - Create 1 (Unit-type of (Dying unit)) for (Owner of (Dying unit)) at (Position of (Dying unit)) facing Default building facing degrees
              • Unit - Set life of (Last created unit) to 50.00%
              • Special Effect - Create a special effect attached to the origin of (Last created unit) using Abilities\Spells\Human\Resurrect\ResurrectTarget.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Custom value of (Dying unit)) Equal to 20
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • random Less than or equal to 20
                • Then - Actions
                  • Unit - Remove (Dying unit) from the game
                  • Unit - Create 1 (Unit-type of (Dying unit)) for (Owner of (Dying unit)) at (Position of (Dying unit)) facing Default building facing degrees
                  • Unit - Set life of (Last created unit) to 75.00%
                  • Special Effect - Create a special effect attached to the origin of (Last created unit) using Abilities\Spells\Human\Resurrect\ResurrectTarget.mdl
                  • Special Effect - Destroy (Last created special effect)
                • Else - Actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • random Less than or equal to 30
                • Then - Actions
                  • Unit - Remove (Dying unit) from the game
                  • Unit - Create 1 (Unit-type of (Dying unit)) for (Owner of (Dying unit)) at (Position of (Dying unit)) facing Default building facing degrees
                  • Unit - Set life of (Last created unit) to 100.00%
                  • Special Effect - Create a special effect attached to the origin of (Last created unit) using Abilities\Spells\Human\Resurrect\ResurrectTarget.mdl
                  • Special Effect - Destroy (Last created special effect)
                • Else - Actions
Just a few notes...
  • There are 3 buffs that have exactly the same description, but they work differently in the trigger.
  • You can change the percentage of life they get back if you want.
  • The ability's target were air,friend,ground,invulnerable,nonhero,vulnerable,organic
  • You can change the custom value if you already use those values.
  • random is an integer.
Hope that helps...
 
Last edited:
Level 29
Joined
Jul 29, 2007
Messages
5,174
Ghost Wolf: Hehe thanks, that works for the ability check, however still won't function for the units that die are under the aura. :] Appreciate trying though.

Eh ? didn't get where's the problem here ...

And yea, custom values are probably the best way to make this kind of spells.
I really suggest making every unit that is playing in your map custom value based on {0 x Number_Of_Abilities_Using_Custom_Values}, so if you have for example 5 abilities that use custom values it'll be "00000".

Now, if for instance you cast the first ability on some unit, change that unit (or your caster, depends what your ability needs) custom value to its custom value + 1, if he casted the second spell +10 3rd spell +100 and so on.

Now, if something happens (the thing that needs the custom value), you check if its own number is 1.
The code should look something like this:

  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Unit - Set the custom value of (Target unit of ability being cast) to ((Custom value of (Target unit of ability being cast)) + 1)
      • -------- This is if its the first ability --------
      • Unit - Set the custom value of (Target unit of ability being cast) to ((Custom value of (Target unit of ability being cast)) + 10)
      • -------- This is if its the second ability --------
  • Untitled Trigger 002
    • Events
      • Some event
    • Conditions
    • Actions
      • Set String = (String((Custom value of (Your_Unit))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Substring(String, x, x)) Equal to 1
          • -------- x,x means what character to check, if the ability was your first one, it'll be "1,1" , if its the second it'll be "2,2" --------
        • Then - Actions
          • -------- your actions --------
          • Unit - Set the custom value of (Target unit of ability being cast) to ((Custom value of (Your_Unit)) - 1)
        • Else - Actions

This will allow you to easly use multiple custom values.

If you didn't understand anything just ask.
 

vhx

vhx

Level 3
Joined
Jan 15, 2008
Messages
36
Okay, here's my method...
Just a few notes...
  • There are 3 buffs that have exactly the same description, but they work differently in the trigger.
  • You can change the percentage of life they get back if you want.
  • The ability's target were air,friend,ground,invulnerable,nonhero,vulnerable,organic
  • You can change the custom value if you already use those values.
  • random is an integer.
Hope that helps...

WOW Thank you. This is EXACTLY what I was looking for, definitely understand it better. +rep
 
Status
Not open for further replies.
Top