• 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.

[Trigger] Condition to check if unit has mana: help please

Status
Not open for further replies.
Level 3
Joined
Jan 26, 2009
Messages
36
I'm working on a small trigger, and everything works except for the fact that my trigger will fire on a unit even if it doesn't have mana. Here is my trigger.

  • Mana Break
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Level of Mana Break for (Attacking unit)) Greater than or equal to 1
          • ((Attacked unit) is alive) Equal to True
          • ((Attacked unit) is A structure) Equal to False
          • (Mana of (Attacked unit)) Less than or equal to 10.00
          • ((Attacked unit) belongs to an enemy of (Owner of (Attacking unit))) Equal to True
    • Actions
      • Set AE = (Unit-type of (Last created unit))
      • Unit - Create 1 Arcane Eruption for (Owner of (Attacking unit)) at (Position of (Attacking unit)) facing (Position of (Attacked unit))
      • Unit - Set level of Arcane Eruption (Battlemage) for (Last created unit) to (Level of Mana Break for (Attacking unit))
      • Unit - Order (Last created unit) to Orc Far Seer - Chain Lightning (Attacked unit)
      • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)

Everything about the trigger works perfectly, except for the fact that it will work even if a unit has mana. Is there a way to condition in something to check if the attacked unit even has mana?
 
Last edited by a moderator:
Level 3
Joined
Jan 26, 2009
Messages
36
figured this one out on my own... much like everything I've posted looking for assistance with. Does anyone on these forums know how to use GUI Triggers? All I see is replies to people going "LOL HOW DO I MAEK HURO?"
 
Level 5
Joined
Oct 17, 2006
Messages
151
I'm quite an expert with GUI triggers... I just got to yours seeing that I am somewhat of an off and on person on the forums.

The answer to our question would be this:
"(Mana of (Attacked unit)) Less than or equal to 10.00" includes all units with 0 mana (units without mana have 0 mana out of 0 mana, wc3 just hides the mana slot if they have 0 maximum mana)

The way to fix this would be this:
Conditions
(Level of Mana Break for (Attacking unit)) Greater than or equal to 1
((Attacked unit) is alive) Equal to True
((Attacked unit) is A structure) Equal to False
(Mana of (Attacked unit)) Less than or equal to 10.00
(Maximum mana of (Attacked unit)) greater than to 0.00
((Attacked unit) belongs to an enemy of (Owner of (Attacking unit))) Equal to True

Or if there is no maximum mana condition have a seperate code that adds a unit who has mana > 0 every 5 seconds into a unit group. In about 30 sec you should have the entire unit group full of everyone with mana and then you can link to it inside your set of conditions.

Hows that for GUI solving issues :smile:
 
Level 3
Joined
Jan 26, 2009
Messages
36
:) First good reply I've gotten on pretty much any forums I've been browsing looking for assistance.

Currently stuck on an issue with just custom scripts etc...

Arcane Vortex Mana Drain
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Arcane Vortex
Actions
Set Point1 = (Target point of ability being cast)
Set Group1 = (Units within 260.00 of Point1 matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True) and (((Matching unit) is alive) Equal to True))))
Unit Group - Pick every unit in Group1 and do (Actions)
Loop - Actions
Unit - Create 1 Arcane Vortex (Mana Drain) for (Owner of (Triggering unit)) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
Unit - Set level of Arcane Vortex (Battlemage - Mana Drain) for (Last created unit) to (Level of Arcane Vortex for (Triggering unit))
Unit - Order (Last created unit) to Night Elf Druid Of The Claw - Rejuvenation (Picked unit)
Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Undead\DarkRitual\DarkRitualTarget.mdl
Special Effect - Destroy (Last created special effect)
Custom script: call RemoveLocation( udg_Point1 )
Custom script: call DestroyGroup( udg_Group1 )

There is an issue there, but I don't know where >>
 
Level 5
Joined
Oct 17, 2006
Messages
151
your events wrong...

"Unit - A unit Starts the effect of an ability" then your condition is "ability being cast" this means that the trigger doesn't even run because your trying to link to something thats not there (your using the wrong event so it cant link to it)

Also, what I advise is to put in text comments here and there to yourself to know whether everything else works right.

And if none of that helped then tell me, what happens when the ability is cast?
 
Level 9
Joined
Apr 3, 2008
Messages
700
neavea said:
I'm quite an expert with GUI triggers...
<...>
your events wrong...
"Unit - A unit Starts the effect of an ability" then your condition is "ability being cast" this means that the trigger doesn't even run because your trying to link to something thats not there (your using the wrong event so it cant link to it)

Ability comparison works with this event. I've tested it many times in my maps.

@Lumograph090
What problem do you have now? Error when you try to save a map? So post line that contains error.
Or trigger don't work? So make dummy visible and selectable and look where is the problem. It always helped me.
 
Level 5
Joined
Oct 17, 2006
Messages
151
Sorry if I've offended you.
But I know no one pro in GUI ^^ No one knows all WE features. Even GUI.

You didn't offend me at all! I actually found it amusing that I didn't know that. Ive never tried linking to units like that hence I believed that it was impossible.

I would like to point out though that I call myself a pro in GUI because in every situation asking for help I have been able to give an answer (not always the best one because jazz swoops in on a shining beacon many times)
 
Level 3
Joined
Jan 26, 2009
Messages
36
@Lumograph090
What problem do you have now? Error when you try to save a map? So post line that contains error.
Or trigger don't work? So make dummy visible and selectable and look where is the problem. It always helped me.

Well, here is what I have so far.

  • Arcane Vortex Mana Drain
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Arcane Vortex
    • Actions
      • Set Point1 = (Target point of ability being cast)
      • Set Group1 = (Units within 260.00 of Point1 matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True) and (((Matching unit) is alive) Equal to True))))
      • Unit Group - Pick every unit in Group1 and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Arcane Vortex (Mana Drain) for (Owner of (Triggering unit)) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
          • Unit - Set level of Arcane Vortex (Battlemage - Mana Drain) for (Last created unit) to (Level of Arcane Vortex for (Triggering unit))
          • Unit - Order (Last created unit) to Night Elf Druid Of The Claw - Rejuvenation (Picked unit)
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Undead\DarkRitual\DarkRitualTarget.mdl
          • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation( udg_Point1 )
      • Custom script: call DestroyGroup( udg_Group1 )
The issue I'm having is I was told to use variables for this trigger, and then to use the custom scripts at the end, however I was told to use them as for example "call RemoveLocation( udg_Point[1] )", etc however when I save I get an error and it disables the trigger.

Regardless I just don't know why it is not working correctly as I have another ability which is based on Battle Roar that uses this GUI Trigger...

  • Arcane Instability
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Prismatic Cloak
    • Actions
      • For each (Integer A) from 1 to 15, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in (Units within 250.00 of (Position of (Casting unit)) matching (((Matching unit) belongs to an enemy of (Owner of (Casting unit))) Equal to True)) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is A structure) Equal to False
                  • ((Picked unit) is alive) Equal to True
                • Then - Actions
                  • Unit - Create 1 Arcane Instability (Damage) for (Owner of (Triggering unit)) at (Position of (Picked unit)) facing Default building facing degrees
                  • Unit - Set level of Arcane Instability (Battlemage - Damage) for (Last created unit) to (Level of Prismatic Cloak for (Triggering unit))
                  • Unit - Order (Last created unit) to Undead Lich - Frost Nova (Picked unit)
                  • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
                  • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Undead\DarkRitual\DarkRitualTarget.mdl
                  • Special Effect - Destroy (Last created special effect)
                • Else - Actions
                  • Do nothing
However, that trigger works PERFECTLY!

Its hurting my head!
 
Level 5
Joined
Oct 17, 2006
Messages
151
  • Arcane Vortex Mana Drain
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Arcane Vortex
    • Actions
      • Unit Group - Pick every unit in (Units within 250.00 of (Position of (Casting unit)) matching (((Matching unit) belongs to an enemy of (Owner of (Casting unit))) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Arcane Vortex (Mana Drain) for (Owner of (Triggering unit)) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
          • Unit - Set level of Arcane Vortex (Battlemage - Mana Drain) for (Last created unit) to (Level of Arcane Vortex for (Triggering unit))
          • Unit - Order (Last created unit) to Night Elf Druid Of The Claw - Rejuvenation (Picked unit)
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Undead\DarkRitual\DarkRitualTarget.mdl
          • Special Effect - Destroy (Last created special effect)
This should work... :wink:

Its shortened and its MUI =P (plus no nasty useless variables)

As I wrote that I noticed only one action refers to the picked unit inside the unit group. Why not include all the junk that has no relation to the picked unit out side of the unit group?
 
Level 3
Joined
Jan 26, 2009
Messages
36
Well, I've always been into the WC map edit, just never really got to in depth, I prefer to have things look good keep things neat, etc. I feel you can have very awesome, useful, and effective abilities with out a whole lot of work.

However, I have two heroes that I'm working on and I had wanted to try getting a little more in depth in terms of triggers, etc. Pretty much everything I know is through trial and error, self teaching, etc. I got the idea for these spells from this

Trigger Spells 101 - TDGwiki

so, maybe I just looked to copy the wrong thing and the person who made that ability didn't really know all that much. :p I'm going to re-trigger my ability in the way you listed and give it a shot!

*edit* Nothing, no units are created, no units lose mana. I changed the trigger to the follow...

  • Arcane Vortex Mana Drain
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Arcane Vortex
    • Actions
      • Unit Group - Pick every unit in (Units within 250.00 of (Target point of ability being cast) matching (((Matching unit) belongs to an enemy of (Owner of (Casting unit))) Equal to True)) and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Arcane Vortex (Mana Drain) for (Owner of (Triggering unit)) at (Target point of ability being cast) facing Default building facing degrees
          • Unit - Set level of Arcane Vortex (Battlemage - Mana Drain) for (Last created unit) to (Level of Arcane Vortex for (Triggering unit))
          • Unit - Order (Last created unit) to Night Elf Druid Of The Claw - Rejuvenation (Picked unit)
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Undead\DarkRitual\DarkRitualTarget.mdl
          • Special Effect - Destroy (Last created special effect)
The only thing I changed was...

  • Unit Group - Pick every unit in (Units within 250.00 of (Target point of ability being cast) matching (((Matching unit) belongs to an enemy of (Owner of (Casting unit))) Equal to True)) and do (Actions)
Because my spell is based off of channel, I use two triggers the first one just basically summons a dummy unit that casts Thunder Clap, that is where the damage comes from. That trigger works fine. I want the effect to only take place within 250 of the target point of ability being cast because my spell is suppose to be in a target area of 250.
 
Level 8
Joined
Aug 4, 2006
Messages
357
sure that way will work, but it will leak. Triggers - Memory Leaks
you can read more about "leaks" here. positions of units and unit groups are among some of the stuff that will lag up your map over time if not destroyed with custom scripts.

i think the problem with your original code had to do with the target of the ability. is it a point or a unit? you set "Point1" to "target point of ability being cast", while in the unit group loop you refer to "position of (target unit of ability being cast)". also, i'm not sure if "target point of ability being cast" even works with the event "unit starts effect of ability." also, once you make the "Point1" variable, you should refer to it inside the loop instead of trying to find the target again.
 
Level 3
Joined
Jan 26, 2009
Messages
36
I think I'm just going to delete the trigger and start from scratch. I deleted my Point and Group variables. I'm just going to describe what I want to do and maybe someone who knows what they fuck they are doing can explain to me exactly what I need to do, or just give me an example. I would be very grateful for that.

I have a dummy unit with the spell Rejuvenation set to a negative value for mana gained. I made sure it was set to be allowed to be cast on units even at full mana/heal, etc. My base spell is Blizzard for the AOE target Cursor and for added area of effect graphics.

What I want to happen is when I cast my ability a dummy unit will be created for every unit within the target point of my ability being cast and have the dummy unit then cast my Rejuvenation spell on their respective picked units.
 
Level 9
Joined
Apr 3, 2008
Messages
700
Triggering unit is better.
  • Unit Group - Pick every unit in (Units within 250.00 of (Position of (Casting unit)) matching (((Matching unit) belongs to an enemy of (Owner of (Casting unit))) Equal to True)) and do (Actions)
I see no mistake in both triggers.

Possible reasons:
1. Wrong variable values.
2. Dummy recieves a wrong order to cast a spell.
3. Dummy have no mana to cast a spell.
4. Invalid order ID.
 
Level 3
Joined
Jan 26, 2009
Messages
36
Triggering unit is better.
  • Unit Group - Pick every unit in (Units within 250.00 of (Position of (Casting unit)) matching (((Matching unit) belongs to an enemy of (Owner of (Casting unit))) Equal to True)) and do (Actions)
I see no mistake in both triggers.

Possible reasons:
1. Wrong variable values.
2. Dummy recieves a wrong order to cast a spell.
3. Dummy have no mana to cast a spell.
4. Invalid order ID.

See that one confuses me because 2,3, and 4 are all 100% working. I have checked and rechecked everything. I just think the issue is because I'm trying to maybe do two different things at once.

My trigger would look like this...

  • Unit Group - Pick every unit in (Units within 250.00 of (Target point of Ability being cast) matching (((Matching unit) belongs to an enemy of (Owner of (Casting unit))) Equal to True)) and do (Actions)
I, dunno, again what I'm doing is creating the dummy units at the target point of the ability being cast so my dummy unit is being created in the center of that target point but then I think the trigger just fails or just stops looping because only 1 unit is even being created.

However, when I use this same try of set up for another one of my heros abilities where I have it work off of the casting unit, like "units within 250 of (casting unit)" etc it works fine.
 
Level 3
Joined
Jan 26, 2009
Messages
36
So here is my new rendition of this disaster

  • Arcane Vortex Mana Drain
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Arcane Vortex
    • Actions
      • Unit Group - Pick every unit in Group1 and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Arcane Vortex (Mana Drain) for (Owner of (Casting unit)) at (Target point of ability being cast) facing (Facing of (Casting unit)) degrees
          • Unit - Set level of Arcane Vortex (Battlemage - Mana Drain) for (Last created unit) to 1
          • Unit - Order (Last created unit) to Night Elf Druid Of The Claw - Rejuvenation (Picked unit)
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • Special Effect - Create a special effect at (Target point of ability being cast) using Abilities\Spells\Undead\DarkRitual\DarkRitualTarget.mdl
          • Special Effect - Destroy (Last created special effect)
      • Custom script: call DestroyGroup( udg_Group1 )
 
Status
Not open for further replies.
Top