# need help.. with bounce off boundary

#### mvcthinh

##### New Member
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.
Trigger:
• 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)

Trigger:
• 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

• 14.6 KB Views: 166

#### inevit4ble

##### Well-Known Member
You have a couple options, either place 4 regions along the boundaries and check if unit is in the region or you can check the terrain tile type which is under the unit so if your map is only one terrain tile type then no problem else you just need to put 1 type along the boundaries.
Lines are:
Trigger:
• ((Playable map area) contains (Triggering unit)) Equal to True
Trigger:
• (Terrain type at (Center of (Playable map area))) Equal to Lordaeron Summer - Dirt

#### mvcthinh

##### New Member
You have a couple options, either place 4 regions along the boundaries and check if unit is in the region or you can check the terrain tile type which is under the unit so if your map is only one terrain tile type then no problem else you just need to put 1 type along the boundaries.
Lines are:
Trigger:
• ((Playable map area) contains (Triggering unit)) Equal to True
Trigger:
• (Terrain type at (Center of (Playable map area))) Equal to Lordaeron Summer - Dirt
thank you so much.. ^^ It's worked ...

#### mvcthinh

##### New Member
One more thing.. I want to check condition X coordinates of the Unit with min X and min Y of the max without using rect. So how can I do that? I don't know how to call it! I think it could be useful.

Trigger:
• Untitled Trigger 002 Copy
• Events
• Time - Every 0.01 seconds of game time
• Conditions
• Actions
• Set p1 = (Position of u)
• Set p2 = (p1 offset by 20.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
• (Terrain pathing at p2 of type Buildability is off) Equal to True
• Then - Actions
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• Or - Any (Conditions) are true
• Conditions
• (Region 001 &lt;gen&gt; contains p2) Equal to True
• (Region 000 &lt;gen&gt; contains p2) Equal to True
• Then - 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
• 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
• If (All Conditions are True) then do (Then Actions) else do (Else Actions)
• If - Conditions
• (Terrain type at p2) Equal to Lordaeron Summer - Grass
• Then - Actions
• Set angle = (90.00 x 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)

#### inevit4ble

##### Well-Known Member
OT: tags are [ spoiler ] [ /spoiler ]

You can use real coordinates but it will become excessively complex and not sure it will even work as the coordinates will give you a point, can a unit be in a point? or would you check that the point is within other points?

And why do you not want to use regions?

#### mvcthinh

##### New Member
because with every unpassable terrain or doodad have collision size in the map , each one I have to create a region! OMG it will need a long time to finish... But also I can't do both way.
I know Jass so I want to use coordinates instead of point. Because coordinates do not leak memory.
Could you help me?

#### inevit4ble

##### Well-Known Member
Hmm.
Ok well I can help you, but what is the whole story?

You have the boundaries that it bounces off and the doodads and stuff must bounce the missile too?

#### mvcthinh

##### New Member
Thanks! I want to make a spell. Like this spell(Example 4) in JASS Or somespell like that. When I read this spell in GUI but MUI I couldn't understand because the system is too long (lazy ^^!).

could you please show me the way to make it as you said? ["You have the boundaries that it bounces off and the doodads and stuff must bounce the missile too?" - "Yes that's it!"]

#### Attachments

• 47.8 KB Views: 207

#### inevit4ble

##### Well-Known Member
Ok I've taken a good look, but its really all over the place (jass makes this stuff so much easier to read) so I will need more time to work something out but I am looking into it

#### mvcthinh

##### New Member
Ok I've taken a good look, but its really all over the place (jass makes this stuff so much easier to read) so I will need more time to work something out but I am looking into it
Ok, I will wait. Thanks for your help ^^

#### inevit4ble

##### Well-Known Member
I can't get the maths perfect but if you have the boundaries find then what you can do (what I got from the snippet) is use something like this:
Trigger:
• Destructible - Pick every destructible within 75.00 of Missile_StartPoint and do (Actions)
• Loop - Actions
• Set Missile_FlyAngle = (Angle from Missile_StartPoint to (Missile_StartPoint offset by 10.00 towards (90.00 - Missile_FlyAngle) degrees))

So in the trigger that moves the missile just add (Trigger Run - <Trigger with above actions in it>)

Missile_Start Point is the position of the missile as it moves.

General chit-chat
Help Users
• No one is chatting at the moment.
• The Helper:
Happy Sunday!
+1
• The Helper:
I will be out of town until Sunday evening
+1
• The Helper:
I am back! Did you miss me LOL
+1
• jonas:
where did you go?
• The Helper:
Jefferson TX on a Paranormal Investigation of a haunted bed and breakfast - I got some friends that are paranormal investigators and they have an RV and do YouTubes
+1
• The Helper:
It was a lot of fun. The RV was bad ass
• jonas:
That sounds like fun!
+1
• The Helper:
it was a blast!
• The Helper:
I am going to post the Youtube of the investigation in the forums when it is ready
+1
• jonas:
cool!
• vypur85:
Sounds cool TH.
• tom_mai78101:
I was on a Legend of Zelda marathon...
• tom_mai78101:
Am still doing it now
+1
• jonas:
which one(s) are you playing?
• jonas:
I played a little bit of the switch title two weeks ago and found it quite boring
• The Helper:
just got back from San Antonio this weekend had the best Buffalo Chicken Cheesesteak sandwhich in Universal City, TX - place was called Yous Guys freaking awesome! Hope everyone had a fantastic weekend!
+1
• The Helper:
Happy Tuesday!
• The Helper:
We have been getting crazy numbers reported by the forum of people online the bots are going crazy on us I think it is AI training bots going at it at least that is what it looks like to me.
• The Helper:
Most legit traffic is tracked on multiple Analytics and we have Cloud Flare setup to block a ton of stuff but still there is large amount of bots that seem to escape detection and show up in the user list of the forum. I have been watching this bullshit for a year and still cannot figure it out it is drving me crazy lol.
+1
• Ghan:
Beep boop
+1
• The Helper:
hears robot sounds while 250 bots are on the forum lol
• The Helper:
Happy Saturday!
+1
• The Helper:
and then it was Thursday...
+2

### Members online

No members online now.