1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The reforging of the races is complete. Come see the 14th Techtree Contest Results.
    Dismiss Notice
  4. It's time to choose your horse in the race - the 32nd Modeling Contest Poll is up!
    Dismiss Notice
  5. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[Spell] Auto-Rebirth Ability

Discussion in 'World Editor Help Zone' started by cyb3rhack-r, Sep 5, 2012.

  1. cyb3rhack-r

    cyb3rhack-r

    Joined:
    Sep 5, 2012
    Messages:
    17
    Resources:
    0
    Resources:
    0
    (Updated)

    Hi. I'm new but I'm trying to learn the play-around corners of World Editor, Triggers, and JASS. I really have no experience in World Editing but I have a little programming background. Very little that it can't be considered a knowledge.

    So, I want to start atleast making one spell (or understanding how it was made).

    Here is the spell:

    So the first step I am trying to figure out that I cannot determine is the event of the unit's pre-death, or the event upon receiving a fatal damage (damage that will cause death).

    So how could I create this even since obviously 'Unit Dies' doesn't work.

    So this time, I am trying to detect a unit's current STR and max health and how to duplicate a self-heal spell. But I can't seem to find the right functions for it.

    Anyone could lend a hand again?

    Thanks. After this, I will try to proceed on the next steps and if there are something I couldn't find, I will try to ask here again.

    Any help is gladly appreciated.

    Currently working to fix the ability's balance (well, that's nothing to do with coding). But the main problem is the flaw where only the first attacked unit triggers the effect if more than one unit has the ability.

    Map done: http://www.hiveworkshop.com/forums/...to-rebirth-ability-project-index-test-map.w3x

    Would using an 'array' fix this?


    FIXED! I don't know how to explain on how did I fix it. Just check the code. Also, please tell me could be the problem that may arise or what could leak from the codes D:

    Revised/Final version: http://www.hiveworkshop.com/forums/attachment.php?attachmentid=117738&stc=1&d=1347093644

    Uploaded for iChaos.
     

    Attached Files:

    Last edited: Sep 8, 2012
  2. WaterKnight

    WaterKnight

    Joined:
    Aug 18, 2009
    Messages:
    4,034
    Resources:
    5
    Maps:
    1
    Tutorials:
    4
    Resources:
    5
    Probably the Unit takes damage event and if taken damage > current life.
     
  3. cyb3rhack-r

    cyb3rhack-r

    Joined:
    Sep 5, 2012
    Messages:
    17
    Resources:
    0
    Resources:
    0
    Will try it and give back a response. Thanks.

    EDIT: I'm trying it but I can't seem to find the proper events. Only got to 'Unit Takes damage'
     
  4. WaterKnight

    WaterKnight

    Joined:
    Aug 18, 2009
    Messages:
    4,034
    Resources:
    5
    Maps:
    1
    Tutorials:
    4
    Resources:
    5
    That is the proper event.
     
  5. cyb3rhack-r

    cyb3rhack-r

    Joined:
    Sep 5, 2012
    Messages:
    17
    Resources:
    0
    Resources:
    0
    Okay then. But how could I create the condition 'if damage taken equal to current life?'

    Btw, I already set the action 'Set life of Unit to 100.00%.'
     
  6. WaterKnight

    WaterKnight

    Joined:
    Aug 18, 2009
    Messages:
    4,034
    Resources:
    5
    Maps:
    1
    Tutorials:
    4
    Resources:
    5
    Not equal but greater than or equal.

    Real comparison, function event response - taken damage, function unit - property.

    Annotation: Units die already when they fall below 0.405 life.
     
  7. cyb3rhack-r

    cyb3rhack-r

    Joined:
    Sep 5, 2012
    Messages:
    17
    Resources:
    0
    Resources:
    0
    YES! After lots of testing, it worked! Thanks.

    Now, how can I [detect the triggering unit's current STR/Max health] and how does heal spell work like [healing unit at max health]? 'Set life of Unit to 100.00%/99999.00.' doesn't seem to work and I don't know what kind of function is that :v
     
  8. Elfansoer

    Elfansoer

    Joined:
    Aug 26, 2012
    Messages:
    122
    Resources:
    0
    Resources:
    0
    You can use variables to it... or using Conditions to detecting...
    (If you set an Integer variable, there's something like:
    • Set STRvar_Int = Strength of (Hero) Excluding bonuses

    and on real:
    • Set Max_Health_real = (max life) of (unit)

    )

    And I always use "Set life of (unit) to 100%" to heal her totally...
    (for me, it works...)
     
  9. cyb3rhack-r

    cyb3rhack-r

    Joined:
    Sep 5, 2012
    Messages:
    17
    Resources:
    0
    Resources:
    0
    Thanks. I will try it now right away. Will come back with a response after testing. But btw, what 'Base Ability' can I use for this? Reincarnation doesn't seem to fit actually.
     
  10. Elfansoer

    Elfansoer

    Joined:
    Aug 26, 2012
    Messages:
    122
    Resources:
    0
    Resources:
    0
    Personally, I think you can use any of Passive abilities, and use conditions that asks whether a unit has the ability...
    (example:
    • Events
      • Unit - A unit Is About_to_die
    • Conditions
      • Level of ability for (Triggering unit) not equal to 0
    • Actions
      • ----- Do Whatever You Want To Do -----

    )
     
  11. cyb3rhack-r

    cyb3rhack-r

    Joined:
    Sep 5, 2012
    Messages:
    17
    Resources:
    0
    Resources:
    0
    Now I'm confused. If I were to use a generic unit event, then how can I determine if it was about to die since Takes damage is only an event for a specific unit.
     
  12. Elfansoer

    Elfansoer

    Joined:
    Aug 26, 2012
    Messages:
    122
    Resources:
    0
    Resources:
    0
    How if:
    • Events
      • Unit - A unit is attacked
    • Conditions
      • (Attacked unit)'s life lesser than or equal to (very low percent health)
      • Level of (ability) for (Attacked unit) not equal to 0
    • Actions
      • -------- blah blah --------

    (Blah blah blah...)
     
  13. cyb3rhack-r

    cyb3rhack-r

    Joined:
    Sep 5, 2012
    Messages:
    17
    Resources:
    0
    Resources:
    0
    Will try that right away. Btw, I already made the healing hahaha! I'll just need the part where it will consume each point of mana to heal HP.

    Will come back for results of testing.

    EDIT: The problem with that is the unit dies. It is much more accurate to use 'Takes damage' For example unit has 1000/1100 health and took 1000 damage, the unit will die without being healed unless I specified I higher value for it to trigger.

    Any other way though?
     
  14. Elfansoer

    Elfansoer

    Joined:
    Aug 26, 2012
    Messages:
    122
    Resources:
    0
    Resources:
    0
    Now I'm also confused.

    (To consume, try:
    • Unit - Set (unit)'s mana to ((mana of (unit)) - (Mana_Used))

    )
     
  15. Elfansoer

    Elfansoer

    Joined:
    Aug 26, 2012
    Messages:
    122
    Resources:
    0
    Resources:
    0
    Now I'm also confused.

    (To consume, try:
    • Unit - Set (unit)'s mana to ((mana of (unit)) - (Mana_Used))

    )
     
  16. WaterKnight

    WaterKnight

    Joined:
    Aug 18, 2009
    Messages:
    4,034
    Resources:
    5
    Maps:
    1
    Tutorials:
    4
    Resources:
    5
    Unit is attacked has nothing to do with damage/life. It triggers already when the attacker is about to strike/start a missile.

    Events can be created ingame via Trigger - Add New Event To Trigger if you need to register new units for the unit takes damage event.

    Strength can be asked for with integer function Hero - Hero Attribute. Max life is under real function Unit - Property too.

    The unit won't be healed completely if you have that life-setting action in the unit takes damage event because the event fires before the damage is dealt.
     
  17. cyb3rhack-r

    cyb3rhack-r

    Joined:
    Sep 5, 2012
    Messages:
    17
    Resources:
    0
    Resources:
    0
    Yes, this is the one I'm having a problem right now as well aside from the generic unit event.

    If triggering unit has 500/2000 HP left and attacked with 1000 damage, unit will be healed at max health then will receive 1000 damage leaving it with 1000/2000 current HP.

    How can I make it so the triggering damage will be reduced by the triggering unit's current health?
     
  18. WaterKnight

    WaterKnight

    Joined:
    Aug 18, 2009
    Messages:
    4,034
    Resources:
    5
    Maps:
    1
    Tutorials:
    4
    Resources:
    5
    You cannot change the already calculated damage, maybe still can render the unit invulnerable but okay. A common method is to boost max health as well for an over-heal and reset it after a 0-second timer. This has been explained in a lot of other threads.

    If you can make the unit invu, you may also do so and postpone the damage (with your own value). Might be worse though because the unit would be invu for an instance and this might break targeting commands and stuff.
     
  19. cyb3rhack-r

    cyb3rhack-r

    Joined:
    Sep 5, 2012
    Messages:
    17
    Resources:
    0
    Resources:
    0
    Hmmm how about creating a dummy unit to absorb the said damage? Would that be possible?

    If not, how can I max that overheal effect? Links to thread please or tell me where and how to find them (aka keyword in searching).
     
  20. WaterKnight

    WaterKnight

    Joined:
    Aug 18, 2009
    Messages:
    4,034
    Resources:
    5
    Maps:
    1
    Tutorials:
    4
    Resources:
    5
    You cannot redirect the damage to another unit either.

    The max hp of a unit can be modified with the Item: Life Bonus ability (AIlf). Just take a very high value there to simplify the process.

    So you add it on damage event, remove it after 0 seconds and adjust the current life to your desired value.