• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!

[Solved] I don't know how to describe.

Status
Not open for further replies.
Level 17
Joined
Jun 2, 2009
Messages
1,193
In my map you cannot attack allied units unless their hit points below 150.
Now i have created item that allows you attack them when their hit points below 200.

  • Ally no attack
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Owner of (Attacked unit)) is an ally of (Owner of (Attacking unit))) Equal to True
      • (Life of (Attacked unit)) Greater than or equal to 150.00
    • Actions
      • Unit - Order (Attacking unit) to Stop
I have to think reversed and it looks so difficult.

I am currently working like this but i am totally confused.

  • Ally no attack creep Copy
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Owner of (Attacked unit)) is an ally of (Owner of (Attacking unit))) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Life of (Attacked unit)) Greater than or equal to 150.00
          • And - All (Conditions) are true
            • Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • ((Attacking unit) has an item of type Dagger of Sacrifice) Equal to False
                  • ((Attacking unit) has an item of type Enchanted Spear) Equal to False
        • Then - Actions
          • Unit - Order (Attacking unit) to Stop
          • Game - Display to (All players) for 5.00 seconds the text: HP greater than 150...
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Life of (Attacked unit)) Less than or equal to 200.00
              • And - All (Conditions) are true
                • Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • ((Attacking unit) has an item of type Dagger of Sacrifice) Equal to True
                      • ((Attacking unit) has an item of type Enchanted Spear) Equal to True
            • Then - Actions
              • Unit - Order (Attacking unit) to Stop
              • Game - Display to (All players) for 5.00 seconds the text: HP greater than 200...
            • Else - Actions
How can i make this system?
 

Remixer

Map Reviewer
Level 31
Joined
Feb 19, 2011
Messages
1,979
  • Trigger
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Set VariableSet target = (Triggering unit)
      • Set VariableSet attacker = (Attacking unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (attacker belongs to an ally of (Owner of target).) Equal to True
        • Then - Actions
          • Set VariableSet treshold = 150.00
          • Set VariableSet health = (Life of target)
          • -------- Here you can add whatever things may affect the treshold (items, abilities, buffs, unit types) --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (attacker has an item of type Cheese) Equal to True
            • Then - Actions
              • Set VariableSet treshold = (treshold + 50.00)
            • Else - Actions
              • -------- Any additional interactions preferably here... --------
          • -------- This is the last check to see if the attack needs to be stopped after all: --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • treshold Greater than health
            • Then - Actions
              • -------- Then allow the attack, since target's health is below treshold --------
            • Else - Actions
              • Unit - Interrupt attacker's Attack
        • Else - Actions
          • -------- The unit is not an ally - so do nothing. --------
Note: I used the "Interrupt attack" action instead - but you can use stop.
 
Level 41
Joined
Feb 27, 2007
Messages
5,183
For the sake of example this is how I would do it. Boolean variables can be quite useful.
  • Pyro Ally no attack creep
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Triggering Unit) belongs to an Ally of (Owner of (Attacking Unit))) equal to True
    • Actions
      • Set HasItem = ((((Attacking unit) has an item of type Enchanted Spear) equal to True) OR (((Attacking unit) has an item of type Dagger of Sacrifice) equal to True))
      • Set Life = (Life of (Attacked unit))
      • If (All conditions are true) then do (Then actions) else do (Else actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • ((HasItem equal to False) AND (Life Greater than 150.00))
            • ((HasItem equal to True) AND (Life Greater than 200.00))
        • Then - Actions
          • Unit - Order (Attacking unit) to Stop
        • Else - Actions
 
Status
Not open for further replies.
Top