• 🏆 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] Offset points for an octagon?

Status
Not open for further replies.
Level 16
Joined
Oct 12, 2008
Messages
1,570
Octa = 8 right?
JASS:
function octagon takes real StartX, real StartY, real Length returns nothing
    local integer i = 0
    loop
        exitwhen i > 7
        set Location[i] = Location(StartX + Length * Cos((360/8)*i),StartY + Length * Sin((360/8)*i))
        set i = i + 1
    endloop
endfunction
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
  • For each (Integer A) from 0 to 7 do Multiple Actions
    • Actions
      • Custom script: set udg_Location[bj_forLoopIndexA] = Location(udg_StartX + udg_Length * Cos(((360/8)*bj_forLoopIndexA)*bj_DEGTORAD),udg_StartY + udg_Length * Sin(((360/8)*bj_forLoopIndexA)*bj_DEGTORAD))
 
Last edited:
Level 8
Joined
Aug 1, 2008
Messages
420
Thx so much, +rep. But what i wanted was to set variables to those points, is that what this does? I dont really understand it.
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
Yes it sets the points,
Create a variable with a name and type Point array
in the Custom script, change 'udg_Location[bj_forLoopIndexA]' with 'udg_YOURNAME[bj_forLoopIndexA]'
udg_Location[0] is the most right point, Location[2] is the lowest point, Location[4] is the most left point, and Location[6] is the upper point, the rest is in between,, so this is how you can see it:
Location[0] = East
Location[1] = SouthEast
Location[2] = South
Location[3] = SouthWest
Location[4] = West
Location[5] = NorthWest
Location[6] = North
Location[7] = NorthEast
 
  • Like
Reactions: Rmx
Level 8
Joined
Aug 1, 2008
Messages
420
It doesnt work. It gives me 4 errors in the same line >.>... print screen coming up.

v6kjg9.jpg

and my trigger is:
  • Custom script: set udg_NeedlesSummonLocation[bj_forLoopIndexA] = Location(udg_StartX + udg_Length * Cos(((360/8)*bj_forLoopIndexA)*bj_DEGTORAD),udg_StartY + udg_Length * Sin(((360/8)*bj_forLoopIndexA)*bj_DEGTORAD))
which i think is what you put?
 
Level 8
Joined
Aug 4, 2008
Messages
279
If you want any polygon just use 360 : (Number of the polygons side), It is very simple, You want octagon, 360 : 8 = 45
If you Want the eight points just set

Octagon[1] = 45
Octagon[2] = 90
Octagon[3] = 135
Octagon.... = ....
Octagon is a variable real array
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
Wow, great, then you have the angle at which every point is. If you look very well you can see that in my function, you dont calculate the angles, but the Locations already, so no need of that real array, only a point array,,
 
Status
Not open for further replies.
Top