Combat System

Leazy

You can change this now in User CP.
Reaction score
50
Hello!

I've made a ''combat system''. Similar to the system in WoW. If you take or deal damage, you will be in combat for 7 seconds. Being in combat has different disadvantages and advantages. Example: Warrior will not lose rage in combat, but can't charge unless he is out of combat. I made these two triggers:

Trigger:
  • Enter Combat
    • Events
    • Conditions
    • Actions
      • -------- Floating Text Displaying: Entering Combat (Display to Damage Target) --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CombatCount[(Player number of (Owner of (Triggering unit)))] Equal to 0
        • Then - Actions
          • Set General_Unitgroup[1] = (Units owned by (Owner of (Triggering unit)) matching (((Matching unit) is A Hero) Equal to True))
          • Unit Group - Pick every unit in General_Unitgroup[1] and do (Set General_Point[1] = (Position of (Picked unit)))
          • Floating Text - Create floating text that reads |cffFF0000Entering ... at General_Point[1] with Z offset 75.00, using font size 9.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 0.75 seconds
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Hide (Last created floating text) for (All players)
          • Floating Text - Show (Last created floating text) for (Player group((Owner of (Triggering unit))))
          • Custom script: call RemoveLocation (udg_General_Point[1])
          • Custom script: call DestroyGroup(udg_General_Unitgroup[1])
        • Else - Actions
      • -------- Floating Text Displaying: Entering Combat (Display to Damage Source) --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CombatCount[(Player number of (Owner of (Damage source)))] Equal to 0
        • Then - Actions
          • Set General_Unitgroup[1] = (Units owned by (Owner of (Damage source)) matching (((Matching unit) is A Hero) Equal to True))
          • Unit Group - Pick every unit in General_Unitgroup[1] and do (Set General_Point[1] = (Position of (Picked unit)))
          • Floating Text - Create floating text that reads |cffFF0000Entering ... at General_Point[1] with Z offset 75.00, using font size 9.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 0.75 seconds
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Hide (Last created floating text) for (All players)
          • Floating Text - Show (Last created floating text) for (Player group((Owner of (Damage source))))
          • Custom script: call RemoveLocation (udg_General_Point[1])
          • Custom script: call DestroyGroup(udg_General_Unitgroup[1])
        • Else - Actions
      • -------- Enter Combat --------
      • Set General_Integer[1] = 7
      • Set CombatCount[(Player number of (Owner of (Triggering unit)))] = General_Integer[1]
      • Set CombatCount[(Player number of (Owner of (Damage source)))] = General_Integer[1]


Trigger:
  • Decrease Combat Count
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CombatCount[(Integer A)] Greater than 0
            • Then - Actions
              • Set CombatCount[(Integer A)] = (CombatCount[(Integer A)] - 1)
              • -------- Leave Combat --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CombatCount[(Integer A)] Equal to 0
                • Then - Actions
                  • Set General_Unitgroup[1] = (Units owned by (Player((Integer A))) matching (((Matching unit) is A Hero) Equal to True))
                  • Unit Group - Pick every unit in General_Unitgroup[1] and do (Actions)
                    • Loop - Actions
                      • Set General_Point[1] = (Position of (Picked unit))
                      • Floating Text - Create floating text that reads |cff00FF00Leaving C... at General_Point[1] with Z offset 75.00, using font size 9.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                      • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
                      • Floating Text - Change the fading age of (Last created floating text) to 0.75 seconds
                      • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
                      • Floating Text - Change (Last created floating text): Disable permanence
                      • Floating Text - Hide (Last created floating text) for (All players)
                      • Floating Text - Show (Last created floating text) for (Player group((Player((Integer A)))))
                      • Custom script: call RemoveLocation (udg_General_Point[1])
                  • Set InCombat[(Integer A)] = False
                  • Custom script: call DestroyGroup(udg_General_Unitgroup[1])
                • Else - Actions
                  • Set InCombat[(Integer A)] = True
            • Else - Actions


My problem is that the text ''Entering Combat'' or the text ''Leaving Combat'' does not seam to always shop up, and units does not always leave and enter combat right. What could be wrong? :S

P.S: The event for the ''Enter Combat'' trigger is set up through another trigger. Here it is:

Code:
Setup Entering Unit Triggers Add
    Events
        Unit - A unit enters (Playable map area)
    Conditions
    Actions
        -------- Rogue Related --------
        Trigger - Add to Remove Stealth When Taking or Dealing DMG <gen> the event (Unit - (Triggering unit) Takes damage)
        Trigger - Add to Shadowstep Extra DMG <gen> the event (Unit - (Triggering unit) Takes damage)
        -------- Warrior Related --------
        Trigger - Add to Add Rage <gen> the event (Unit - (Triggering unit) Takes damage)
        Trigger - Add to Recklessness Extra DMG <gen> the event (Unit - (Triggering unit) Takes damage)
        Trigger - Add to Execute Ready <gen> the event (Unit - (Triggering unit)'s life becomes Less than ((Max life of (Triggering unit)) / 5.00))
        -------- Miscellaneous --------
        [COLOR="Red"]Trigger - Add to Enter Combat <gen> the event (Unit - (Triggering unit) Takes damage)[/COLOR]
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top