• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Dark Ritual Ability plz need help

Status
Not open for further replies.
Level 5
Joined
Feb 6, 2011
Messages
177
okey brothers

i have tried to make the Lich's Dark Ritual Ability cast on alive units but it never worked from the spell itself
so i recreated it based on the sleep spell
and it works fine

  • -code Dark Ritual(Lich)
  • A unit Begins The Effect of An Ability
  • -Ability Being Cast is equal to Dark Ritual(lich)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Level of Dark Ritual (Lich) for (Casting unit)) Equal to 1
    • Then - Actions
      • Unit - Set mana of (Casting unit) to ((Mana of (Casting unit)) + ((Life of (Target unit of ability being cast)) / 4.00))
      • Unit - Kill (Target unit of ability being cast)
      • Special Effect - Create a special effect attached to the chest of (Target unit of ability being cast) using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
      • Floating Text - Create floating text that reads (String(((Integer((Life of (Target unit of ability being cast)))) / 4))) at (Position of (Target unit of ability being cast)) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Wait 1.50 seconds
      • Floating Text - Destroy (Last created floating text)
    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Dark Ritual (Lich) for (Casting unit)) Equal to 2
        • Then - Actions
          • Unit - Set mana of (Casting unit) to ((Mana of (Casting unit)) + ((Life of (Target unit of ability being cast)) / 3.00))
          • Unit - Kill (Target unit of ability being cast)
          • Special Effect - Create a special effect attached to the chest of (Target unit of ability being cast) using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
          • Floating Text - Create floating text that reads (String(((Integer((Life of (Target unit of ability being cast)))) / 3))) at (Position of (Target unit of ability being cast)) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Wait 1.50 seconds
          • Floating Text - Destroy (Last created floating text)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Dark Ritual (Lich) for (Casting unit)) Equal to 3
            • Then - Actions
              • Unit - Set mana of (Casting unit) to ((Mana of (Casting unit)) + ((Life of (Target unit of ability being cast)) / 2.00))
              • Unit - Kill (Target unit of ability being cast)
              • Special Effect - Create a special effect attached to the chest of (Target unit of ability being cast) using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
              • Floating Text - Create floating text that reads (String(((Integer((Life of (Target unit of ability being cast)))) / 2))) at (Position of (Target unit of ability being cast)) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Wait 1.50 seconds
              • Floating Text - Destroy (Last created floating text)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Dark Ritual (Lich) for (Casting unit)) Equal to 4
                • Then - Actions
                  • Unit - Set mana of (Casting unit) to ((Mana of (Casting unit)) + ((Life of (Target unit of ability being cast)) / 1.00))
                  • Unit - Kill (Target unit of ability being cast)
                  • Special Effect - Create a special effect attached to the chest of (Target unit of ability being cast) using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
                  • Floating Text - Create floating text that reads (String(((Life of (Target unit of ability being cast)) / 1.00))) at (Position of (Target unit of ability being cast)) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                  • Wait 1.50 seconds
                  • Floating Text - Destroy (Last created floating text)
                • Else - Actions
in game it goes excelent the HP are Transformed to MP and added to the Lichs current Mana but the only problem is that the floating text Does Not go right !!!! whenever i cast the spell it only goes 0.000 can somebody please help me with this
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
A dead unit generally has no life. Killing the unit must set the life to 0 thus when you get the life again it is displayed as 0.

Improve the code by....
1. Removeing the stupid ammount of procedural coupling used. If you notice, a formula of life/(5-ability level) could be used instead of nested branching.
2. Caching the life value of the target in a local, this would coincidently fix your bug.
3. Make it MUI by removing the wait and making the floating text fade naturally.

3 Is very important. I have no idea why you are doing what you are currently infact. Firstly make the text non permanent. Then set a fade time. The text will automatically fade away over time far more efficiently and in a MUI way as no waits are used. If you must use the TriggerSleepAction method you are now, atleast store the floating text in a local.
 
Level 5
Joined
Feb 6, 2011
Messages
177
A dead unit generally has no life. Killing the unit must set the life to 0 thus when you get the life again it is displayed as 0.

Improve the code by....
1. Removeing the stupid ammount of procedural coupling used. If you notice, a formula of life/(5-ability level) could be used instead of nested branching.
2. Caching the life value of the target in a local, this would coincidently fix your bug.
3. Make it MUI by removing the wait and making the floating text fade naturally.

3 Is very important. I have no idea why you are doing what you are currently infact. Firstly make the text non permanent. Then set a fade time. The text will automatically fade away over time far more efficiently and in a MUI way as no waits are used. If you must use the TriggerSleepAction method you are now, atleast store the floating text in a local.

i have no dead units in my map thats why build upon an another thing
about the MUI i dont need this spell to be MUI as only 1 hero in my map uses it. and there can only be 1 player who can play with that hero
and about my question i never understood what should i do ?!
everything works fine but the text .. it just does not display the needed number it only displays 0.000 and all i want is to make the text show the number
thank you
 
Man, why you don't take seriuos what DGS said above, especially about waits?
Your code is inefficent you don't have to check each level of ability, and you leak location.
Use Triggering unit instead of Casting unit - it's faster.

  • Dark Ritual (Lich)
    • Events
      • A unit Begins The Effect of An Ability
    • Conditions
      • (Ability Being Cast) is equal to Dark Ritual (Lich)
    • Actions
      • Set tempInt = (4 / (Level of Dark Ritual (LicH) for (Triggering unit)))
      • Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) + ((Life of (Target unit of ability being cast)) / tempInt))
      • Unit - Kill (Target unit of ability being cast)
      • Special Effect - Create a special effect attached to the chest of (Target unit of ability being cast) using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
      • Set temp_point = (Position of (Target unit of ability being cast))
      • Floating Text - Create floating text that reads (String(Integer(tempInt))) at temp_point with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change fading age of (Last created floating text) to 2.00 seconds.
      • Floating Text - Change lifespan of (Last created floating text) to 3.00 seconds.
      • Custom script: call RemoveLocation (udg_temp_point)
 
Status
Not open for further replies.
Top