My failed attempt at a spell

Emu.Man00

New Member
Reaction score
41
Code:
Death Aura
    Events
        Time - Every 3.00 seconds of game time
    Conditions
    Actions
        For each (Integer A) from 1 to (Number of units in (Units in (Playable map area) matching (((Matching unit) has buff Death Aura ) Equal to True))), do (Actions)
            Loop - Actions
                Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) has buff Death Aura ) Equal to True)) and do (Actions)
                    Loop - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (Integer((Life of (Picked unit)))) Less than (DeathAuraLife[(Integer A)] - 300)
                            Then - Actions
                                Unit - Create 1 Dummy for Player 7 (Green) at (Position of (Picked unit)) facing Default building facing degrees
                                Unit - Add Ministun  to (Last created unit)
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        DeathAuraLvl Equal to 1
                                    Then - Actions
                                        Unit - Set level of Ministun  for (Last created unit) to 3
                                    Else - Actions
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                DeathAuraLvl Equal to 2
                                            Then - Actions
                                                Unit - Set level of Ministun  for (Last created unit) to 5
                                            Else - Actions
                                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    If - Conditions
                                                        DeathAuraLvl Equal to 3
                                                    Then - Actions
                                                        Unit - Set level of Ministun  for (Last created unit) to 7
                                                    Else - Actions
                                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                            If - Conditions
                                                                DeathAuraLvl Equal to 4
                                                            Then - Actions
                                                                Unit - Set level of Ministun  for (Last created unit) to 9
                                                            Else - Actions
                                Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Picked unit)
                                Unit - Remove (Last created unit) from the game
                            Else - Actions
                        Set DeathAuraLife[(Integer A)] = (Integer((Life of (Picked unit))))

In game it simply does not work. :S

also: in object editor the field (stats - targets allowed) confuses the hell out of me. I have a custom spell based off of life drain and the targets allowed are: Air, Ground, Organic (which, i might add, is the same as normal life drain) but when i try to cast it in game it says
"Must target a hero" or "must target an enemy" or "must target an ally" or "cant target self" I cant seem to cast it on anything :S

also also: when i learn Death Aura the game lags, is there any way to prevent that?
 

Tyman2007

Ya Rly >.
Reaction score
74
Get more experience at the world editor and all of the categories before you attempt to create a spell.

There are plenty of tutorials out there.
 

Emu.Man00

New Member
Reaction score
41
or, on the other hand, you can point me in the direction of whats wrong with it so i can learn the way i prefer and the way i can.
 
T

toaster

Guest
Assigning variables will help it work correctly, sometimes the event responses and such are vague...
 

MasterRofl

New Member
Reaction score
8
I'm assuming you set either life/mana drain/transfer to 0. This makes WC think you want to do both drain/transfer mana to an enemy/ally, and therefore won't let you target anything. You could set all the values to 0.01.
 

Flare

Stops copies me!
Reaction score
662
when i try to cast it in game it says
"Must target a hero" or "must target an enemy" or "must target an ally" or "cant target self" I cant seem to cast it on anything :S

Try deleting the ability (assuming it's custom) and starting again - sometimes the editor just doesn't like doing stuff (occasionally, it causes my game to freeze during loading because of a particular ability, but it works fine if I remake the ability in Object Editor). Just copy the Targets Allowed from the base spell, or another suitable spell

Code:
                                Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Picked unit)
                                [B]Unit - Remove (Last created unit) from the game[/B]

Removing the dummy instantly is rarely a good idea - look for the Add Expiration Timer action, and use that instead (set the time to about 2 seconds, that's usually safe for most non-channelling dummy spells)


Also, you should search for a leak removal tutorial - there's a good one by emjlr3 - those leaks are, more than likely, the source of your lag
 

Emu.Man00

New Member
Reaction score
41
Ok well it stuns now but theres 2 problems
1) there is one unit that always gets stunned even when hes full hp (its always the closest person to where the unit with aura is at beginning of game)
and 2) the units just keep getting stunned even when they dont lose any life within the 3 seconds (the first stun works properly, but then it wont stop)
 

Flare

Stops copies me!
Reaction score
662
What's the value for DeathAuraLife[]?

Also, you are doing a loop within a loop, so it's probably checking a unit against the wrong value

(it's tricky to explain...)

Let's say you have 5 units on the map who match your condition (let's call them A, B, C, D, E)

Your integer loop is going from 1 to 5 (since you have 5 units matching the condition)

Your unit group loop is running 5 times (since there is 5 units in the group).

Then, you are running checks like so (number represents the integer in the integer loop, letter represents the unit, and since I feellazy, I'm gonna use a simpler variable name...)
Life of A less than IntArray[1]?
Life of B less than IntArray[1]?
Life of C less than IntArray[1]?
(and again for D and E)

Now, it moves onto 2 in the loop
Life of A less than IntArray[2]?
Life of B less than IntArray[2]?
(and again for C, D and E)

Then, it moves onto 3 in the integer loop, and so on with 4 and 5.
So, you're checking each unit's life 5 times (and that's only with 5 units matching the condition) so there's a good chance that the unit's life is going to be less than one of those 5 values
 

Emu.Man00

New Member
Reaction score
41
okay, so how do i make it so it checks each unit once :S

and deathauralife is set in the trigger at the end; i assumed the only effect that wud have is it wouldnt work for 3 seconds after learning the spell
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top