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

Problem with a loop

Status
Not open for further replies.
Level 3
Joined
Aug 20, 2012
Messages
36
Problem with a loop (updated

What I want to do is to make my damage displaying floating text to smoothly decrease it's size from 15 to 10, my trigger only works for the first few floating texts, then it stops working and all of the new floating texts stay at size 15.

Here are my triggers:

  • Dmg Float Run 1
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • (GDD_DamageSource belongs to an ally of Player 1 (Red)) Equal to True
      • (GDD_DamageSource is Summoned) Equal to False
      • (Integer(GDD_Damage)) Not equal to 0
    • Actions
      • Set Float_DMGTimes = (Float_DMGTimes + 1)
      • Set Float_DMG[Float_DMGTimes] = (Integer(GDD_Damage))
      • Floating Text - Create floating text that reads (String(Float_DMG[Float_DMGTimes])) at (Random point in (Region centered at (Position of GDD_DamagedUnit) with size (50.00, 0.00))) with Z offset 40.00, using font size 15.00, color (80.00%, 80.00%, 80.00%), and 0.00% transparency
      • Set Float_DMGSize[Float_DMGTimes] = 15.00
      • Set Float_DMGFloatingText[Float_DMGTimes] = (Last created floating text)
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Set the velocity of (Last created floating text) to 75.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 2.50 seconds
      • Trigger - Turn on Dmg Float Loop <gen>
  • Dmg Float Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Float_DMGLoop) from 1 to Float_DMGTimes, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Float_DMGSize[Float_DMGLoop] Greater than or equal to 10.00
            • Then - Actions
              • Set Float_DMGSize[Float_DMGLoop] = (Float_DMGSize[Float_DMGLoop] - 0.50)
              • Floating Text - Change text of Float_DMGFloatingText[Float_DMGLoop] to (String(Float_DMG[Float_DMGLoop])) using font size Float_DMGSize[Float_DMGLoop]
            • Else - Actions
              • Trigger - Turn off (This trigger)
 
Last edited:
Level 9
Joined
Jul 10, 2011
Messages
562
im not totally sure but the problem could be this :

you set an index (Float_DMGTimes) +1 if a unit is damaged. thats okay.

then in the loop you do from 1 to that index do XY.

but if the index is 2 for example but for index 1 Float_DMGSize[Float_DMGLoop] Less than or equal to 10.00 then you turn off the trigger and set the index to 0 so for the index 2 nothing happens anymore if the periodic timer runs a second time.

so dont set the index to 0 there....do an additional check whether all Float_DMGSize values are less or equal to 10.00 and then set the index to 0. or just make an if/then/else check in the first trigger where you check whether the index is for example 100 or higher and if so set the index to 1 again else set it to Float_DMGTimes = (Float_DMGTimes + 1).

i hope you get what i mean^^ im in a hurry at the moment so i just wrote that answer as fast as possible ^^
 
Level 3
Joined
Aug 20, 2012
Messages
36
Oh you're right; Set Float_DMGTimes = 0 Removes all the attacks made, making the loop not do the actions for the already active texts, thanks clap, helpful as usual :)
 
Level 8
Joined
Oct 26, 2008
Messages
387
I am sorry, i am unfamiliar with what you use. I believe you use a system, it all starts with this,

  • Game - GDD_Event becomes Equal to 0.00
I don't understand what this is so i kinda get lost and cannot reply to you very well..
 
Level 12
Joined
Sep 11, 2011
Messages
1,176
I am sorry, i am unfamiliar with what you use. I believe you use a system, it all starts with this,

  • Game - GDD_Event becomes Equal to 0.00
I don't understand what this is so i kinda get lost and cannot reply to you very well..

it's Weep's GUI-Friendly Damage Detection System http://www.hiveworkshop.com/forums/spells-569/gui-friendly-damage-detection-v1-2-1-a-149098/

it's just replacing "A unit is attacked" with "GDD_Event equal to 0.00", "DamageSource" with "Attacking Unit", "DamagedUnit" with "Attacked Unit", "GDD_Damage" with "Damage Taken" and so on ":)
 
Level 8
Joined
Oct 26, 2008
Messages
387
Well i am sorry, if there is something that bugs it inside the triggers you posted, it eludes me.

Maybe if you want, send me the map and i can check it further and test it. Or someone can appear and can see what i can't :/
 
Level 3
Joined
Aug 20, 2012
Messages
36
it worked, right ? don't just say "updated", we don't know whether you've fixed your problem or not.. test it and report it to us if there is anything wrong..

I added updated cause I rewrote the whole thread with an other problem that occured (same topic), so the first few posts are not relevant, that's what I wanted to inform you and no, it's not fixed.

I'll copy the triggers to a new map and upload it as an attachment asap to let maestros try it out.
 
Status
Not open for further replies.
Top