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

Integer Question.

Status
Not open for further replies.
Level 2
Joined
May 26, 2011
Messages
14
Hi.
My Engligh is bad, so I will try to be as clear as I can xD
So...
I have integer variable, I made trigger when hero kills unit that integer goes up...
  • test_integer
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Killing unit)) Equal to Paladin
    • Actions
      • Set test_integer = (test_integer + 1)
      • Floating Text - Create floating text that reads (String(test_integer)) above (Killing unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
Now what I want and what I dont know how to do is:
I wanna integer to stop counting kills when it reach 10
tnx for help

And btw. tell me how to give you guys +rep and other... :goblin_yeah:
 
Add an if/then/else:
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Integer Less than 10
      • Then - Actions
        • Set Integer = (Integer + 1)
        • Floating Text - Create floating text that reads (String(Integer)) above (Killing unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
        • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
        • Floating Text - Change (Last created floating text): Disable permanence
        • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
      • Else - Actions
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
The idea is to use flow control statements to restrict the execution of the statement which incriments the integer variable when under a certain condition (the variable is equal to 10). The if then construct enables exactly this when used with an appropiate logic expression as seen above.

This is a key part of programming as it allows you to alter the code being executed under certain conditions. An example in WC3 is that you can use this with GetLocalPlayer() to locally display a multiboard as you can restrict the display call to only 1 player.
 
Status
Not open for further replies.
Top