reworking blink so it damages the caster

beauzulu

Member
Reaction score
0
hi i was wondering how to set up a trigger to damage the caster as they cast blink, my theme is like self sacrifice to rip open a portal through space time to blink, and thus would like to have around about 15%/10%/5% max health for lvls 1/2/3 per blink used, if anyone can help me out then ty :)
 

Aaronx

New Member
Reaction score
6
Code:
Blink
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Ability being cast) Equal to Your Spell 
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Level of Your Spell for (Casting unit)) Equal to 1
            Then - Actions
                Unit - Create 1 Dummy Bill (Custom Campaign) for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing degrees
                Set DummyCaster1 = (Last created unit)
                Unit - Order DummyCaster1 to damage (casting unit) for % of (casting units) total health
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Level of Your Spell  for (Casting unit)) Equal to 2
                    Then - Actions
                        Unit - Create 1 Dummy Bill (Custom Campaign) for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing degrees
                        Set DummyCaster1 = (Last created unit)
                        Unit - Add a 2.00 second Generic expiration timer to DummyCaster1
                        Unit - Order DummyCaster1 to damage (casting unit) for for % of (casting units) total health
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Level of Divine Shield  for (Casting unit)) Equal to 3
                            Then - Actions
                                Unit - Create 1 Dummy Bill (Custom Campaign) for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing degrees
                                Set DummyCaster1 = (Last created unit)
                                Unit - Add a 2.00 second Generic expiration timer to DummyCaster1
                                Unit - Order DummyCaster1 to damage (casting unit) for % of (casting units) total health
                            Else - Actions

Something like that, a little different though, I'm not in WE. It also leaks so you'll want to use JASS.

Look up dummy caster tutorial, pretty helpful.

Edit: Heres the link http://world-editor-tutorials.thehelper.net/cat_usersubmit.php?view=26751
 

Komaqtion

You can change this now in User CP.
Reaction score
469
You don't have to "download" JASS, it's already built in the WE ;)
(Actually, it's the language that GUI code translates into :D)

To access JASS, you simply select any trigger, and then go to Edit -> Convert to Custom Text, and you can use JASS there ;)
(Though be careful, as once you've converted it, it can't reverted to GUI again...)

But anyways, you don't need to do any of that in this case, as there is a GUI action which will inject a single line of JASS code into the GUI code, and it's called "Custom Script", and looks like this:
Trigger:
  • Custom script: call RemoveLocation(udg_TempPoint)


That line will clean up a leak created when you use a pooint without setting it to a variable, and then using that line of JASS to remove the leak (Read the tutorial that Aaronx provided for more information ;))

Anyways, here are the lines you leak on:
Code:
Blink
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Ability being cast) Equal to Your Spell 
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Level of Your Spell for (Casting unit)) Equal to 1
            Then - Actions
                Unit - Create 1 Dummy Bill (Custom Campaign) for (Owner of (Casting unit)) at [COLOR="Red"](Position of (Casting unit))[/COLOR] facing Default building facing degrees
                Set DummyCaster1 = (Last created unit)
                Unit - Order DummyCaster1 to damage (Casting unit) for % of (casting units) total health
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Level of Your Spell  for (Casting unit)) Equal to 2
                    Then - Actions
                        Unit - Create 1 Dummy Bill (Custom Campaign) for (Owner of (Casting unit)) at [COLOR="Red"](Position of (Casting unit))[/COLOR] facing Default building facing degrees
                        Set DummyCaster1 = (Last created unit)
                        Unit - Add a 2.00 second Generic expiration timer to DummyCaster1
                        Unit - Order DummyCaster1 to damage (casting unit) for for % of (casting units) total health
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Level of Divine Shield  for (Casting unit)) Equal to 3
                            Then - Actions
                                Unit - Create 1 Dummy Bill (Custom Campaign) for (Owner of (Casting unit)) at [COLOR="Red"](Position of (Casting unit))[/COLOR] facing Default building facing degrees
                                Set DummyCaster1 = (Last created unit)
                                Unit - Add a 2.00 second Generic expiration timer to DummyCaster1
                                Unit - Order DummyCaster1 to damage (casting unit) for % of (casting units) total health
                            Else - Actions

Though, all that code can be simplified into this:
Trigger:
  • Blink
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Blink
    • Actions
      • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) - ((Max life of (Triggering unit)) x (1.00 - (0.80 + ((Real((Level of (Ability being cast) for (Triggering unit)))) x 0.05)))))


And there are no leaks... ;)
 

Nenad

~Choco Coronet~ Omnomnom
Reaction score
137
Code:
Blink
    Events
        Unit - A unit Finishes casting an ability
    Conditions
        (Ability being cast) Equal to Your Spell 
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Level of Your Spell for (Casting unit)) Equal to 1
            Then - Actions
                Unit - Create 1 Dummy Bill (Custom Campaign) for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing degrees
                Set DummyCaster1 = (Last created unit)
                Unit - Order DummyCaster1 to damage (casting unit) for % of (casting units) total health
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Level of Your Spell  for (Casting unit)) Equal to 2
                    Then - Actions
                        Unit - Create 1 Dummy Bill (Custom Campaign) for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing degrees
                        Set DummyCaster1 = (Last created unit)
                        Unit - Add a 2.00 second Generic expiration timer to DummyCaster1
                        Unit - Order DummyCaster1 to damage (casting unit) for for % of (casting units) total health
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Level of Divine Shield  for (Casting unit)) Equal to 3
                            Then - Actions
                                Unit - Create 1 Dummy Bill (Custom Campaign) for (Owner of (Casting unit)) at (Position of (Casting unit)) facing Default building facing degrees
                                Set DummyCaster1 = (Last created unit)
                                Unit - Add a 2.00 second Generic expiration timer to DummyCaster1
                                Unit - Order DummyCaster1 to damage (casting unit) for % of (casting units) total health
                            Else - Actions

Something like that, a little different though, I'm not in WE. It also leaks so you'll want to use JASS.

Look up dummy caster tutorial, pretty helpful.

Edit: Heres the link http://world-editor-tutorials.thehelper.net/cat_usersubmit.php?view=26751

Admittedly GUI is far less from perfect as far as leaks are concerned (due to BJ), but you are wrong. There is no need to use Jass for a simple spell like this one.
And your trigger is too complicated for a simple spell like this, as we already have a function given to us by blizzard:

Trigger:
  • Rift
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Blink
    • Actions
      • Unit - Set life of (Casting unit) to ((Percentage life of (Casting unit)) - (20.00 - (5.00 x (Real((Level of Blink for (Casting unit)))))))%


Any questions, go ahead and ask. ^^

Edit: Darn you Komaqtion, you beat me to it :p
 

Aaronx

New Member
Reaction score
6
Though, all that code can be simplified into this:
Trigger:
  • Blink
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Blink
    • Actions
      • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) - ((Max life of (Triggering unit)) x (1.00 - (0.80 + ((Real((Level of (Ability being cast) for (Triggering unit)))) x 0.05)))))


And there are no leaks... ;)

I must say, good sir, I just got owned.
 

beauzulu

Member
Reaction score
0
umm i cant do the last part in the trigger editor:

"Blink
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Blink
Actions
Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) - ((Max life of (Triggering unit)) x (1.00 - (0.80 + ((Real((Level of (Ability being cast) for (Triggering unit)))) x 0.05)))))"

ive done unit- set life to value, what now?
 

beauzulu

Member
Reaction score
0
can you please explain? i dont understand what he means by arithmetic and i cant complete the last bit of the trigger..
 

Nherwyziant

Be better than you were yesterday :D
Reaction score
96
can you please explain? i dont understand what he means by arithmetic and i cant complete the last bit of the trigger..

testsq.png


;)
 

beauzulu

Member
Reaction score
0
lol thank you! he really confused me with the arithmetic comment :) gotta love us WC3:editor noobs huh :)
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top