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

How to use a variable in an event

Status
Not open for further replies.
Level 2
Joined
May 16, 2013
Messages
27
I made a variable for a unit in order to select it as a part of my event. This event limits a hero's mana to 100 if it exceeds 100. Whenever I try to change where it says "unit" to my variable, it just keeps choosing the unit as one from the drop down list. Anyone know how to select a variable for an event unit?
 
Level 30
Joined
Nov 29, 2012
Messages
6,637
@OP - Original Poster
Why not just use this trigger in the events?

  • Unit - Knight 0002 <gen>'s mana becomes Greater than 100.00
Example is this, wen the unit's mana becomes greater than 100, do whatever you want with the Condition and Events.

And as far as I can see, you are trying to make a mana like of a Rage that doesnt exceed 100 right?

EDIT: Oh, I understand your problem now, it keeps showing units and not your variable right? Well, just try doing an If/Then/Else then in IF put this,

  • (Mana of (Triggering unit)) Greater than 100.00
Then in Then and Else, it depends on what you want to do.
 
Level 2
Joined
May 16, 2013
Messages
27
So, how would it target my hero though? I have the I/T/E set up, looks functional, but Where do I trigger in my hero?
In other words, how would I make my hero the triggering unit?
 
Level 30
Joined
Nov 29, 2012
Messages
6,637
So, how would it target my hero though? I have the I/T/E set up, looks functional, but Where do I trigger in my hero?
In other words, how would I make my hero the triggering unit?

In the condition put your hero as unit type of triggering unit and in the Real put Unit type of triggering unit so that will make the triggering unit as your hero.
 
Level 30
Joined
Nov 29, 2012
Messages
6,637
Right now I have:

Event---(None)
Condition---(Unit type of (triggering unit)) Equal to Flamerunner*
Action---If ((Mana of (Triggering unit)) Greater than 100.00) then do (Unit - Set mana of (Triggering unit) to 100.00) else do (Do nothing).

*my hero's name. Also, thank you for the time in helping me, I'm literally brand new to this whole thing.

Remove Do Nothing, it just used up space. Leave Else with nothing.
 
Level 2
Joined
May 16, 2013
Messages
27
What I have is..

Event --
Condition -- (Unit-type of (Triggering unit)) Equal to Flamerunner
Action -- If ((Mana of (Triggering unit)) Greater than 100.00) then do (Unit - Set mana of (Triggering unit) to 100.00) else do (Do nothing)

I thank you both for your time helping btw, rep for sure.

Also, Death, I'm inexperienced as I said, and yes I did look. I'm not sure what to make of it as all I need is my hero to be set up in a trigger wherein his mana gets set to 100 if its over 100. Only my one Flamerunner hero. I'll look it over again in an attempt to understand it.
 
ok in this one
  • Hero selection
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • ((Sold unit) is A Hero) Equal to True
      • (Unit-type of (Sold unit)) Equal to Archmage
    • Actions
      • Set tempUnit = (Sold unit)
      • Set maxIndex = (maxIndex + 1)
      • Set heroPlayer[maxIndex] = (Sold unit)
change the archmage to flamerunner and ur done already u dont have to touch anything else.

u need both that trigger above and this trigger.
  • Set hero mana to 100
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer tempInt) from 1 to maxIndex, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Mana of heroPlayer[tempInt]) Greater than 100.00
            • Then - Actions
              • Unit - Set mana of heroPlayer[tempInt] to 100.00
            • Else - Actions
u dont need anything else.

Did u even test it to see how it worked ?
 
Level 30
Joined
Nov 29, 2012
Messages
6,637
What I have is..

Event --
Condition -- (Unit-type of (Triggering unit)) Equal to Flamerunner
Action -- If ((Mana of (Triggering unit)) Greater than 100.00) then do (Unit - Set mana of (Triggering unit) to 100.00) else do (Do nothing)

I thank you both for your time helping btw, rep for sure.

Also, Death, I'm inexperienced as I said, and yes I did look. I'm not sure what to make of it as all I need is my hero to be set up in a trigger wherein his mana gets set to 100 if its over 100. Only my one Flamerunner hero. I'll look it over again in an attempt to understand it.

But if its a hero you should set the Intelligence of the hero to 0 and it should never increase or it will increase mana too. Dont forget too... set the mana of hero to 100.... even the max mana.
 
Level 2
Joined
May 16, 2013
Messages
27
How would I do this for multiple characters? What would I change in the trigger you gave me Death?
 
in this first trigger
  • Hero selection
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • ((Sold unit) is A Hero) Equal to True
      • (Unit-type of (Sold unit)) Equal to Archmage
    • Actions
      • Set tempUnit = (Sold unit)
      • Set maxIndex = (maxIndex + 1)
      • Set heroPlayer[maxIndex] = (Sold unit)
were it says this
  • (Unit-type of (Sold unit)) Equal to Archmage
add the same thing just change the Archmage to what u want. So say u want a Paladin to be in this also u would do this.
  • Hero selection
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • ((Sold unit) is A Hero) Equal to True
      • (Unit-type of (Sold unit)) Equal to Archmage
      • (Unit-type of (Sold unit)) Equal to Paladin
    • Actions
      • Set tempUnit = (Sold unit)
      • Set maxIndex = (maxIndex + 1)
      • Set heroPlayer[maxIndex] = (Sold unit)
 
Level 2
Joined
May 16, 2013
Messages
27
Mad rep for both of you, without you guys I would've given up. Thanks a million. I understand the trigger now. I was frustrated earlier and didn't read it in depth. Thank the lord and you two. :D
 
Status
Not open for further replies.
Top