• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

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?
 
@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.
 
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?
 
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.
 
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 ?
 
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.
 
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)
 
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.
Back
Top