• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Wrong intersection

Status
Not open for further replies.
Level 6
Joined
Aug 28, 2015
Messages
213
Hello everyone,
I working on a diagrammskill-system and I have a problem with the intersection.
I take a screenshot so I can show you whats wrong.
screenshot.png

I want that every endpoint(green) get the closet intersection to the skillpoint(red), on its line, so the intersectionpoints would be by the yellow circles but actually is not(red circles).
here my triggers:
  • create Skilldiagram
    • Ereignisse
      • Spieler - Spieler 1 (Rot) skips a cinematic sequence
    • Bedingungen
    • Aktionen
      • Set Point_Mid = (Center of Gebiet 000 <gen>)
      • Set Amount_Endpoints = 5
      • Set Amount_Skillpoints = 3
      • Set Radius = 300.00
      • For each (Integer DL) from 1 to Amount_Endpoints, do (Actions)
        • Schleifen - Aktionen
          • Set Point_End[DL] = (Point_Mid offset by Radius towards ((360.00 / (Real(Amount_Endpoints))) x (Real(DL))) degrees)
          • Schwebender Text - Create floating text that reads (! + (String(DL))) at Point_End[DL] with Z offset 0.00, using font size 10.00, color (30.00%, 100.00%, 30.00%), and 0.00% transparency
          • Set Angle[DL] = (((360.00 / (Real(Amount_Endpoints))) x (Real(DL))) + 180.00)
          • Set Floating_Text[DL] = (Last created floating text)
          • Set Value[DL] = (Radius x 2.00)
      • For each (Integer DL) from 1 to Amount_Skillpoints, do (Actions)
        • Schleifen - Aktionen
          • Set Point_Skillpoint[DL] = (Point_Mid offset by (Random real number between 50.00 and 250.00) towards (Random angle) degrees)
          • Schwebender Text - Create floating text that reads (# + (String(DL))) at Point_Skillpoint[DL] with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
          • Set Floating_Text[(Amount_Endpoints + DL)] = (Last created floating text)
  • Calculate
    • Ereignisse
      • Spieler - Spieler 1 (Rot) types a chat message containing - as Ein Teil-String
    • Bedingungen
    • Aktionen
      • For each (Integer DL) from 1 to Amount_Endpoints, do (Actions)
        • Schleifen - Aktionen
          • Set Temp_Int = DL
          • Set X1_End = (X of Point_End[Temp_Int])
          • Set Y1_End = (Y of Point_End[Temp_Int])
          • Set Temp_Point = (Point_End[Temp_Int] offset by (Radius x 2.00) towards Angle[Temp_Int] degrees)
          • Set X2_End = (X of Temp_Point)
          • Set Y2_End = (Y of Temp_Point)
          • Custom script: call RemoveLocation(udg_Temp_Point)
          • For each (Integer DL) from 1 to Amount_Skillpoints, do (Actions)
            • Schleifen - Aktionen
              • Set X1_Skill = (X of Point_Skillpoint[DL])
              • Set Y1_Skill = (Y of Point_Skillpoint[DL])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • 'IF'-Bedingungen
                  • DL Gleich Amount_Skillpoints
                • 'THEN'-Aktionen
                  • Set X2_Skill = (X of Point_Skillpoint[1])
                  • Set Y2_Skill = (Y of Point_Skillpoint[1])
                • 'ELSE'-Aktionen
                  • Set X2_Skill = (X of Point_Skillpoint[(DL + 1)])
                  • Set Y2_Skill = (Y of Point_Skillpoint[(DL + 1)])
              • Custom script: set udg_ZX = (udg_X1_End * udg_Y1_End - udg_Y1_End * udg_X2_End) * (udg_X1_Skill - udg_X2_Skill) - (udg_X1_End - udg_X2_End) * ( udg_X1_Skill * udg_Y2_Skill - udg_Y1_Skill * udg_X2_Skill)
              • Custom script: set udg_ZY = (udg_X1_End * udg_Y1_End - udg_Y1_End * udg_X2_End) * (udg_Y1_Skill - udg_Y2_Skill) - (udg_Y1_End - udg_Y2_End) * ( udg_X1_Skill * udg_Y2_Skill - udg_Y1_Skill * udg_X2_Skill)
              • Custom script: set udg_n = ( udg_X1_End - udg_X2_End ) * ( udg_Y1_Skill - udg_Y2_Skill ) - ( udg_Y1_End - udg_Y2_End ) * ( udg_X1_Skill - udg_X2_Skill)
              • Set X = (ZX / n)
              • Set Y = (ZY / n)
              • Custom script: if ( ( udg_X - udg_X1_End) / ( udg_X2_End - udg_X1_End) > 1 or ( udg_X - udg_X1_Skill ) / (udg_X2_Skill - udg_X1_Skill ) > 1 or ( udg_Y - udg_Y1_End ) / ( udg_Y2_End - udg_Y1_End ) >1 or ( udg_Y - udg_Y1_Skill ) / ( udg_Y2_Skill - udg_Y1_Skill) > 1 ) then
              • Custom script: else
              • Set Temp_Point = (Point(X, Y))
              • Set Temp_Real = (Distance between Point_End[Temp_Int] and Temp_Point)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • 'IF'-Bedingungen
                  • Temp_Real Kleiner als Value[Temp_Int]
                • 'THEN'-Aktionen
                  • Set Value[Temp_Int] = Temp_Real
                  • Schwebender Text - Destroy Floating_Value[Temp_Int]
                  • Schwebender Text - Create floating text that reads (\/ + (String(Temp_Int))) at Temp_Point with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 0.00%), and 0.00% transparency
                  • Set Floating_Value[Temp_Int] = (Last created floating text)
                • 'ELSE'-Aktionen
              • Custom script: call RemoveLocation(udg_Temp_Point)
              • Custom script: endif
          • Set DL = Temp_Int
THX for helping.
edit: cangend the calculation, butt still the same problem
 
Last edited:
Level 6
Joined
Aug 28, 2015
Messages
213
In this system, the player should move one of the 3 red points a certain distance forward to one of the green points per level. After he moved one, the system check how close the mash of the red points are,to every green point, on theire line. The line is going from the green point to the other side of the circle.
The distance will convert in a percent skala.
Every green point is one effekt in the skill, that get this x percent bonus.

My problem is that the game gives me the wrong intersection point.
I'm looping through every green point and calculate for every combination of the red point and if the intersection point is the closest, it will show in the map.

I printed the data out and calculated by my selfe and got the same results but its wrong.
 

Attachments

  • Diagrammskill.w3x
    16.1 KB · Views: 63
Status
Not open for further replies.
Top