• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Solved] Need help with "start attack ability"

Level 12
Joined
Oct 28, 2019
Messages
485
hello, When a unit enters in combat it changes its ownership. (This is for some units not all). After a moment, if there´s no enemies near, it changes the ownership to the player again.
This is already made. Follows:
  • Start Fight
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Owner of (Attacking unit)) Equal to Player 1 (Red)
      • ((Attacked unit) is A structure) Equal to False
      • ((Unit-type of (Attacking unit)) Equal to Militia) or (((Unit-type of (Attacking unit)) Equal to Swordman) or (((Unit-type of (Attacking unit)) Equal to Elven Spearman) or (((Unit-type of (Attacking unit)) Equal to Black Legion Footman) or ((Unit-type of (Attacking unit)) Equal to Black Legion Pikeman))))
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (UnitGroup is empty) Equal to True
        • Then - Actions
          • Trigger - Turn on End fight loop <gen>
        • Else - Actions
      • Unit Group - Add (Attacking unit) to UnitGroup
      • Unit - Change ownership of (Attacking unit) to Player 3 (Teal) and Retain color
  • End fight loop Copy
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in UnitGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet Point = (Position of (Picked unit))
          • Set VariableSet UnitsInRangeGroup = (Units within 500.00 of Point matching (((Matching unit) belongs to an enemy of Player 1 (Red).) Equal to True).)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (UnitsInRangeGroup is empty) Equal to True
                  • (All units of UnitsInRangeGroup are dead) Equal to True
            • Then - Actions
              • Unit - Change ownership of (Picked unit) to Player 1 (Red) and Retain color
              • Unit Group - Pick every unit in (Units owned by Player 1 (Red) matching (((Unit-type of (Matching unit)) Equal to Black Legion Footman) or (((Unit-type of (Matching unit)) Equal to Militia) or ((Unit-type of (Matching unit)) Equal to Swordman))).) and do (Unit - Add Charge to (Picked unit))
              • Unit Group - Remove (Picked unit) from UnitGroup.
            • Else - Actions
          • -------- destroy the unit group and point here to avoid leaks --------
          • Custom script: call DestroyGroup(udg_UnitsInRangeGroup)
          • Custom script: call RemoveLocation(udg_Point)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (UnitGroup is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
But now Im trying making other ability to infantry, "start attack", or "charge". When cast this the unit changes ownership to Player 3 and runs faster with a polar offset of his facing angle,

  • Charge Ability
    • Events
      • Unit - A unit owned by Player 1 (Red) Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Charge
    • Actions
      • Set VariableSet Point_Charge = ((Position of (Casting unit)) offset by 1500.00 towards (Facing of (Casting unit)) degrees.)
      • Unit - Change ownership of (Casting unit) to Player 3 (Teal) and Retain color
      • AI - Ignore (Casting unit)'s guard position
      • Unit - Order (Casting unit) to Attack-Move To Point_Charge
      • Unit Group - Add (Casting unit) to UnitGroup
      • Custom script: call RemoveLocation(udg_Point_Charge)
      • Wait 6.00 seconds
      • Trigger - Turn on End fight loop Copy <gen>
Now is bugging, I need that when the charge finishes it backs ownership to P1, the P3 units and IA computers are casting charge everytime and I would like to improve this system, for this Im loooking here! :grin:
 

Attachments

  • KAM SINGLE.w3x
    18.6 KB · Views: 1
Last edited:
Level 12
Joined
Oct 28, 2019
Messages
485
up!, any help ?

solved Uncle replied an old thread

 
Last edited:
Top