Spell not working...

RedSword

New Member
Reaction score
4
Hi, I made an ability based of Command Aura (but the ability isn't an aura anymore) that makes that everytime a unit hit something, friendly unit beside the hero (which have the command aura buff named "Divine Hammer") get healed, but I tryed my trigger and it isn't working. Here it is :

JASS:
Divine Hammer
    Events
        Unit - A unit Is attacked
    Conditions
        ((Attacking unit) has buff Divine Hammer ) Equal to True
        ((Attacked unit) is A ground unit) Equal to True
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Level of Divine Hammer  for (Attacking unit)) Equal to 1
            Then - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Random integer number between 1 and 100) Less than or equal to 100
                    Then - Actions
                        Set Temp_Point = (Position of (Attacking unit))
                        Set Temp_Group = (Units within 200.00 of Temp_Point matching (((Matching unit) belongs to an ally of (Owner of (Attacking unit))) Equal to True))
                        Unit Group - Pick every unit in Temp_Group and do (Actions)
                            Loop - Actions
                                Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 50.00)
                                Unit - Set life of (Attacking unit) to ((Life of (Attacking unit)) + 10.00)
                                Set Temp_Point2 = (Position of (Picked unit))
                                Special Effect - Create a special effect at Temp_Point2 using Abilities\Spells\Human\Heal\HealTarget.mdl
                                Special Effect - Destroy (Last created special effect)
                                Custom script:   call RemoveLocation(udg_Temp_Point2)
                        Unit - Set life of (Attacking unit) to ((Life of (Attacking unit)) - 60.00)
                        Custom script:   call DestroyGroup(udg_Temp_Group)
                        Custom script:   call RemoveLocation(udg_Temp_Point)
                    Else - Actions
                        Do nothing
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Random integer number between 1 and 100) Less than or equal to 100
                    Then - Actions
                        Set Temp_Point = (Position of (Attacking unit))
                        Set Temp_Group = (Units within ((Real((Level of Divine Hammer  for (Attacking unit)))) + 125.00) of Temp_Point matching (((Matching unit) belongs to an ally of (Owner of (Attacking unit))) Equal to True))
                        Unit Group - Pick every unit in Temp_Group and do (Actions)
                            Loop - Actions
                                Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (((Real((Level of Divine Hammer  for (Attacking unit)))) x 50.00) - 50.00))
                                Unit - Set life of (Attacking unit) to ((Life of (Attacking unit)) + 10.00)
                                Set Temp_Point2 = (Position of (Picked unit))
                                Special Effect - Create a special effect at Temp_Point2 using Abilities\Spells\Human\Heal\HealTarget.mdl
                                Special Effect - Destroy (Last created special effect)
                                Custom script:   call RemoveLocation(udg_Temp_Point2)
                        Unit - Set life of (Attacking unit) to ((Life of (Attacking unit)) - (((Real((Level of Divine Hammer  for (Attacking unit)))) x 50.00) - 40.00))
                        Custom script:   call DestroyGroup(udg_Temp_Group)
                        Custom script:   call RemoveLocation(udg_Temp_Point)
                    Else - Actions
                        Do nothing


I'd appreciate if you could tell me what's wrong and if there is any leak,

RedSword
 

ArmedCitizen

Kisses Cats
Reaction score
198
Code:
Set Temp_Group = (Units within ((Real((Level of Divine Hammer  for (Attacking unit)))) + 125.00) of Temp_Point matching (([B][I][U](Picked unit)[/U][/I][/B] belongs to an ally of (Owner of (Attacking unit))) Equal to True))

Set Temp_Group = (Units within 200.00 of Temp_Point matching (([B][I][U](Picked unit) [/U][/I][/B]belongs to an ally of (Owner of (Attacking unit))) Equal to True))

Huh try changing those to Matching unit. Might work then.
 

RedSword

New Member
Reaction score
4
Ewww lol big mistake, thanks, it work now.

EDIT : Since my paladin has a big slow hammer, is it possible to detect the "on-hit" attack, and not the "right click" when beside the target ?

Re-EDIT : And in that case, does the triggering unit is the attacker or the attacked ?, And why Am I seeing no effect (special effect) when my ability is triggered (I tryed 2 different, none shown), and why sometimes, when no allies unit are beside im still getting healed ? (I put trigger to remove heal healed, but the amount given by allied unit beside the Paladin is buggy)
 

Knocksious

Sweet, I got 2 little green bars!
Reaction score
46
It's hard for me to understand you, but the question that I got is

>Since my paladin has a big slow hammer, is it possible to detect the "on-hit" attack, and not the "right click" when beside the target ?

Yes, it is called "unit takes damage" and it is in the "specific unit event" Event. Since it is a specific unit event, you are going to have to add it to the trigger with another trigger which would look something like this

Code:
Trigger 1
    Events
          Time elapsed is 1 second
    Conditions
    Actions
         Set TempUnitGroup = all units in playable map area
         Pick every unit in TempUnitGroup and do:
              Trigger - add event ((picked unit) takes damage to <your trigger>)
         custom script: call DestroyGroup (udg_TempUnitGroup)
 

RedSword

New Member
Reaction score
4
Should I use this ? :
JASS:
Divine Hammer Inititation
    Events
        Unit - A unit Is attacked
    Conditions
        (Unit-type of (Attacking unit)) Equal to Paladin
        ((Attacked unit) belongs to an enemy of (Owner of (Attacking unit))) Equal to True
    Actions
        Trigger - Add to Divine Hammer &lt;gen&gt; the event (Unit - (Attacked unit) Takes damage)


Because it's look more simplier, and I don't need to take all a group.

Thx btw Knock for giving me consciousness of "add event" trigger, but shouldn't adding the event give unlimited one if repeted ? Like the death unit attacked would leak ?
 

Knocksious

Sweet, I got 2 little green bars!
Reaction score
46
I made a similar mistake

if your trigger causes the damage source to damage another unit, then you get an infinite loop

so you have to do something like this

(turn off this trigger)
Damage Source Damages Target
(turn on this trigger)
 

RedSword

New Member
Reaction score
4
But if I do "every sec..." ... add event ... picked unit, wouldn't the fact that the trigger have more and more events, would makes some lag at a given time ?
 

Knocksious

Sweet, I got 2 little green bars!
Reaction score
46
I'm not quite sure what you mean, could you post your trigger?
The periodic one
 

RedSword

New Member
Reaction score
4
It is just, I'm wondering if that if I do ur trigger :

JASS:
Trigger 1
    Events
          Time elapsed is 1 second //<b> HERE !!</b>
    Conditions
    Actions
         Set TempUnitGroup = all units in playable map area
         Pick every unit in TempUnitGroup and do:
              Trigger - add event ((picked unit) takes damage to &lt;your trigger&gt;)
         custom script: call DestroyGroup (udg_TempUnitGroup)


I was just wondering, that if I put in the event (alias HERE !!) something periodic (let's say every second) , then the periodic time would add event of all the picked unit... and the second time the trigger would execute itself when there gonna be more unit, the other trigger would have more event, so let's say after 1 hour of gaming (and every 20 sec a bunch of units spawn), my others triggers should have thousand of events.... would that lag ?
 

Knocksious

Sweet, I got 2 little green bars!
Reaction score
46
THAT will

what you could do instead, with spawns, you could make the add event another trigger where the event for that is Unit enters playable map area

Code:
E - unit enters playable map area
C - 
A - add (entering unit) takes damage to <your trigger>
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
> But does "add event" trigger leak or create leak ?

Well, not really.
But kind of.
It does take space to store all of those events....

However, unless you have an absolute TON of units, it won't make a difference.
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
> how could I remove these leak ?

Actually, I'm not too sure. I'm not an expert here....

However, if you destroyed the trigger, that should theoretically get rid of the space being taken up in memory.
 

RedSword

New Member
Reaction score
4
Does this would work ?

JASS:
Divine Hammer Inititation
    Events
        Unit - A unit Is attacked
    Conditions
        (Unit-type of (Attacking unit)) Equal to Paladin
        ((Attacked unit) belongs to an enemy of (Owner of (Attacking unit))) Equal to True
    Actions
        Trigger - Remove (This trigger) from the trigger queue
        Trigger - Add to Divine Hammer &lt;gen&gt; the event (Unit - (Attacked unit) Takes damage)


I mean by this that all event would be cleared.

EDIT : Hey I guess this would work ?

JASS:
Divine Hammer Inititation
    Events
        Unit - A unit Is attacked
    Conditions
        (Unit-type of (Attacking unit)) Equal to Paladin
        ((Attacked unit) belongs to an enemy of (Owner of (Attacking unit))) Equal to True
    Actions
        Set Temp_Trigger = Divine Hammer &lt;gen&gt;
        Trigger - Add to Temp_Trigger the event (Unit - (Attacked unit) Takes damage)
        Custom script:   call DestroyTrigger(udg_Temp_Trigger)


Does stored trigger-variable can be call by normal event ?
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
No. Removing it from the queue doesn't work.
If you wanted to destroy it, you would have to use Custom Scripts at least.
And then you would have to re-create the trigger and all its events, conditions, and actions. In-game.
It wouldn't be a piece of cake.

My suggestion:

Try it the way it is first.
If it's REALLY a problem, you can go to more drastic measures.
 

RedSword

New Member
Reaction score
4
Tested and work =D

JASS:
Divine Hammer Inititation
    Events
        Unit - A unit Is attacked
    Conditions
        (Unit-type of (Attacking unit)) Equal to Paladin
        ((Attacking unit) has buff Divine Hammer ) Equal to True
        ((Attacked unit) belongs to an enemy of (Owner of (Attacking unit))) Equal to True
        ((Attacked unit) is A structure) Equal to False
    Actions
        Set Temp_Trigger = Divine Hammer &lt;gen&gt;
        Trigger - Add to Temp_Trigger the event (Unit - (Attacked unit) Takes damage)
        Trigger - Run Temp_Trigger (checking conditions)


And since the Variable is the trigger and it is reset there shouldn't be anyleak =D, thx to helper (Knock and Ghan).
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
> since the Variable is the trigger and it is reset there shouldn't be anyleak

Well, no. I don't think that's technically correct. The problem will still be there.
Because the trigger will still be gaining more and more events.
However, I doubt it will be an issue.
 

RedSword

New Member
Reaction score
4
Yes but the trigger is the variable, and the variable is reset to the base trigger...

Other "wonderation" in my spell, is this :

JASS:
Divine Hammer
    Events
    Conditions
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Level of Divine Hammer  for (Attacking unit)) Equal to 1
            Then - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Random integer number between 1 and 100) Less than or equal to 100
                    Then - Actions
                        Set Temp_Point = (Position of (Attacking unit))
                        Set Temp_Group = (Units within 200.00 of Temp_Point matching ((((Matching unit) belongs to an ally of (Owner of (Attacking unit))) Equal to True) and (((Matching unit) is alive) Equal to True)))
                        <b>Unit Group - Pick every unit in Temp_Group and do (Actions)
                            Loop - Actions
                                Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 50.00)
                                Unit - Set life of (Attacking unit) to ((Life of (Attacking unit)) + 10.00)
                                Set Temp_Point2 = (Position of (Picked unit))
                                Special Effect - Create a special effect at Temp_Point2 using Abilities\Spells\Human\Heal\HealTarget.mdl
                                Wait for (Last played sound) to be 0.00 seconds from finished playing
                                Special Effect - Destroy (Last created special effect)
                                Custom script:   call RemoveLocation(udg_Temp_Point2)</b>
                        Unit - Set life of (Attacking unit) to ((Life of (Attacking unit)) - 60.00)
                        Custom script:   call DestroyGroup(udg_Temp_Group)
                        Custom script:   call RemoveLocation(udg_Temp_Point)
                    Else - Actions
                        Do nothing
            Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Random integer number between 1 and 100) Less than or equal to 100
                    Then - Actions
                        Set Temp_Point = (Position of (Attacking unit))
                        Set Temp_Group = (Units within ((Real((Level of Divine Hammer  for (Attacking unit)))) + 125.00) of Temp_Point matching ((((Matching unit) belongs to an ally of (Owner of (Attacking unit))) Equal to True) and (((Matching unit) is alive) Equal to True)))
                        <b>Unit Group - Pick every unit in Temp_Group and do (Actions)
                            Loop - Actions
                                Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + (((Real((Level of Divine Hammer  for (Attacking unit)))) x 50.00) - 50.00))
                                Unit - Set life of (Attacking unit) to ((Life of (Attacking unit)) + 10.00)
                                Set Temp_Point2 = (Position of (Picked unit))
                                Special Effect - Create a special effect at Temp_Point2 using Abilities\Spells\Human\Heal\HealTarget.mdl
                                Wait for (Last played sound) to be 0.00 seconds from finished playing
                                Special Effect - Destroy (Last created special effect)
                                Custom script:   call RemoveLocation(udg_Temp_Point2)</b>
                        Unit - Set life of (Attacking unit) to ((Life of (Attacking unit)) - (((Real((Level of Divine Hammer  for (Attacking unit)))) x 50.00) - 40.00))
                        Custom script:   call DestroyGroup(udg_Temp_Group)
                        Custom script:   call RemoveLocation(udg_Temp_Point)
                    Else - Actions
                        Do nothing

Leakless ? (I'm mostly talking about the "Last created special effect"), because I had a trouble about making them work correctly. (SFX are in the Loop, the farter on the right)
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
888
> Yes but the trigger is the variable, and the variable is reset to the base trigger...

Doesn't matter. Nothing happens to the trigger itself.

> Leakless ?

Looks pretty good.
 
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