• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[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
 
Status
Not open for further replies.
Top