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

Is there a percentage function in the editor?

Status
Not open for further replies.
Level 19
Joined
May 1, 2008
Messages
1,130
sorry for not understanding d'ohh but random percentage doesn't have any functions but if this helps u can use it like this o_O

  • Unit - Set mana of (Triggering unit) to (Random percentage)%
random percentage can be used in autocasting spells (%= number betwen 0 and 100)
 
Last edited:
Level 7
Joined
Feb 28, 2005
Messages
122
What I'm doing is:
Events
Unit - A unit Is attacked
Conditions
(Unit-type of (Attacked unit)) Equal to Lumber Mill

Now, in order to do the action I need a percentage function so I can put in 50% for example.
I want, when the lumber mill's health drops below 50%, the player attacking it captures it.
 
Level 19
Joined
May 1, 2008
Messages
1,130
  • Events
    • Unit - A unit Is attacked
    • Conditions
      • ((Unit-type of (Attacked unit)) Equal to lumbermill) and ((Life of (Attacked unit)) Less than or equal to 50.00)
find the second condition under "real comparison" - "unit percentage life"
 
Level 9
Joined
Oct 7, 2007
Messages
599
Raid1000, that doesn't work as intended. Life of Attacked Unit doesn't return a percentage.

Anteep, here's your simple solution since you've finally made it clear what you wanted to:

((Life of (Attacked Unit) / Max Life of (Attacked Unit)) less than or equal to 50)

A percentage is just a number over the intended. In this case, the current over the maximum.
 
Level 7
Joined
Feb 28, 2005
Messages
122
Thanks all, this is the trigger I ended up doing and it works:


Events
Unit - A unit Is attacked
Conditions
((Unit-type of (Attacked unit)) Equal to Quarry [1]) and ((Percentage life of (Attacked unit)) Less than or equal to 50.00)
Actions
Unit - Change ownership of (Attacked unit) to (Owner of (Attacking unit)) and Change color
Unit - Set life of (Attacked unit) to 100.00%
 
Level 5
Joined
Oct 3, 2008
Messages
104
Raid1000, that doesn't work as intended. Life of Attacked Unit doesn't return a percentage.

Anteep, here's your simple solution since you've finally made it clear what you wanted to:

((Life of (Attacked Unit) / Max Life of (Attacked Unit)) less than or equal to 50)

A percentage is just a number over the intended. In this case, the current over the maximum.

in the trigger u proposed, u will need to use 0.5 instead of 50
 
Status
Not open for further replies.
Top