How to prevent this trigger loop

Nathan0093

New Member
Reaction score
4
Code:
Initial Units
    Events
        Map initialization
    Conditions
    Actions
        Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
            Loop - Actions
                Trigger - Add to Extra Damage <gen> the event (Unit - (Picked unit) Takes damage)

Code:
Extra Damage
    Events
    Conditions
        (Unit-type of (Triggering unit)) Equal to (==) Footman
        (Unit-type of (Damage source)) Equal to (==) Knight
    Actions
        Wait 0.01 game-time seconds
        Unit - Cause (Damage source) to damage (Triggering unit), dealing 20.00 damage of attack type Normal and damage type Force
        Set loc = (Position of (Triggering unit))
        Floating Text - Create floating text that reads ((String((Integer((Damage taken))))) + !) at loc with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
        Floating Text - Change (Last created floating text): Disable permanence
        Floating Text - Set the velocity of (Last created floating text) to 15.00 towards 90.00 degrees
        Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
        Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds

I was playing around with these triggers, but I encountered a problem. What I want to happen is when x unit attacks y unit, x would deal a certain amount of extra damage to y. The problem is that after x deals the extra damage, that damage repeatedly triggers this event until y unit dies. Is there anyway to prevent this loop from happening? I tried to look for a condition that detects the type of damage dealt, but I had no luck. A variable for damage type (unknown, normal, force, enhanced, etc.) is there, but there is no condition to check for the damage type. Help?
 

DrEvil

FCRI Associate!
Reaction score
111
This should stop the infinite looping :

Code:
Trigger - Turn off (This trigger)
Unit - Cause (Damage source) to damage (Triggering unit), dealing 20.00 damage of attack type Normal and damage type Force
Wait 0.30 seconds // < -- 0.3 is about the minimum it waits anyway
Trigger - Turn on (This trigger)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top