Bounce of Wall, Freezes[HELP]

Status
Not open for further replies.
Level 3
Joined
Aug 21, 2009
Messages
73
The problem is solved in it's way but I still have complications like how to make the balls bounce of other units in the right angle. Any ideas are greatly apreciated. :) [NEW TRIGGERS IN COMMENT(way better ones too :p]

In this map I have 4 walls 4 triggers 2 and 2 are indentical, still the left and the down wall triggers freezes the game I have no, no idea how and why this happens ?!? The most weird is that the upper is equal to downer and left is equal to right, but still they glitch.
And theese triggers are most probably a leak feast but that's not important It's just the wall calculation im after. My way doing it is surely terrible too :p But what I want to know is why it freezes when I make the "Ball" unit enter left and south region. (to make em move Attack them with the footman)
---THIS IS A LEAK FEAST---
---I know I need to update the Position of (Unit) to Variables and destroy them after use. I just want to find out why it freezes on left and down and not on up and right!

This is the Loop I used to make them run
  • Time - Every 0.04 seconds of game time
  • Actions
    • -------- Ball1 --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Ball1Speed Less than 60.00
      • Then - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Ball1Speed Greater than 0.00
          • Then - Actions
            • Unit - Move Ball1Unit instantly to ((Position of Ball1Unit) offset by Ball1Speed towards (Facing of Ball1Unit) degrees)
            • Set Ball1Speed = (Ball1Speed - 0.08)
          • Else - Actions
            • Unit - Move Ball1Unit instantly to ((Position of Ball1Unit) offset by Ball1Speed towards (Facing of Ball1Unit) degrees)
      • Else - Actions
    • -------- Ball2 --------
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Ball2Speed Less than 60.00
      • Then - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Ball2Speed Greater than 0.00
          • Then - Actions
            • Unit - Move Ball2Unit instantly to ((Position of Ball2Unit) offset by Ball2Speed towards (Facing of Ball2Unit) degrees)
            • Set Ball2Speed = (Ball2Speed - 0.08)
          • Else - Actions
            • Unit - Move Ball2Unit instantly to ((Position of Ball2Unit) offset by Ball2Speed towards (Facing of Ball2Unit) degrees)
      • Else - Actions
    • -------- Ball3 --------
    • Unit - Move Ball3unit instantly to ((Position of Ball3unit) offset by Ball3Speed towards (Facing of Ball3unit) degrees)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Ball3Speed Greater than 0.00
      • Then - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Ball3Speed Less than 60.00
          • Then - Actions
            • Unit - Move Ball3unit instantly to ((Position of Ball3unit) offset by Ball3Speed towards (Facing of Ball3unit) degrees)
            • Set Ball3Speed = (Ball3Speed - 0.08)
          • Else - Actions
            • Unit - Move Ball3unit instantly to ((Position of Ball3unit) offset by Ball3Speed towards (Facing of Ball3unit) degrees)
      • Else - Actions
    • -------- ¨Ball4 --------
    • Unit - Move Ball4Unit instantly to ((Position of Ball4Unit) offset by Ball4Speed towards (Facing of Ball4Unit) degrees)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Ball4Speed Less than 60.00
      • Then - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Ball4Speed Greater than 0.00
          • Then - Actions
            • Unit - Move Ball4Unit instantly to ((Position of Ball4Unit) offset by Ball4Speed towards (Facing of Ball4Unit) degrees)
            • Set Ball4Speed = (Ball4Speed - 0.08)
          • Else - Actions
            • Unit - Move Ball4Unit instantly to ((Position of Ball4Unit) offset by Ball4Speed towards (Facing of Ball4Unit) degrees)
      • Else - Actions
This is how I turned the ball, I found out that th eonly way to instantly turn them to an angle was to remake them.
  • BOUNCE1
    • Events
      • Unit - A unit enters Region 000 Copy 3 <gen>
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering unit) Equal to Ball1Unit
        • Then - Actions
          • Unit - Create 1 Ball for (Owner of (Entering unit)) at (Position of (Entering unit)) facing (181.00 - (Facing of (Triggering unit))) degrees
          • Set Ball1Unit = (Last created unit)
          • Trigger - Add to Ball1 Speed gain <gen> the event (Unit - Ball1Unit Takes damage)
          • Unit - Remove (Triggering unit) from the game
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering unit) Equal to Ball2Unit
            • Then - Actions
              • Unit - Create 1 Ball for (Owner of (Entering unit)) at (Position of (Entering unit)) facing (181.00 - (Facing of (Entering unit))) degrees
              • Set Ball2Unit = (Last created unit)
              • Trigger - Add to Ball2 Speed Gain <gen> the event (Unit - Ball2Unit Takes damage)
              • Unit - Remove (Triggering unit) from the game
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Triggering unit) Equal to Ball3unit
                • Then - Actions
                  • Unit - Create 1 Ball for (Owner of (Entering unit)) at (Position of (Triggering unit)) facing (181.00 - (Facing of (Triggering unit))) degrees
                  • Set Ball3unit = (Last created unit)
                  • Trigger - Add to Ball3 <gen> the event (Unit - Ball3unit Takes damage)
                  • Unit - Remove (Triggering unit) from the game
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Triggering unit) Equal to Ball4Unit
                    • Then - Actions
                      • Unit - Create 1 Ball for (Owner of (Entering unit)) at (Position of (Triggering unit)) facing (181.00 - (Facing of (Triggering unit))) degrees
                      • Set Ball4Unit = (Last created unit)
                      • Trigger - Add to Ball4 <gen> the event (Unit - Ball4Unit Takes damage)
                      • Unit - Remove (Triggering unit) from the game
                    • Else - Actions
It is Identical with the right region except that in some way the right region doesn't freeze the game[wtf] and the regions are different ofcourse. That the angle -+ thing doesn't change from side to side I haven't even bothered to think over how, I just know it does.

  • BOUNCE1 Copy Copy
    • Events
      • Unit - A unit enters Region 000 Copy <gen>
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering unit) Equal to Ball1Unit
        • Then - Actions
          • Unit - Create 1 Ball for (Owner of (Entering unit)) at (Position of (Triggering unit)) facing (180.00 - (Facing of (Triggering unit))) degrees
          • Set Ball1Unit = (Last created unit)
          • Trigger - Add to Ball1 Speed gain <gen> the event (Unit - Ball1Unit Takes damage)
          • Unit - Remove (Triggering unit) from the game
          • Wait 0.50 seconds
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering unit) Equal to Ball2Unit
            • Then - Actions
              • Unit - Create 1 Ball for (Owner of (Entering unit)) at (Position of (Triggering unit)) facing (180.00 - (Facing of (Triggering unit))) degrees
              • Set Ball2Unit = (Last created unit)
              • Trigger - Add to Ball2 Speed Gain <gen> the event (Unit - Ball2Unit Takes damage)
              • Unit - Remove (Triggering unit) from the game
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Triggering unit) Equal to Ball3unit
                • Then - Actions
                  • Unit - Create 1 Ball for (Owner of (Entering unit)) at (Position of (Triggering unit)) facing (180.00 - (Facing of (Triggering unit))) degrees
                  • Set Ball3unit = (Last created unit)
                  • Trigger - Add to Ball3 <gen> the event (Unit - Ball3unit Takes damage)
                  • Unit - Remove (Triggering unit) from the game
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Triggering unit) Equal to Ball4Unit
                    • Then - Actions
                      • Unit - Create 1 Ball for (Owner of (Entering unit)) at (Position of (Triggering unit)) facing (180.00 - (Facing of (Triggering unit))) degrees
                      • Set Ball4Unit = (Last created unit)
                      • Trigger - Add to Ball4 <gen> the event (Unit - Ball4Unit Takes damage)
                      • Unit - Remove (Triggering unit) from the game
                    • Else - Actions
I have done exactly the same with north and south regions too. To check them do it ingame, they should be the same with
  • Unit - Create 1 Ball for (Owner of (Entering unit)) at (Position of (Triggering unit)) facing (360.00 - (Facing of (Triggering unit))) degrees
Instead of
  • Unit - Create 1 Ball for (Owner of (Entering unit)) at (Position of (Entering unit)) facing (180.00 - (Facing of (Triggering unit))) degrees
 

Attachments

  • Wall Bounce Calculation.w3x
    23 KB · Views: 50
Last edited:
Level 3
Joined
Aug 21, 2009
Messages
73
That's gonna take ageeeeeeeeeeeeeeeeeeees -.-
And no, It doesn't freeze because of the corners, it isn't even nearby of the corners. The game freezes every time one of the balls touches the region up or down but not right or up. I have no idea why. When it hits the right or up it doesn't even show a sign to make any lagg or freeze but with the same trigger modified for that region it freezes on left and down.
I was aware of that it was gonna be a shitload of leaks I was more looking for the
  • Unit - Create 1 Ball for (Owner of (Entering unit)) at (Position of (Triggering unit)) facing (180.00 - (Facing of (Triggering unit))) degrees
to work, and it did, now! I need it to be automated and in a new fancy way that is way easier to do...
 
Level 11
Joined
Jun 28, 2011
Messages
540
That's gonna take ageeeeeeeeeeeeeeeeeeees -.-
And no, It doesn't freeze because of the corners, it isn't even nearby of the corners. The game freezes every time one of the balls touches the region up or down but not right or up. I have no idea why. When it hits the right or up it doesn't even show a sign to make any lagg or freeze but with the same trigger modified for that region it freezes on left and down.
I was aware of that it was gonna be a shitload of leaks I was more looking for the
  • Unit - Create 1 Ball for (Owner of (Entering unit)) at (Position of (Triggering unit)) facing (180.00 - (Facing of (Triggering unit))) degrees
to work, and it did, now! I need it to be automated and in a new fancy way that is way easier to do...

Remember... I'm just trying to help...

...

This worked for me... the game didn't crash after multiple tests... however, it will cause this to be non-mui...

  • Events
    • Unit - A unit enters Region (ALL OF THEM) <gen>
  • Actions
    • Trigger - Turn off (This trigger)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions) (Your Triggers)
    • Wait 0.01 seconds
    • Trigger - Turn on (This trigger)
 
Level 3
Joined
Aug 21, 2009
Messages
73
You're a genius. I actually thought of that but I forgot that the turn of doesn't stopp the current execution, I though that then and I was like aaaaaaahh that's true! Thank you very much :) problem solved. Now, I will fix rest like making some effects and fix the movement speed etc a bit :).

EDIT: It works really smooth now. I implented the location variable and the remove too. Now I need to make it bounce of players xD
 
Last edited:
Your triggers are leak feast yes :D Code can be much simpler.

This can help making further action within those triggers much easier.
  • init
    • Events
      • Map Initialization
    • Conditions
    • Actions
      • BallUnit[1] = yourUnit1
      • BallUnit[2] = yourUnit2
      • BallUnit[3] = yourUnit3
      • BallUnit[4] = yourUnit4
Let's move to the loop.
What the hell with condition <greaten than 0.00> if you do same actions? And by the way I dont get the idea of double checking <60 and >0. Eeeh. Where do you set ballspeed variable, for any of them? I dont see it. So its by default 0.

I'll use integer variable 'i' for loop, making trigger much smoother.
  • Time - Every 0.04 seconds of game time
  • Actions
    • For each i from 1 to 4 do actions
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Ballspeed[i] Greater than 0.00
          • Then - Actions
            • Set temppoint = Position of (BallUnit[i])
            • Set temppoint2 = (temppoint offset by Ballspell[i] towards (Facing of BallUnit[i] degrees)
            • Unit - Move Ball1Unit instantly to temppoint2
            • Set Ball1Speed = (Ball1Speed - 0.08)
            • Custom script: call RemoveLocation (udg_temppoint)
            • Custom script: call RemoveLocation (udg_temppoint2)
          • Else - Actions
Now i2 will run the loop.
  • BOUNCE1 Copy Copy
    • Events
      • Unit - A unit enters Region 000 Copy <gen>
    • Conditions
    • Actions
      • For each i2 from 1 to 4 do actions
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering unit) Equal to BallUnit[i2]
            • Then - Actions
              • Set temppoint = (Position of BallUnit[i2])
              • Unit - Create 1 Ball for (Owner of BallUnit[i2]) at temppoint facing (180.00 - (Facing of (Triggering unit))) degrees
              • Custom script: call RemoveLocation (udg_temppoint)
              • Set Ball1Unit = (Last created unit)
              • Unit - Remove (Triggering unit) from the game
              • Trigger - Add to Ball Speed gain <gen> the event (Unit - BallUnit[i2] Takes damage)
Add any ballunit to other trigger (whatever it is), dont create 4 if it's not needed.

I just shown the way it can be improved, but I dont get what are you doing.
You do not set any unit to ball1/2/3/4unit (or either you didnt posted trigger) so trigger do not know what to what unit given event should refer.

Speed is also not set, as I already mentioned. Post more imformations, I'll help you make proper trigger. Leaks removed by the way.
 
Level 3
Joined
Aug 21, 2009
Messages
73
I've just remade all the triggers and it works smooth! I'll post em here and attach the map:
I'm only posting 1 of the wall bounces since all is about the same except the region and the 180 or 360 - facing of BallUnit[i3]
  • Left Wall BOunce
    • Events
      • Unit - A unit enters Region 000 Copy 3 <gen>
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Ball
    • Actions
      • Trigger - Turn off (This trigger)
      • For each (Integer i3) from 1 to 4, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering unit) Equal to Ballunit[i3]
            • Then - Actions
              • Set temppoint = (Position of Ballunit[i3])
              • Unit - Create 1 Ball for (Owner of Ballunit[i3]) at temppoint facing (180.00 - (Facing of (Ballunit[i3]))) degrees
              • Set Ballunit[i3] = (Last created unit)
              • Special Effect - Create a special effect at temppoint using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
              • Special Effect - Destroy (Last created special effect)
              • Custom script: call RemoveLocation(udg_temppoint)
              • Trigger - Add to Ball1 <gen> the event (Unit - Ballunit[i3] Takes damage)
              • Unit - Remove (Triggering unit) from the game
            • Else - Actions
      • Wait 0.01 seconds
      • Trigger - Turn on (This trigger)
The movement loop
  • Ball Move Loop
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • -------- Ball1 --------
      • For each (Integer i) from 1 to 4, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Ballspeed[i] Greater than 0.00
            • Then - Actions
              • Set temppoint = (Position of Ballunit[i])
              • Set temppoint2 = (temppoint offset by Ballspeed[i] towards (Facing of Ballunit[i]) degrees)
              • Unit - Move Ballunit[i] instantly to temppoint2
              • Set Ballspeed[i] = (Ballspeed[i] - 0.04)
              • Custom script: call RemoveLocation(udg_temppoint)
              • Custom script: call RemoveLocation(udg_temppoint2)
            • Else - Actions
The speed gain trigger, I know this was missing in the explaination of my problem, but! I figured it out all by myself :p
  • Ball1
    • Events
      • Unit - Ball 0003 <gen> Takes damage
      • Unit - Ball 0002 <gen> Takes damage
      • Unit - Ball 0004 <gen> Takes damage
      • Unit - Ball 0005 <gen> Takes damage
    • Conditions
    • Actions
      • For each (Integer i4) from 1 to 4, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering unit) Equal to Ballunit[i4]
            • Then - Actions
              • Set Ballspeed[i4] = (Damage taken)
              • Set temppoint = (Position of Ballunit[i4])
              • Unit - Create 1 Ball for (Owner of Ballunit[i4]) at temppoint facing (Facing of (Damage source)) degrees
              • Set Ballunit[i4] = (Last created unit)
              • Trigger - Add to Ball1 <gen> the event (Unit - Ballunit[i4] Takes damage)
              • Unit - Remove (Triggering unit) from the game
              • Custom script: call RemoveLocation(udg_temppoint)
            • Else - Actions
If any of you have an idea of how I can make the balls bounce of other units in the right angle. I've tried to figure that out, but I can't come up with a way.
 

Attachments

  • Wall Bounce.w3x
    20.3 KB · Views: 48
Last edited:
Status
Not open for further replies.
Top