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

Need help with 2 things.

Status
Not open for further replies.
Level 3
Joined
Oct 8, 2007
Messages
60
First: I need to make a state called INFIGHT. infight should set a variable to 1 when a unit is fighting and then set it back to 0 when it has stoped fighting(even if it didnt kill its target)

Second: Damage reducment,
considering im makeing a rpg and the units gain levels i need the armor reducment to be working correctly each level, i "NEED" to use this formula:
JASS:
Reducment % = (Armor / (Armor + 400 + 85 x X)) x 100
X = Either Hero level or better yet the attacking units level!important!

ive played around and cant find anyway to do either of these things, please help me! :cry::cry::cry::cry:
 
Last edited:
Level 10
Joined
Jul 14, 2004
Messages
463
For the first: You cannot add a state that easily. I'd try to solve the problem by a boolean and a timer array for each unit, using the units custom value for as the considering array index. Make a trigger
  • unit attacked
    • Events
      • Unit - A unit Wird angegriffen
    • Conditions
    • Actions
      • Set isAttacking[(Custom value of (Attacking unit))] = True
      • Countdown-Timer - Start AttackingTimers[(Custom value of (Attacking unit))] as a One-time timer that will expire in 1.20 seconds
And a periodic trigger:
  • unit stop attack check
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unitgroup - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop-Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • IF-Conditions
              • isAttacking[(Custom value of (Picked unit))] Gleich True
              • (Remaining time for AttackingTimers[(Custom value of (Picked unit))]) Gleich 0.00
            • 'THEN'-Actions
              • Set isAttacking[(Custom value of (Picked unit))] = False
            • 'ELSE'-Actions
[argh, I only have the german editor atm and don't know the english completely so some icons don't work, I hope you understand it anyways]
At initialization, you have to pick every unit and attach each a timer and bool to it by setting their custom value.

This is the principe I'd try it; of course you should try to get this leak-free. If you have any further questions, ask again.

Concerning the second thing, I have no idea, too. :confused:
 
Status
Not open for further replies.
Top