# need help with bounce off boundary

Status
Not open for further replies.

#### mvcthinh

Level 2
Hi!. I'm a newbie and I need help.
I want to make a missile which could be bounce off when it reaches the boundary , I try to do that but I cant because I don't know what exactly to write into the condition trigger. Pls check this and help me.

Plus, Here the trigger

when the missile reaches the horizontal boundary , it could bounce off but when it reaches the vertical boundary , It was trapped and can't move anymore.
• Untitled Trigger 001
• Events
• Map initialization
• Conditions
• Actions
• Visibility - Disable black mask
• Visibility - Disable fog of war
• Unit - Create 1 Peasant for Player 1 (Red) at (Center of (Playable map area)) facing 260.00 degrees
• Set u = (Last created unit)
• Set angle = (Facing of u)
• Set p1 = (Position of u)
• Set p2 = (p1 offset by 25.00 towards angle degrees)
• Untitled Trigger 002
• Events
• Time - Every 0.01 seconds of game time
• Conditions
• Actions
• Set p1 = (Position of u)
• Set p2 = (p1 offset by 5.00 towards angle degrees)
• Set angle = (Angle from p1 to p2)
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• Or - Any (Conditions) are true
• Conditions
• (Terrain pathing at p2 of type Flyability is off) Equal to True
• (Terrain pathing at p2 of type Walkability is off) Equal to True
• Then - Actions
• -------- I don't know how to put condition exactly --------
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• Then - Actions
• Set angle = (0.00 - angle)
• Unit - Remove u from the game
• Unit - Create 1 Peasant for Player 1 (Red) at p1 facing angle degrees
• Set u = (Last created unit)
• Game - Display to (All players) the text: (String(angle))
• Else - Actions
• Set angle = (180.00 - angle)
• Unit - Remove u from the game
• Unit - Create 1 Peasant for Player 1 (Red) at p1 facing angle degrees
• Set u = (Last created unit)
• Game - Display to (All players) the text: (String(angle))
• Else - Actions
• Unit - Make u face p2 over 0.00 seconds
• Unit - Move u instantly to p2
• Custom script: call RemoveLocation(udg_p1)
• Custom script: call RemoveLocation(udg_p2)

#### Attachments

• Hoi.w3x
17.3 KB · Views: 64

#### Maker

Level 37
By boundary, do you mean the edges of the map or any unpassable terrain in the map?

If you mean the edges of the map, just compare the x coordinate of the unit to the min and max x of the map.

#### mvcthinh

Level 2
By boundary, do you mean the edges of the map or any unpassable terrain in the map?

If you mean the edges of the map, just compare the x coordinate of the unit to the min and max x of the map.

thank you... could you please give me a demo?
one more thing, I don't know what exactly is min and max x of the map.
Like:

• (X of p2) Less than or equal to (Min X of (Initial camera bounds))
• (X of p2) Greater than or equal to (Min Y of (Initial camera bounds))
• ________
• (X of p2) Less than or equal to (Min X of (Playable map area))
• ditto [Y]
• ________
• (X of p2) Less than or equal to (Min X of (Entire map))
• ditto [Y]
I've tried all of them but it not work exactly

Last edited:

#### mvcthinh

Level 2
Btw, pls help me with both way. the edges of the map and any unpassable terrain in the map.

#### Striker21

Level 9
Actually, i've met this situation before. It's because you expanded the "Scenario/Size and Camera Bounds" to it's maximum. You could smaller the camera bounds to fix this. Hope it was helpful

#### mvcthinh

Level 2
Actually, i've met this situation before. It's because you expanded the "Scenario/Size and Camera Bounds" to it's maximum. You could smaller the camera bounds to fix this. Hope it was helpful

you had met this situation before,so how you did it?
I resized it smaller but its not working. It's still trapped when reaches the vertical edges.

#### Striker21

Level 9
resize but it must have a little bigger "shadow path" (this shadow path is the key point, it'll not allow units to blink here (which the very black path behind the shadow path doesn't). or also some spell like Shockwave etc... could also help you avoid some bug in blink spells). With just a little of shadow path, it doesn't work also.
What i got the last time was... get stuck the hero unit with my custom blink spell...
If it's still not clear yet, i'll upload a screenshot

#### mvcthinh

Level 2
resize but it must have a little bigger "shadow path" (this shadow path is the key point, it'll not allow units to blink here (which the very black path behind the shadow path doesn't). or also some spell like Shockwave etc... could also help you avoid some bug in blink spells). With just a little of shadow path, it doesn't work also.
What i got the last time was... get stuck the hero unit with my custom blink spell...
If it's still not clear yet, i'll upload a screenshot

I want to see the screenshot! I've made it as you said but...!!!
Could you please give me a demo map?

#### Striker21

Level 9
Well, it could be another problem, but i'm trying to help so...
I can't upload my screenshot on HW so i use another site...
Hope it'll show up

Edit 2: From the trigger at your 1st post... i think it's not that necessary... Just create a region, when this dummy leave this region (your playable map) you kill it and so the problem is gone

#### mvcthinh

Level 2
• If - Conditions
• ((Playable map area) contains p2) Equal to False
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• Or - Any (Conditions) are true
• Conditions
• (Min X of (Playable map area)) Greater than or equal to (X of p2)
• (Max X of (Playable map area)) Less than or equal to (X of p2)
• Then - Actions
• Set angle = (180.00 - angle)
• Game - Display to (All players) the text: (String(angle))
• Else - Actions
• Set angle = (0.00 - angle)
• Game - Display to (All players) the text: (String(angle))
• Else - Actions
I've tried again. And this time, it's worked with the boundary.

Status
Not open for further replies.

[Solved] Help, Weird loop
Replies
6
Views
433
Replies
8
Views
669
Replies
5
Views
515
Replies
4
Views
609
Replies
7
Views
1K