need help.. with bounce off boundary

mvcthinh

New Member
Reaction score
0
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

  • Hoi.rar
    14.6 KB · Views: 203

inevit4ble

Well-Known Member
Reaction score
38
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
Reaction score
0
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
Reaction score
0
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 <gen> contains p2) Equal to True
                  • (Region 000 <gen> 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
Reaction score
38
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
Reaction score
0
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
Reaction score
38
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
Reaction score
0
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

  • CBR.w3x
    47.8 KB · Views: 240

inevit4ble

Well-Known Member
Reaction score
38
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
 

inevit4ble

Well-Known Member
Reaction score
38
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 Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top