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

mana and hp restoration (10% chance when attacking.)

Status
Not open for further replies.
Level 5
Joined
Aug 23, 2007
Messages
141
I need help with an item ability. I want it to have a 10% chance to restore 100hp and 50mana when attacking.
 
Level 2
Joined
Sep 17, 2007
Messages
12
Sorry new to these forums, dont know all the tags to make code look proper.

  • Blah:
  • Events
  • Unit is Attacked
  • Conditions
  • ((Attacking Unit) has item of type "Your Item") Equal to True
  • Actions
  • Set Variable Int = (Random Integer number between 1 and 10)
  • If (all conditions are true) then do (then actions) else do (else actions)
  • If - Conditions
  • Int greater than 9
  • Then - Actions
  • Unit - Set (Life of Triggering Unit) To ((Life of Triggering Unit) + 100)
  • Unit - Set (Mana of Triggering Unit) To ((Mana of Triggering Unit) + 50)
  • Else - Actions
  • Do Nothing
 
Last edited:
Level 2
Joined
Jun 3, 2007
Messages
20
Do you mean int greater then 9 other wise you would have a 20% chance as opposed to equal to or greater then...
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
Sorry new to these forums, dont know all the tags to make code look proper.

  • Blah:
  • Events
    • Unit is Attacked
  • Conditions
    • ((Attacking Unit) has item of type "Your Item") Equal to True
  • Actions
    • Set Variable Int = (Random Integer number between 1 and 10)
    • If (all conditions are true) then do (then actions) else do (else actions)
      • If - Conditions
        • Int greater than 9
      • Then - Actions
        • Unit - Set (Life of Triggering Unit) To ((Life of Triggering Unit) + 100)
        • Unit - Set (Mana of Triggering Unit) To ((Mana of Triggering Unit) + 50)
      • Else - Actions

would be nicer...
 
Level 5
Joined
Aug 23, 2007
Messages
141
Hehe. Yeah. I thought at first Eleandor was talking bout how it performs in the game when its basically the same code.
 
Status
Not open for further replies.
Top