• 🏆 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!

[Trigger] Unit Group - Fail?

Status
Not open for further replies.
The trigger works, except for the part where it should filter out the units that have already been hit...
  • Attack StrikeLoop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Remaining time for Attack_StrikeTimer[(Integer A)]) Greater than 0.00
              • Attack[(Integer A)] Equal to True
              • Or - Any (Conditions) are true
                • Conditions
                  • Player_WeaponOption[(Integer A)] Equal to 0
                  • Player_WeaponOption[(Integer A)] Equal to 1
            • Then - Actions
              • Set Blank_Point[0] = (Position of Player[(Integer A)])
              • Set Blank_Point[1] = (Blank_Point[0] offset by 3.50 towards (Facing of Player[(Integer A)]) degrees)
              • Custom script: call SetUnitX(udg_Player[bj_forLoopAIndex], (GetLocationX(udg_Blank_Point[1])))
              • Custom script: call SetUnitY(udg_Player[bj_forLoopAIndex], (GetLocationY(udg_Blank_Point[1])))
              • Set Blank_Point[2] = (Blank_Point[0] offset by 80.00 towards (Facing of Player[(Integer A)]) degrees)
              • Set Attack_Group = (Units within 80.00 of Blank_Point[2] matching ((((Matching unit) belongs to an enemy of (Player((Integer A)))) Equal to True) and (0.00 Greater than or equal to 0.00)))
              • Unit Group - Pick every unit in Attack_Group and do (Actions)
                • Loop - Actions
                  • Set TempUnit = (Picked unit)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (TempUnit is in Attack_HitGroup[(Integer A)]) Equal to False
                    • Then - Actions
                      • Unit - Cause Player[(Integer A)] to damage TempUnit, dealing (Weapon_Damage[(Integer A)] x (1.00 + ((Real(Player_StatsConstitution[(Integer A)])) / 100.00))) damage of attack type Normal and damage type Normal
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Number of units in Attack_HitGroup[(Integer A)]) Equal to 0
                        • Then - Actions
                          • Set Attack_HitGroup[(Integer A)] = (Units owned by Player 1 (Red))
                          • Unit Group - Remove all units from Attack_HitGroup[(Integer A)]
                          • Unit Group - Add TempUnit to Attack_HitGroup[(Integer A)]
                        • Else - Actions
                          • Unit Group - Add TempUnit to Attack_HitGroup[(Integer A)]
                    • Else - Actions
              • Custom script: call DestroyGroup(udg_Attack_Group)
              • Custom script: call RemoveLocation(udg_Blank_Point[0])
              • Custom script: call RemoveLocation(udg_Blank_Point[1])
              • Custom script: call RemoveLocation(udg_Blank_Point[2])
            • Else - Actions
Any ideas?
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
As said above remove integer A / B and replace with a custom integer variable. (Will not fix problem. It is only for optimizations as integer A / B are slower)

Place some debug messages to make sure this trigger fires. Then place a few messages in the code to see what runs and what doesn't.

This also loops from 1 - 4 which means it is not MUI.
Please supply the other code for adding units to unit group.
 
Status
Not open for further replies.
Top